Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat(agent): add public share, forward and frontend rating UI (#465)
yika462d5822a368
diff --git a/project/web/public/sitemap-0.xml b/project/web/public/sitemap-0.xmlindex ac08f29f..4aff2667 100644--- a/project/web/public/sitemap-0.xml+++ b/project/web/public/sitemap-0.xml@@ -1,6 +1,6 @@<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">-<url><loc>https://aitoearn.ai/healthz</loc><lastmod>2025-12-25T07:17:38.132Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>+<url><loc>https://aitoearn.ai/healthz</loc><lastmod>2025-12-25T08:13:21.639Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://aitoearn.ai/en</loc><lastmod>2025-12-25T06:58:43.312Z</lastmod><changefreq>monthly</changefreq><priority>0.8</priority></url><url><loc>https://aitoearn.ai/en/websit/terms-of-service</loc><lastmod>2025-12-20T14:27:57.199Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url><url><loc>https://aitoearn.ai/en/websit/privacy-policy</loc><lastmod>2025-12-20T14:27:57.198Z</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>diff --git a/project/web/src/api/agent.ts b/project/web/src/api/agent.tsindex 332c1d1a..7a28e15d 100644--- a/project/web/src/api/agent.ts+++ b/project/web/src/api/agent.ts@@ -494,5 +494,15 @@ export const agentApi = {const res = await http.post(`agent/tasks/${taskId}/rating`, { rating, comment })return res},+ /**+ * Create a public share token for a task+ * @param taskId+ * @param ttlSeconds optional validity in seconds+ */+ async createPublicShare(taskId: string, ttlSeconds?: number) {+ const body = typeof ttlSeconds === 'number' ? { ttlSeconds } : undefined+ const res = await http.post<{ token: string; expiresAt: string; urlPath: string }>(`agent/tasks/${taskId}/share`, body)+ return res+ },}diff --git a/project/web/src/app/i18n/locales/en/promptGallery.json b/project/web/src/app/i18n/locales/en/promptGallery.jsonindex 118c8fb5..67fb4a08 100644--- a/project/web/src/app/i18n/locales/en/promptGallery.json+++ b/project/web/src/app/i18n/locales/en/promptGallery.json@@ -49,22 +49,41 @@},"agentFeatures": {- "title": "AI Agent Highlights",+ "title": "Aitoearn Key Feature","subtitle": "Our signature features, one click away","platforms": "Supported platforms","helperTitle": "One-line publish","helperExample": "Example: Generate images about \"street food\" with oil painting style and suggest publish times for Instagram","items": {- "schedule": { "title": "Schedule Publish", "desc": "Set publish time and auto-publish to all connected platforms", "point1": "Support one-time / recurring / timezone-specific", "point2": "Provide smart time suggestions" },- "inspiration": { "title": "Creative Inspiration", "desc": "Generate topic ideas based on your account", "point1": "Multiple style templates", "point2": "Trending & data-driven suggestions" },- "storyboard": { "title": "Storyboard Design", "desc": "Auto-generate storyboard script for a topic", "point1": "Timeline & dialog support", "point2": "Exportable shooting checklist" },- "download": { "title": "Content Download", "desc": "Download videos based on social platform links and organize as publishable assets", "point1": "Auto fetch multiple resolutions", "point2": "Batch download & format conversion" },- "highlight": { "title": "Highlight Editing", "desc": "Extract dramatic and suspenseful clips", "point1": "Auto-detect highlight moments", "point2": "Support multiple edit templates" },- "translate": { "title": "Video Translation", "desc": "Face-level lip-sync, voice cloning, subtitle removal", "point1": "Multi-language support", "point2": "Export embedded or soft subtitles" },- "styleTransfer": { "title": "Style Transfer", "desc": "Convert live-action to anime/3D/sketch styles", "point1": "Multiple styles one-click", "point2": "Preserve facial expression details" },- "videoGenerate": { "title": "Video Generation", "desc": "Generate short video assets from scripts or prompts", "point1": "Auto music & shot planning", "point2": "Platform-length optimized outputs" },- "imageGenerate": { "title": "Image Generation", "desc": "Generate high-quality images from prompts", "point1": "Support multi-style & multi-output", "point2": "Direct publish or export" },- "videoUnderstanding": { "title": "Video Understanding", "desc": "Automatically analyze video and generate structured summaries", "point1": "Emotion,人物, event recognition", "point2": "Generate searchable tags & chapters" }+ "inspiration": { "title": "Creative Inspiration", "desc": "Generate topic ideas and creative templates from account traits and trends" },+ "oneClickScript": { "title": "One-click Script", "desc": "Auto-generate short video / article scripts and storyboard details from keywords or prompts" },+ "multiTemplates": { "title": "Multi-style Templates", "desc": "Provide multiple video and copy style templates with one-click switching" },+ "imageGenerate": { "title": "Image Generation", "desc": "Generate high-quality images from prompts, supporting multiple styles and outputs" },+ "videoGenerate": { "title": "Video Generation", "desc": "Produce short video drafts from scripts or prompts, including music and shot suggestions" },++ "highlight": { "title": "Highlight Editing", "desc": "Automatically detect high-energy moments and create highlight clips using templates" },+ "storyboard": { "title": "Storyboard Design", "desc": "Auto-generate timeline, dialogue and shooting checklist with export support" },+ "coverSuggestion": { "title": "Cover & Thumbnail", "desc": "Generate multiple cover options and suggest click-optimized thumbnails" },+ "download": { "title": "Asset Download & Convert", "desc": "Fetch platform videos, batch-download in multiple resolutions and convert formats" },++ "videoTranslation": { "title": "Video Translation", "desc": "Support face-level lip-sync, voice cloning and embedded/soft subtitle export" },+ "platformAdapt": { "title": "Platform Adaptation", "desc": "Automatically adjust copy length, pacing and format to target platform rules" },+ "topicTag": { "title": "Topic & Tag Recommendation", "desc": "Recommend high-value topics and tags based on trends and account history" },+ "seo": { "title": "SEO & Keyword Optimization", "desc": "Provide search and discovery optimization suggestions for copy and descriptions" },++ "schedule": { "title": "Scheduled Publishing", "desc": "Support one-time, recurring and timezone-aware scheduling and auto-publish" },+ "multiPlatform": { "title": "Multi-platform Distribution", "desc": "Configure once and automatically sync and publish to multiple channels" },+ "smartTime": { "title": "Smart Time Suggestion", "desc": "Recommend optimal publish times based on historical data to maximize reach" },++ "sse": { "title": "Streaming Tasks (SSE)", "desc": "Stream task generation in real-time with incremental results and cancel support" },+ "taskManagement": { "title": "Task Management", "desc": "Create/stop/view/delete tasks, rate and comment; support task forwarding and duplication" },+ "workflow": { "title": "Extensible Workflows", "desc": "Support multi-step pipelines and custom action handlers to chain complex automation" },++ "videoUnderstanding": { "title": "Video Understanding", "desc": "Automatically recognize emotions, people and events to generate tags and chapters" },+ "report": { "title": "Reporting & Insights", "desc": "Auto-generate publish performance and growth suggestions for review and optimization" },++ "commentAssistant": { "title": "Comment & DM Assistant", "desc": "Auto-generate reply suggestions and batch-reply templates to boost engagement" },+ "audienceInsight": { "title": "Audience Insights", "desc": "Provide audience profiles and content preference analysis to guide topic and targeting" }}}}diff --git a/project/web/src/app/i18n/locales/zh-CN/promptGallery.json b/project/web/src/app/i18n/locales/zh-CN/promptGallery.jsonindex f483ef65..c3b295b2 100644--- a/project/web/src/app/i18n/locales/zh-CN/promptGallery.json+++ b/project/web/src/app/i18n/locales/zh-CN/promptGallery.json@@ -49,22 +49,41 @@},"agentFeatures": {- "title": "AI Agent 功能亮点",+ "title": "Aitoearn 关键特性","subtitle": "我们的特色功能,一键触达","platforms": "支持的平台","helperTitle": "一句话帮我发布","helperExample": "例如:生成一段主题「街头美食」内容的图片,油画风格,建议几点发布到 Instagram","items": {- "schedule": { "title": "定时发布", "desc": "支持设置发布时间并自动发布到所有已连接的平台", "point1": "支持单次/循环/指定时区", "point2": "可设置智能发布时间建议" },- "inspiration": { "title": "创意灵感", "desc": "根据账号特性生成选题建议", "point1": "提供多风格选题模板", "point2": "结合热点与数据推荐" },- "storyboard": { "title": "分镜设计", "desc": "为指定选题自动生成分镜脚本", "point1": "支持分镜时间轴与台词", "point2": "可导出为脚本或拍摄清单" },- "download": { "title": "内容下载", "desc": "根据社交平台链接下载视频并整理为可发布素材", "point1": "自动抓取多清晰度资源", "point2": "支持批量下载与格式转换" },- "highlight": { "title": "高光剪辑", "desc": "提取剧情冲突与悬念片段", "point1": "智能识别高能片段", "point2": "支持多风格剪辑模板" },- "translate": { "title": "视频翻译", "desc": "面容级口型匹配、音色克隆、字幕擦除", "point1": "支持多语种互译", "point2": "可导出嵌入式字幕或软字幕" },- "styleTransfer": { "title": "真人实拍转绘", "desc": "动漫 / 3D 卡通 / 素描等风格", "point1": "多风格一键切换", "point2": "保留面部表情细节" },- "videoGenerate": { "title": "视频生成", "desc": "基于脚本或提示生成短视频素材", "point1": "支持自动配乐与镜头规划", "point2": "输出适配各平台时长" },- "imageGenerate": { "title": "图片生成", "desc": "基于提示词生成高质量图像", "point1": "支持多风格与多张输出", "point2": "可直接发布或导出" },- "videoUnderstanding": { "title": "视频理解", "desc": "自动分析视频内容并生成结构化摘要", "point1": "情绪、人物与事件识别", "point2": "生成可搜索标签与章节" }+ "inspiration": { "title": "创意灵感", "desc": "基于账号特性与热点自动生成选题与创意模板,快速产出话题清单" },+ "oneClickScript": { "title": "一键生成脚本", "desc": "从关键词或提示自动生成短视频/图文脚本与分镜要点" },+ "multiTemplates": { "title": "多风格模板", "desc": "提供多种视频/文案风格模板,一键切换输出样式" },+ "imageGenerate": { "title": "图片生成", "desc": "根据提示词生成高质量图像,支持多风格与多张输出" },+ "videoGenerate": { "title": "视频生成", "desc": "从脚本或提示自动生成短视频草稿,含配乐与镜头建议" },++ "highlight": { "title": "高光剪辑", "desc": "智能识别高能片段并按模板生成短视频高光" },+ "storyboard": { "title": "分镜设计", "desc": "自动产出时间轴、台词与拍摄清单,支持导出脚本" },+ "coverSuggestion": { "title": "封面与缩略图建议", "desc": "生成多套封面方案并给出点击率优化建议" },+ "download": { "title": "素材下载与转换", "desc": "一键抓取平台视频,多清晰度批量下载并格式转换" },++ "videoTranslation": { "title": "视频翻译", "desc": "支持面容级口型匹配、音色克隆与嵌入/软字幕导出" },+ "platformAdapt": { "title": "平台适配", "desc": "自动调整文案长度、节奏与格式以适配目标平台规范" },+ "topicTag": { "title": "话题与标签推荐", "desc": "基于实时热点与账号历史推荐高价值话题标签" },+ "seo": { "title": "SEO/关键词优化", "desc": "为文案和说明提供搜索与发现向优化建议" },++ "schedule": { "title": "定时排期发布", "desc": "支持单次/循环/时区设置,自动按排期发布到已连接平台" },+ "multiPlatform": { "title": "多平台一键分发", "desc": "统一配置后自动同步并发布到多个渠道" },+ "smartTime": { "title": "智能发布时间建议", "desc": "基于历史数据推荐最优发布时间以提高覆盖" },++ "sse": { "title": "流式任务执行(SSE)", "desc": "任务实时流式生成,中途可查看增量结果并中断" },+ "taskManagement": { "title": "任务管理", "desc": "创建/停止/查看/删除任务、任务评分与评论,支持任务转发与复制" },+ "workflow": { "title": "可扩展工作流", "desc": "支持分步处理与自定义 action handlers,便于串联多阶段自动化" },++ "videoUnderstanding": { "title": "视频理解", "desc": "自动识别情绪、人物与事件,生成标签、章节与结构化摘要" },+ "report": { "title": "运营报告", "desc": "自动生成发布效果与增长建议,便于复盘与优化" },++ "commentAssistant": { "title": "评论与私信助手", "desc": "自动生成回复建议与批量回复模板,提升互动效率" },+ "audienceInsight": { "title": "用户画像洞察", "desc": "提供受众画像与内容倾向分析,辅助选题与投放策略" }}}}diff --git a/project/web/src/components/Chat/TaskCard/index.tsx b/project/web/src/components/Chat/TaskCard/index.tsxindex 749a9323..36d1317c 100644--- a/project/web/src/components/Chat/TaskCard/index.tsx+++ b/project/web/src/components/Chat/TaskCard/index.tsx@@ -6,15 +6,15 @@'use client'import type React from 'react'-import { useState } from 'react'+import { AlertCircle, CheckCircle2, ExternalLink, Link2, Loader2, MessageSquare, Trash2 } from 'lucide-react'import { useRouter } from 'next/navigation'-import { Loader2, MessageSquare, Trash2, AlertCircle, CheckCircle2, Link2 } from 'lucide-react'+import { useState } from 'react'import { agentApi } from '@/api/agent'-import { toast } from '@/lib/toast'-import { cn, formatRelativeTime } from '@/lib/utils'-import { useGetClientLng } from '@/hooks/useSystem'import { useTransClient } from '@/app/i18n/client'import { Modal } from '@/components/ui/modal'+import { useGetClientLng } from '@/hooks/useSystem'+import { toast } from '@/lib/toast'+import { cn, formatRelativeTime } from '@/lib/utils'export interface ITaskCardProps {/** 任务ID */@@ -42,7 +42,7 @@ export interface ITaskCardProps {/** 获取状态显示配置 */function getStatusConfig(status: string | undefined, t: (key: string) => string) {const normalizedStatus = status?.toLowerCase()-+switch (normalizedStatus) {case 'requires_action':return {@@ -100,14 +100,15 @@ export function TaskCard({const [isProcessing, setIsProcessing] = useState(false)const [ratingModalOpen, setRatingModalOpen] = useState(false)const [inlineRating, setInlineRating] = useState<number>(0)- const [ratingComment, setRatingComment] = useState<string>('')+ const [ratingComments, setRatingComments] = useState<string[]>(['', '', '', ''])const [isRatingSubmitting, setIsRatingSubmitting] = useState(false)-+const statusConfig = getStatusConfig(status, t as (key: string) => string)/** 跳转到对话详情页 */const handleClick = () => {- if (isDeleting) return+ if (isDeleting)+ returnif (onSelect) {onSelect(id)return@@ -118,12 +119,14 @@ export function TaskCard({/** 处理删除 */const handleDelete = async (e: React.MouseEvent) => {e.stopPropagation()- if (!onDelete || isDeleting) return+ if (!onDelete || isDeleting)+ returntry {setIsDeleting(true)await onDelete(id)- } finally {+ }+ finally {setIsDeleting(false)}}@@ -131,7 +134,8 @@ export function TaskCard({/** 处理转发(复制会话为新任务并跳转) */const handleShare = async (e: React.MouseEvent) => {e.stopPropagation()- if (isProcessing) return+ if (isProcessing)+ returntry {setIsProcessing(true)// 创建一个新的任务(复用会话),获取新 id@@ -142,17 +146,52 @@ export function TaskCard({try {await navigator.clipboard.writeText(url)toast.success(t('task.copyLinkSuccess' as any) || 'Link copied')- } catch {+ }+ catch {// ignore clipboard error, still navigate}router.push(`/${lng}/chat/${newTaskId}`)- } else {+ }+ else {toast.error((res as any)?.msg || t('task.forwardFailed' as any) || 'Share failed')}- } catch (error) {+ }+ catch (error) {console.error('Share failed', error)toast.error(t('task.forwardFailed' as any) || 'Share failed')- } finally {+ }+ finally {+ setIsProcessing(false)+ }+ }++ /** 创建公开分享链接 */+ const handleCreatePublicLink = async (e: React.MouseEvent) => {+ e.stopPropagation()+ if (isProcessing)+ return+ try {+ setIsProcessing(true)+ const res = await agentApi.createPublicShare(id)+ const token = (res as any)?.data?.token || (res as any)?.token+ const urlPath = (res as any)?.data?.urlPath || (res as any)?.urlPath+ const fullUrl = urlPath ? `${window.location.origin}${urlPath}` : `${window.location.origin}/agent/tasks/shared/${token}`+ try {+ await navigator.clipboard.writeText(fullUrl)+ toast.success(t('task.publicShareCopied' as any) || 'Public share link copied to clipboard')+ }+ catch {+ // fallback: log link so user can copy from console if clipboard denied++ console.log('Public share link:', fullUrl)+ toast.success(t('task.publicShareCreated' as any) || 'Public share link created')+ }+ }+ catch (err) {+ console.error('Create public share failed', err)+ toast.error(t('task.publicShareFailed' as any) || 'Create public share failed')+ }+ finally {setIsProcessing(false)}}@@ -165,17 +204,23 @@ export function TaskCard({}try {setIsRatingSubmitting(true)- const res = await agentApi.createRating(id, inlineRating, ratingComment)+ // 将4个评论组合成一个字符串,用分隔符分开+ const combinedComment = ratingComments.filter(comment => comment.trim() !== '').join('\n---\n')+ const res = await agentApi.createRating(id, inlineRating, combinedComment)if (res && (res as any).code === 0) {toast.success(t('task.ratingSuccess' as any) || 'Rating submitted')setRatingModalOpen(false)- } else {+ setRatingComments(['', '', '', '']) // 重置评论+ }+ else {toast.error((res as any)?.msg || (t('task.ratingFailed' as any) || 'Submit failed'))}- } catch (error) {+ }+ catch (error) {console.error('Submit rating failed', error)toast.error(t('task.ratingFailed' as any) || 'Submit failed')- } finally {+ }+ finally {setIsRatingSubmitting(false)}}@@ -183,7 +228,8 @@ export function TaskCard({/** 触发评分回调(由历史列表等外部组件使用) */const handleRateClick = (e: React.MouseEvent) => {e.stopPropagation()- if (!onRateClick) return+ if (!onRateClick)+ returnonRateClick(id)}@@ -191,7 +237,7 @@ export function TaskCard({<divonClick={handleClick}className={cn(- 'group relative flex flex-col p-4 rounded-xl border border-border bg-card cursor-pointer transition-all',+ 'flex flex-col p-4 rounded-xl border border-border bg-card cursor-pointer transition-all','hover:border-border hover:shadow-md',isDeleting && 'opacity-60 cursor-wait',className,@@ -216,35 +262,53 @@ export function TaskCard({<span className={cn('inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium',statusConfig.className,- )}>+ )}+ >{statusConfig.icon && (<statusConfig.icon className={cn('w-3 h-3',status?.toLowerCase() === 'running' && 'animate-spin',- )} />+ )}+ />)}{statusConfig.label}</span>)}</div>- {/* Action buttons: Share (forward+copy) and Delete */}- <div className="absolute top-2 right-2 flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity">- <button- onClick={handleShare}- disabled={isDeleting || isProcessing}- className="w-8 h-8 rounded-md flex items-center justify-center hover:bg-muted text-muted-foreground hover:text-foreground"- aria-label="share"- >- {isProcessing ? <Loader2 className="w-4 h-4 animate-spin" /> : <Link2 className="w-4 h-4" />}- </button>+ {/* Action buttons: Prominent share and subtle delete */}+ <div className="mt-3 flex items-center justify-between gap-3">+ {/* Share buttons - prominent */}+ <div className="flex items-center gap-2">+ <button+ onClick={handleShare}+ disabled={isDeleting || isProcessing}+ className="flex items-center gap-2 px-3 py-2 rounded-lg bg-primary/10 hover:bg-primary/20 text-primary hover:text-primary/90 transition-colors text-sm font-medium min-w-[80px] justify-center"+ aria-label="share"+ >+ {isProcessing ? <Loader2 className="w-4 h-4 animate-spin" /> : <MessageSquare className="w-4 h-4" />}+ <span className="hidden sm:inline">{t('task.share' as any) || 'Share'}</span>+ </button>+ <button+ onClick={handleCreatePublicLink}+ disabled={isDeleting || isProcessing}+ className="flex items-center gap-2 px-3 py-2 rounded-lg bg-secondary/50 hover:bg-secondary text-secondary-foreground hover:text-secondary-foreground/90 transition-colors text-sm font-medium min-w-[80px] justify-center"+ aria-label="public-share"+ >+ <ExternalLink className="w-4 h-4" />+ <span className="hidden sm:inline">{t('task.publicLink' as any) || 'Public'}</span>+ </button>+ </div>++ {/* Delete button - subtle */}<buttononClick={handleDelete}disabled={isDeleting}- className="w-8 h-8 rounded-md flex items-center justify-center hover:bg-muted text-destructive hover:text-destructive/90"+ className="flex items-center gap-1 px-2 py-1.5 rounded-md hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors text-xs opacity-60 hover:opacity-100"aria-label="delete">- {isDeleting ? <Loader2 className="w-4 h-4 animate-spin" /> : <Trash2 className="w-4 h-4" />}+ {isDeleting ? <Loader2 className="w-3 h-3 animate-spin" /> : <Trash2 className="w-3 h-3" />}+ <span className="hidden sm:inline">{t('task.delete' as any) || 'Delete'}</span></button></div>@@ -265,7 +329,7 @@ export function TaskCard({}}className={cn('w-7 h-7 rounded-md border flex items-center justify-center',- inlineRating >= v ? 'bg-amber-100 border-amber-300 text-amber-700' : 'bg-transparent'+ inlineRating >= v ? 'bg-amber-100 border-amber-300 text-amber-700' : 'bg-transparent',)}aria-label={`rate-${v}`}>@@ -284,14 +348,31 @@ export function TaskCard({okText={isRatingSubmitting ? t('task.submitting' as any) || 'Submitting' : t('task.submit' as any) || 'Submit'}confirmLoading={isRatingSubmitting}>- <div className="flex flex-col gap-2">- <div className="text-sm text-muted-foreground">Task: {id}</div>- <textarea- value={ratingComment}- onChange={(e) => setRatingComment(e.target.value)}- placeholder={t('task.ratingCommentPlaceholder' as any) || 'Optional comment'}- className="w-full p-2 border rounded-md resize-none h-24"- />+ <div className="flex flex-col gap-4">+ <div className="text-sm text-muted-foreground">+ Task:+ {id}+ </div>+ <div className="space-y-3">+ {ratingComments.map((comment, index) => (+ <div key={index} className="flex flex-col gap-1">+ <label className="text-xs text-muted-foreground font-medium">+ {t('task.commentLabel' as any, { number: index + 1 }) || `Comment ${index + 1}`}+ </label>+ <textarea+ value={comment}+ onChange={(e) => {+ const newComments = [...ratingComments]+ newComments[index] = e.target.value+ setRatingComments(newComments)+ }}+ placeholder={t('task.ratingCommentPlaceholder' as any) || 'Optional comment'}+ className="w-full p-2 border rounded-md resize-none h-16 text-sm"+ maxLength={200}+ />+ </div>+ ))}+ </div></div></Modal></>@@ -301,4 +382,3 @@ export function TaskCard({}export default TaskCard-diff --git a/project/web/src/components/Home/AgentFeatures/index.tsx b/project/web/src/components/Home/AgentFeatures/index.tsxindex f61d0274..fe3afbe0 100644--- a/project/web/src/components/Home/AgentFeatures/index.tsx+++ b/project/web/src/components/Home/AgentFeatures/index.tsx@@ -14,29 +14,74 @@ interface AgentFeaturesProps {}const iconMap = {- schedule: Clock,inspiration: Lightbulb,+ oneClickScript: Edit3,+ multiTemplates: Edit3,+ imageGenerate: ImageIcon,+ videoGenerate: Film,++ highlight: Film,storyboard: Edit3,+ coverSuggestion: ImageIcon,download: Download,- highlight: Film,- translate: Globe,- styleTransfer: Camera,- videoGenerate: Film,- imageGenerate: ImageIcon,++ videoTranslation: Globe,+ platformAdapt: Globe,+ topicTag: Lightbulb,+ seo: Globe,++ schedule: Clock,+ multiPlatform: Clock,+ smartTime: Clock,++ sse: Clock,+ taskManagement: Clock,+ workflow: Lightbulb,+videoUnderstanding: Eye,+ report: Eye,++ commentAssistant: Edit3,+ audienceInsight: Eye,} as constconst featureKeys = [- 'schedule',+ // Content generation & creation'inspiration',+ 'oneClickScript',+ 'multiTemplates',+ 'imageGenerate',+ 'videoGenerate',++ // Editing & post-processing+ 'highlight','storyboard',+ 'coverSuggestion','download',- 'highlight',- 'translate',- 'styleTransfer',- 'videoGenerate',- 'imageGenerate',++ // Localization & smart optimization+ 'videoTranslation',+ 'platformAdapt',+ 'topicTag',+ 'seo',++ // Publishing & distribution+ 'schedule',+ 'multiPlatform',+ 'smartTime',++ // Automation & pipeline+ 'sse',+ 'taskManagement',+ 'workflow',++ // Understanding & analytics'videoUnderstanding',+ 'report',++ // Interaction & ops+ 'commentAssistant',+ 'audienceInsight',]const AgentFeatures: FC<AgentFeaturesProps> = ({ className }) => {diff --git a/project/web/src/components/Home/TaskPreview/index.tsx b/project/web/src/components/Home/TaskPreview/index.tsxindex 88547a28..dfbb52b4 100644--- a/project/web/src/components/Home/TaskPreview/index.tsx+++ b/project/web/src/components/Home/TaskPreview/index.tsx@@ -31,10 +31,6 @@ export function TaskPreview({ limit = 4, className }: ITaskPreviewProps) {const [tasks, setTasks] = useState<TaskListItem[]>([])const [isLoading, setIsLoading] = useState(true)- const [selectedTaskId, setSelectedTaskId] = useState<string | null>(null)- const [ratingValue, setRatingValue] = useState<number>(0)- const [ratingComment, setRatingComment] = useState<string>('')- const [isSubmittingRating, setIsSubmittingRating] = useState(false)/** 加载任务列表(始终保证尽量填满 limit 条) */const loadTasks = useCallback(async () => {@@ -79,37 +75,6 @@ export function TaskPreview({ limit = 4, className }: ITaskPreviewProps) {router.push(`/${lng}/tasks-history`)}- /** 处理评分提交(放到列表外部) */- const handleSubmitRating = async () => {- if (!selectedTaskId) {- toast.error(t('task.selectTaskFirst' as any) || 'Please select a task first')- return- }- if (ratingValue < 1 || ratingValue > 5) {- toast.error(t('task.ratingInvalid' as any) || 'Invalid rating')- return- }-- try {- setIsSubmittingRating(true)- const res = await agentApi.createRating(selectedTaskId, ratingValue, ratingComment)- if (res && (res as any).code === 0) {- toast.success(t('task.ratingSuccess' as any) || 'Rating submitted')- // clear local state- setRatingValue(0)- setRatingComment('')- // reload tasks to reflect any change- void loadTasks()- } else {- toast.error((res as any)?.msg || (t('task.ratingFailed' as any) || 'Submit failed'))- }- } catch (error) {- console.error('Submit rating failed', error)- toast.error(t('task.ratingFailed' as any) || 'Submit failed')- } finally {- setIsSubmittingRating(false)- }- }// 如果没有任务且非加载中,不显示该区域if (!isLoading && tasks.length === 0) {@@ -151,62 +116,10 @@ export function TaskPreview({ limit = 4, className }: ITaskPreviewProps) {createdAt={task.createdAt}updatedAt={task.updatedAt}onDelete={handleDelete}- // Do NOT pass onSelect so clicking the card navigates to the chat detail.- // Keep onRateClick so users can still select a task for external rating.- onRateClick={(id: string) => {- setSelectedTaskId(id)- }}+ showInlineRating={true}/>))}</div>- {/* 外部评分区域(红框示意位置) */}- <div className="w-full max-w-5xl mx-auto mt-4">- <div className="rounded-lg border border-border bg-card p-4">- <div className="flex items-center justify-between mb-2">- <div className="text-sm font-medium text-foreground">- {t('task.externalRating' as any) || 'Rate selected task'}- </div>- <div className="text-xs text-muted-foreground">- {selectedTaskId ? `Task: ${selectedTaskId}` : t('task.noTaskSelected' as any) || 'No task selected'}- </div>- </div>- <div className="flex items-start gap-4">- <div className="flex items-center gap-1">- {Array.from({ length: 5 }).map((_, idx) => {- const v = idx + 1- return (- <button- key={v}- onClick={() => setRatingValue(v)}- className={cn(- 'w-8 h-8 rounded-md border flex items-center justify-center',- ratingValue >= v ? 'bg-amber-100 border-amber-300' : 'bg-transparent'- )}- aria-label={`rate-${v}`}- >- {v}- </button>- )- })}- </div>- <textarea- value={ratingComment}- onChange={(e) => setRatingComment(e.target.value)}- placeholder={t('task.ratingCommentPlaceholder' as any) || 'Optional comment'}- className="flex-1 p-2 border rounded-md resize-none h-12"- />- <div className="flex items-center">- <button- onClick={handleSubmitRating}- disabled={isSubmittingRating || !selectedTaskId}- className="px-3 py-1 rounded-md bg-primary text-white disabled:opacity-50"- >- {isSubmittingRating ? t('task.submitting' as any) || 'Submitting' : t('task.submit' as any) || 'Submit'}- </button>- </div>- </div>- </div>- </div></div></section>)