Skip to content

Let's use AI to Earn!

fix(web): fix web pub and 1219 (#415)

布莱恩·奥夫托·杰森张6d50e7634c61
diff --git a/project/web/src/api/agent.ts b/project/web/src/api/agent.ts
index 1700729c..0c1f1188 100644
--- a/project/web/src/api/agent.ts
+++ b/project/web/src/api/agent.ts
@@ -61,9 +61,14 @@ export interface TaskMessage {
export interface TaskListItem {
id: string
userId: string
+ /** 任务标题 */
title?: string
+ /** 任务创建时间 */
createdAt: string
+ /** 任务最近更新时间 */
updatedAt: string
+ /** 任务状态(后端英文原始状态字符串,直接展示) */
+ status?: string
}
// 任务列表响应
diff --git a/project/web/src/app/[lng]/accounts/accountCore.tsx b/project/web/src/app/[lng]/accounts/accountCore.tsx
index 37b91f91..61ae3c66 100644
--- a/project/web/src/app/[lng]/accounts/accountCore.tsx
+++ b/project/web/src/app/[lng]/accounts/accountCore.tsx
@@ -27,6 +27,7 @@ interface AccountPageCoreProps {
platform?: string
spaceId?: string
addChannel?: string // 添加频道引导参数
+ updateChannel?: string // 更新频道授权参数
action?: string // 动作类型:publish 等
// AI生成的内容参数
aiGenerated?: string
@@ -81,6 +82,30 @@ export default function AccountPageCore({
// 处理URL参数
useEffect(() => {
+ // 处理更新频道授权(直接打开授权弹窗并自动触发)
+ if (searchParams?.updateChannel) {
+ const platform = searchParams.updateChannel as PlatType
+ const validPlatforms = Object.values(PlatType)
+
+ if (validPlatforms.includes(platform)) {
+ // 设置目标平台
+ setTargetPlatform(platform)
+
+ // 直接打开添加账号弹窗,autoTriggerPlatform 会自动触发授权
+ setTimeout(() => {
+ setAddAccountModalOpen(true)
+ }, 500)
+
+ // 清除URL参数
+ if (typeof window !== 'undefined') {
+ const url = new URL(window.location.href)
+ url.searchParams.delete('updateChannel')
+ window.history.replaceState({}, '', url.toString())
+ }
+ }
+ return
+ }
+
// 处理添加频道引导
if (searchParams?.addChannel) {
const platform = searchParams.addChannel
diff --git a/project/web/src/app/[lng]/chat/[taskId]/page.tsx b/project/web/src/app/[lng]/chat/[taskId]/page.tsx
index 2a4ffe1f..9540a7e9 100644
--- a/project/web/src/app/[lng]/chat/[taskId]/page.tsx
+++ b/project/web/src/app/[lng]/chat/[taskId]/page.tsx
@@ -19,57 +19,26 @@ import { ChatHeader, ChatMessageList, ChatLoadingSkeleton } from './components'
import { useScrollControl, useChatState } from './hooks'
// 测试数据 - 用于测试 createChannel action
-const TEST_RESULT_DATA = {
- type: 'result',
- message: {
- type: 'result',
- subtype: 'success',
- uuid: 'aee2c247-5e9d-4864-a7b7-0c9ad1832648',
- duration_ms: 24585,
- duration_api_ms: 32986,
- is_error: false,
- num_turns: 3,
- message: '好的!我已经为您准备好发布流程了!\n\n**当前状态**:\n- ✅ 图片已生成\n- ✅ 推特文案已准备\n- ⚠️ 需要先绑定推特账号\n\n**接下来的步骤**:\n系统会引导您完成推特账号绑定,绑定完成后,您的内容就可以立即发布了!\n\n**准备发布的内容**:\n- 📸 **图片**: 高质量8K室内人像摄影\n- 📝 **文案**: \n > ✨ 室内私房人像摄影 | Indoor Portrait Photography\n > \n > 追求极致细节与真实质感的艺术表达\n > Pursuing ultimate detail and authentic texture in artistic expression\n > \n > #PortraitPhotography #AsianBeauty #IndoorPhotography #8K #Photography #ArtisticPortrait\n\n请按照系统提示完成推特账号绑定,然后您的精美图文作品就可以成功发布到推特了! 🚀',
- result: [
- {
- type: 'fullContent',
- title: '✨ 室内私房人像摄影 | Indoor Portrait Photography',
- description: '追求极致细节与真实质感的艺术表达\nPursuing ultimate detail and authentic texture in artistic expression\n\n#PortraitPhotography #AsianBeauty #IndoorPhotography #8K #Photography #ArtisticPortrait',
- tags: [],
- medias: [
- {
- type: 'IMAGE',
- url: 'https://aitoearn.s3.ap-southeast-1.amazonaws.com/ai/images/gemini-3-pro-image-preview/690df0fea7aa4267575e2d9c/mjb2gsx3.jpg',
- },
- ],
- action: 'createChannel',
- platform: 'xhs',
- errorMessage: '需要先绑定小红书账号才能发布内容',
- },
- ],
- total_cost_usd: 0.4688474,
- usage: {
- cache_creation: {
- ephemeral_1h_input_tokens: 0,
- ephemeral_5m_input_tokens: 114598,
- },
- cache_creation_input_tokens: 114598,
- cache_read_input_tokens: 61443,
- input_tokens: 13,
- output_tokens: 905,
- server_tool_use: {
- web_search_requests: 0,
- },
- },
- permission_denials: [],
- },
-}
+const TEST_RESULT_DATA = {"type":"result","message":{"type":"result","subtype":"success","uuid":"507f3578-d539-43dd-8214-67eee1613e87","duration_ms":198689,"duration_api_ms":41362,"is_error":false,"num_turns":9,"message":"完成!我已经生成了三张竖屏狗狗图片,并准备好发布到推特。由于你的账户还未绑定推特,系统会引导你进入发布页面,在那里你可以:\n\n1. **绑定推特账户**(如果还未绑定)\n2. **查看三条准备好的推文**:\n - 推文1:陪你看过海 + 海边图片\n - 推文2:陪你爬过山 + 山上图片\n - 推文3:你怎么忍心割我蛋蛋 + 傍晚图片\n\n3. **发布到推特**\n\n所有图片和文案都已准备就绪,你只需要完成账户连接并确认发布即可!🐕","result":[
+ {"type":"fullContent","title":"陪你看过海","description":"陪你看过海","tags":["狗狗","陪伴","回忆"],"medias":[{"type":"IMAGE","url":"https://aitoearn.s3.ap-southeast-1.amazonaws.com/ai/images/gemini-3-pro-image-preview/690df0fea7aa4267575e2d9c/mjcqx6ux.png"}],
+ "action":"navigateToPublish","platform":"twitter"},
+ // {"type":"fullContent","title":"陪你爬过山","description":"陪你爬过山","tags":["狗狗","陪伴","冒险"],"medias":[{"type":"IMAGE","url":"https://aitoearn.s3.ap-southeast-1.amazonaws.com/ai/images/gemini-3-pro-image-preview/690df0fea7aa4267575e2d9c/mjcqykej.png"}],
+ // "action":"navigateToPublish","platform":"twitter"},
+ // {"type":"fullContent","title":"你怎么忍心割我蛋蛋","description":"你怎么忍心割我蛋蛋","tags":["狗狗","可爱","搞笑"],"medias":[{"type":"IMAGE","url":"https://aitoearn.s3.ap-southeast-1.amazonaws.com/ai/images/gemini-3-pro-image-preview/690df0fea7aa4267575e2d9c/mjcqzehm.png"}],
+ // "action":"navigateToPublish","platform":"twitter"}
+],"total_cost_usd":0.2299501,"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":164958},"cache_creation_input_tokens":164958,"cache_read_input_tokens":63716,"input_tokens":34,"output_tokens":1922,"server_tool_use":{"web_search_requests":0}},"permission_denials":[]}}
+
+
+
+// {"type":"result","message":{"type":"result","subtype":"success","uuid":"653d19f6-b1a4-4bc6-910b-f813c68c65a0","duration_ms":23024,"duration_api_ms":28454,"is_error":false,"num_turns":5,"message":"完成!我已经为你准备好了小红书发布内容。系统已引导你进入小红书发布页面,你可以:\n\n1. **绑定小红书账户**(如果还未绑定)\n2. **查看准备好的内容**:\n - 标题:陪你看过海,陪你爬过山\n - 描述:包含三分图的完整文案\n - 标签:#狗狗 #陪伴 #回忆 #搞笑 #宠物\n\n3. **上传并发布**这张精美的三分图到小红书\n\n所有内容都已准备就绪,你只需要完成账户连接并确认发布即可!🐕✨","result":[{"type":"fullContent","title":"陪你看过海,陪你爬过山","description":"上方小狗在海边眺望远方 陪你看过海,中方小狗在山上眺望远方 陪你爬过山,下方傍晚天气小狗正脸 你怎么忍心割我蛋蛋。三分图设计,温馨搞笑兼具的狗狗陪伴主题。","tags":["狗狗","陪伴","回忆","搞笑","宠物"],"medias":[{"type":"IMAGE","url":"https://aitoearn.s3.ap-southeast-1.amazonaws.com/ai/images/gemini-3-pro-image-preview/690df0fea7aa4267575e2d9c/mjcrjbr6.png"}],
+// "action":"navigateToPublish","platform":"xhs"}],"total_cost_usd":0.1240453,"usage":{"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":82734},"cache_creation_input_tokens":82734,"cache_read_input_tokens":94298,"input_tokens":21,"output_tokens":844,"server_tool_use":{"web_search_requests":0}},"permission_denials":[]}}
// 测试模式:设置为 true 时,点击发送不发送请求,直接返回测试数据 00.00
const TEST_MODE = false
export default function ChatDetailPage() {
const { t } = useTransClient('chat')
+ const { t: tHome } = useTransClient('home')
const router = useRouter()
const params = useParams()
const taskId = params.taskId as string
@@ -125,9 +94,9 @@ export default function ChatDetailPage() {
setActionContext({
router,
lng,
- t: t as any,
+ t: tHome as any,
})
- }, [router, lng, t, setActionContext])
+ }, [router, lng, tHome, setActionContext])
/**
* 智能滚动:用户在底部附近时自动滚动
diff --git a/project/web/src/app/[lng]/tasks-history/page.tsx b/project/web/src/app/[lng]/tasks-history/page.tsx
index 96573e15..469fdda4 100644
--- a/project/web/src/app/[lng]/tasks-history/page.tsx
+++ b/project/web/src/app/[lng]/tasks-history/page.tsx
@@ -151,6 +151,7 @@ export default function TasksHistoryPage() {
key={task.id}
id={task.id}
title={task.title || t('task.newChat' as any)}
+ status={task.status}
createdAt={task.createdAt}
updatedAt={task.updatedAt}
onDelete={handleDelete}
diff --git a/project/web/src/app/i18n/locales/en/settings.json b/project/web/src/app/i18n/locales/en/settings.json
index 7ab78fba..47686a98 100644
--- a/project/web/src/app/i18n/locales/en/settings.json
+++ b/project/web/src/app/i18n/locales/en/settings.json
@@ -31,7 +31,8 @@
"zoomIn": "Zoom In",
"zoomOut": "Zoom Out",
"imageLoading": "Loading image...",
- "processing": "Processing..."
+ "processing": "Processing...",
+ "githubStars": "GitHub Stars"
},
"subscription": {
"currentPlan": "Current Plan",
diff --git a/project/web/src/app/i18n/locales/en/vip.json b/project/web/src/app/i18n/locales/en/vip.json
index e8b70034..ab8e4436 100644
--- a/project/web/src/app/i18n/locales/en/vip.json
+++ b/project/web/src/app/i18n/locales/en/vip.json
@@ -24,7 +24,7 @@
}
},
"creator": {
- "name": "LUS Member",
+ "name": "PLUS Member",
"price": "19",
"button": "Upgrade to PLUS Member",
"features": {
diff --git a/project/web/src/app/i18n/locales/zh-CN/settings.json b/project/web/src/app/i18n/locales/zh-CN/settings.json
index 8f622c01..77baec29 100644
--- a/project/web/src/app/i18n/locales/zh-CN/settings.json
+++ b/project/web/src/app/i18n/locales/zh-CN/settings.json
@@ -31,7 +31,8 @@
"zoomIn": "放大",
"zoomOut": "缩小",
"imageLoading": "图片加载中...",
- "processing": "处理中..."
+ "processing": "处理中...",
+ "githubStars": "GitHub 星标"
},
"subscription": {
"currentPlan": "当前套餐",
diff --git a/project/web/src/components/Chat/TaskCard/index.tsx b/project/web/src/components/Chat/TaskCard/index.tsx
index 4481b84a..41bc69b2 100644
--- a/project/web/src/components/Chat/TaskCard/index.tsx
+++ b/project/web/src/components/Chat/TaskCard/index.tsx
@@ -23,6 +23,8 @@ export interface ITaskCardProps {
id: string
/** 任务标题 */
title: string
+ /** 任务状态(英文原始状态字符串) */
+ status?: string
/** 创建时间 */
createdAt: string | number
/** 更新时间 */
@@ -39,6 +41,7 @@ export interface ITaskCardProps {
export function TaskCard({
id,
title,
+ status,
createdAt,
updatedAt,
onDelete,
@@ -87,10 +90,17 @@ export function TaskCard({
</h4>
</div>
- {/* 时间 */}
- <span className="text-xs text-muted-foreground">
- {formatRelativeTime(new Date(updatedAt || createdAt))}
- </span>
+ {/* 时间 & 状态 */}
+ <div className="mt-1 flex items-center justify-between gap-2">
+ <span className="text-xs text-muted-foreground">
+ {formatRelativeTime(new Date(updatedAt || createdAt))}
+ </span>
+ {status && (
+ <span className="inline-flex items-center rounded-full border border-border px-2 py-0.5 text-[11px] font-medium text-muted-foreground">
+ {status}
+ </span>
+ )}
+ </div>
{/* 更多操作按钮 */}
<DropdownMenu>
diff --git a/project/web/src/components/Home/HomeChat/index.tsx b/project/web/src/components/Home/HomeChat/index.tsx
index 24b8e872..96611fba 100644
--- a/project/web/src/components/Home/HomeChat/index.tsx
+++ b/project/web/src/components/Home/HomeChat/index.tsx
@@ -102,9 +102,9 @@ export function HomeChat({
setActionContext({
router,
lng: lng as string,
- t: t as any,
+ t: tHome as any,
})
- }, [router, lng, t, setActionContext])
+ }, [router, lng, tHome, setActionContext])
/** 处理发送消息 */
const handleSend = useCallback(async () => {
diff --git a/project/web/src/components/Home/TaskPreview/index.tsx b/project/web/src/components/Home/TaskPreview/index.tsx
index 39929306..25ed0333 100644
--- a/project/web/src/components/Home/TaskPreview/index.tsx
+++ b/project/web/src/components/Home/TaskPreview/index.tsx
@@ -111,6 +111,7 @@ export function TaskPreview({ limit = 4, className }: ITaskPreviewProps) {
key={task.id}
id={task.id}
title={task.title || t('task.newChat' as any)}
+ status={task.status}
createdAt={task.createdAt}
updatedAt={task.updatedAt}
onDelete={handleDelete}
diff --git a/project/web/src/components/SettingsModal/tabs/ProfileTab.tsx b/project/web/src/components/SettingsModal/tabs/ProfileTab.tsx
index 4a31f4c4..2ee838e1 100644
--- a/project/web/src/components/SettingsModal/tabs/ProfileTab.tsx
+++ b/project/web/src/components/SettingsModal/tabs/ProfileTab.tsx
@@ -237,6 +237,31 @@ export function ProfileTab({ onClose }: ProfileTabProps) {
</div>
</div>
+ {/* Docs & GitHub Stars */}
+ <div className="flex flex-wrap items-center gap-3">
+ <Button asChild variant="outline" size="sm">
+ <a
+ href="https://docs.aitoearn.ai/"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ {tCommon('docs')}
+ </a>
+ </Button>
+ <a
+ href="https://github.com/yikart/AttAiToEarn"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="inline-flex items-center"
+ >
+ <img
+ src="https://camo.githubusercontent.com/9feb948af77cdb3d349cafc64266332d8d24243f6bd72de0980b75c9de719cd8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f79696b6172742f4174744169546f4561726e3f636f6c6f723d666136343730"
+ alt={t('profile.githubStars')}
+ className="h-5"
+ />
+ </a>
+ </div>
+
{/* 退出登录按钮 */}
<Button
variant="ghost"
diff --git a/project/web/src/store/agent/handlers/action.handlers.ts b/project/web/src/store/agent/handlers/action.handlers.ts
index 4007a39d..68c0c153 100644
--- a/project/web/src/store/agent/handlers/action.handlers.ts
+++ b/project/web/src/store/agent/handlers/action.handlers.ts
@@ -16,7 +16,6 @@ import { PluginStatus } from '@/store/plugin/types/baseTypes'
import type { PluginPublishItem } from '@/store/plugin/store'
import { driver } from 'driver.js'
import type { ITaskData, IActionContext, ActionType, IMediaItem } from '../agent.types'
-import { useTransClient } from '@/app/i18n/client'
// ============ Action Handler 接口 ============
@@ -321,8 +320,7 @@ const saveDraftHandler: IActionHandler = {
},
async execute(taskData, context) {
- const { router, lng } = context
- const { t } = useTransClient('home')
+ const { router, lng, t } = context
try {
// 转换 medias 格式
@@ -399,8 +397,7 @@ const updateChannelHandler: IActionHandler = {
},
async execute(taskData, context) {
- const { router, lng } = context
- const { t } = useTransClient('home')
+ const { router, lng, t } = context
const platform = taskData.platform
toast.warning(t('aiGeneration.channelAuthExpired' as any))
@@ -428,8 +425,7 @@ const loginChannelHandler: IActionHandler = {
},
async execute(taskData, context) {
- const { router, lng } = context
- const { t } = useTransClient('home')
+ const { router, lng, t } = context
const platform = taskData.platform
toast.info(t('aiGeneration.needLoginChannel' as any))
@@ -453,13 +449,12 @@ const createChannelHandler: IActionHandler = {
type: 'createChannel',
canHandle: (taskData) => {
- return !!(taskData.type === 'fullContent' && taskData.action === 'createChannel' && taskData.errorMessage)
+ return !!(taskData.type === 'fullContent' && taskData.action === 'createChannel')
},
async execute(taskData, context) {
- const { router, lng } = context
+ const { router, lng, t } = context
const platform = taskData.platform
- const { t } = useTransClient('home')
toast.warning(taskData.errorMessage || (t('aiGeneration.needBindChannel' as any) as string))
@@ -597,7 +592,7 @@ export const ActionRegistry = {
async executePluginBatch(pluginTasks: ITaskData[], context: IActionContext): Promise<void> {
const pluginStatus = usePluginStore.getState().status
const isPluginReady = pluginStatus === PluginStatus.READY
- const { t } = useTransClient('home')
+ const { t } = context
if (!isPluginReady) {
toast.warning(t('plugin.platformNeedsPlugin' as any))