Skip to content

Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.

feat: localize creator agent status output

wulienb19d77442b05
diff --git a/apps/web/src/features/dashboard/CreatorCollaborationPanel.tsx b/apps/web/src/features/dashboard/CreatorCollaborationPanel.tsx
index 1b323496..5684b77f 100644
--- a/apps/web/src/features/dashboard/CreatorCollaborationPanel.tsx
+++ b/apps/web/src/features/dashboard/CreatorCollaborationPanel.tsx
@@ -1,5 +1,6 @@
import type {
CreatorActivity,
+ CreatorAgentApproval,
CreatorAgentItem,
CreatorAgentTurn,
CreatorJob,
@@ -21,9 +22,11 @@ import OpenCreatorMark from '../../components/brand/OpenCreatorMark.js';
import { MarkdownRenderer } from '../../components/markdown/MarkdownRenderer.js';
import { useLocalizedCopy } from '../../i18n/useLocalizedCopy.js';
import ToolAgentComposer, { type ToolAgentPermission } from './ToolAgentComposer.js';
-import type {
- CreatorPanelAdapter,
- CreatorStageProgressView
+import {
+ creatorSystemIssueText,
+ type CreatorPanelLocalize,
+ type CreatorPanelAdapter,
+ type CreatorStageProgressView
} from './creator-panel-adapters.js';
import { useOptionalCreatorSession } from './creator-session-store.js';
@@ -286,20 +289,23 @@ export default function CreatorCollaborationPanel(props: {
</div>
) : null}
- {pendingApprovals.map(approval => (
- <article className="creator-collaboration-approval" data-status={approval.status} key={approval.id}>
- <strong>{approval.title}</strong>
- <p>{approval.summary}</p>
- <div>
- <button type="button" onClick={() => void session.respondAgentApproval(approval.id, 'approved', approval.processGeneration).catch(() => undefined)}>
- {l('批准', 'Approve')}
- </button>
- <button type="button" onClick={() => void session.respondAgentApproval(approval.id, 'rejected', approval.processGeneration).catch(() => undefined)}>
- {l('拒绝', 'Reject')}
- </button>
- </div>
- </article>
- ))}
+ {pendingApprovals.map(approval => {
+ const copy = approvalDisplayCopy(approval.kind, l);
+ return (
+ <article className="creator-collaboration-approval" data-status={approval.status} key={approval.id}>
+ <strong>{copy.title}</strong>
+ <p>{copy.summary}</p>
+ <div>
+ <button type="button" onClick={() => void session.respondAgentApproval(approval.id, 'approved', approval.processGeneration).catch(() => undefined)}>
+ {l('批准', 'Approve')}
+ </button>
+ <button type="button" onClick={() => void session.respondAgentApproval(approval.id, 'rejected', approval.processGeneration).catch(() => undefined)}>
+ {l('拒绝', 'Reject')}
+ </button>
+ </div>
+ </article>
+ );
+ })}
</div>
{(props.quickActions?.length ?? 0) > 0 ? (
@@ -386,7 +392,7 @@ function CollaborationActivityView(props: { event: SyncEvent }) {
{event.count > 1 ? <small>{event.count} {l('次修改', 'changes')}</small> : null}
</header>
<p>{event.label}</p>
- {event.fields.length > 0 ? <small>{event.fields.join('、')}</small> : null}
+ {event.fields.length > 0 ? <small>{event.fields.join(l('、', ', '))}</small> : null}
</div>
</article>
);
@@ -697,20 +703,59 @@ function stageProgressText(
}
if (stage.status === 'failed') {
return adapter.failedProgressText?.(stage, l)
- ?? stage.errorMessage
+ ?? creatorSystemIssueText(stage.errorCode, l)
?? l('执行失败', 'Failed');
}
if (stage.status === 'interrupted') return l('已中断,可继续', 'Interrupted. Ready to resume');
if (stage.status === 'canceled') return l('已终止,可继续', 'Stopped. Ready to resume');
const formatted = adapter.runningProgressText?.(stage, progress, l);
if (formatted) return formatted;
- if (progress.message) return progress.message;
if (progress.phase) {
return adapter.phaseLabel(progress.phase, l) ?? l('执行中', 'Running');
}
return l('执行中', 'Running');
}
+function approvalDisplayCopy(
+ kind: CreatorAgentApproval['kind'],
+ l: CreatorPanelLocalize
+): { title: string; summary: string } {
+ if (kind === 'command_execution') {
+ return {
+ title: l('确认命令执行', 'Confirm command execution'),
+ summary: l(
+ 'Agent 请求执行命令以继续当前任务。',
+ 'The Agent wants to run a command to continue this task.'
+ )
+ };
+ }
+ if (kind === 'file_change') {
+ return {
+ title: l('确认文件修改', 'Confirm file changes'),
+ summary: l(
+ 'Agent 请求修改项目文件以继续当前任务。',
+ 'The Agent wants to modify project files to continue this task.'
+ )
+ };
+ }
+ if (kind === 'permissions') {
+ return {
+ title: l('确认权限请求', 'Confirm permission request'),
+ summary: l(
+ 'Agent 请求额外权限以继续当前任务。',
+ 'The Agent is requesting additional permissions to continue this task.'
+ )
+ };
+ }
+ return {
+ title: l('确认工具调用', 'Confirm tool call'),
+ summary: l(
+ 'Agent 请求调用工具以继续当前任务。',
+ 'The Agent wants to use a tool to continue this task.'
+ )
+ };
+}
+
function stageProgressAriaText(
stage: CreatorStageRun,
percent: number,
diff --git a/apps/web/src/features/dashboard/VideoTranslationAgentPanel.test.tsx b/apps/web/src/features/dashboard/VideoTranslationAgentPanel.test.tsx
index 72822d04..d031ecae 100644
--- a/apps/web/src/features/dashboard/VideoTranslationAgentPanel.test.tsx
+++ b/apps/web/src/features/dashboard/VideoTranslationAgentPanel.test.tsx
@@ -308,6 +308,116 @@ describe('VideoTranslationAgentPanel', () => {
)).toBeNull();
});
+ it('系统运行信息跟随界面语言,同时保留用户和 Agent 的原始对话语言', async () => {
+ const currentJob = job();
+ currentJob.status = 'running';
+ currentJob.revision = 8;
+ currentJob.activities.push(
+ {
+ id: 'activity_needs_input',
+ jobId: currentJob.id,
+ revision: 5,
+ actor: 'system',
+ action: 'needs-input',
+ summary: '请先完成文本翻译模型配置',
+ details: { code: 'creator_llm_config_missing' },
+ createdAt: '2026-08-21T00:00:04.000Z'
+ },
+ {
+ id: 'activity_unknown_system',
+ jobId: currentJob.id,
+ revision: 6,
+ actor: 'system',
+ action: 'workflow-state-changed',
+ summary: '后台恢复任务状态',
+ details: {},
+ createdAt: '2026-08-21T00:00:05.000Z'
+ }
+ );
+ currentJob.stages.push(
+ {
+ id: 'stage_subtitle_localized',
+ jobId: currentJob.id,
+ stageId: 'subtitle',
+ executor: 'krillinai',
+ status: 'running',
+ dispatchStatus: 'claimed',
+ claimOwner: 'scheduler_1',
+ claimExpiresAt: '2026-08-21T00:01:00.000Z',
+ attempt: 1,
+ idempotencyKey: 'subtitle_localized_1',
+ progress: {
+ phase: 'translating_subtitles',
+ percent: 24,
+ message: '正在翻译字幕'
+ },
+ errorCode: null,
+ errorMessage: null,
+ startedAt: '2026-08-21T00:00:06.000Z',
+ finishedAt: null
+ },
+ {
+ id: 'stage_tts_localized',
+ jobId: currentJob.id,
+ stageId: 'tts',
+ executor: 'krillinai',
+ status: 'failed',
+ dispatchStatus: 'finished',
+ claimOwner: null,
+ claimExpiresAt: null,
+ attempt: 1,
+ idempotencyKey: 'tts_localized_1',
+ progress: {
+ phase: 'generating_voice',
+ percent: 35,
+ message: '正在生成配音'
+ },
+ errorCode: 'voice_provider_failed',
+ errorMessage: '配音服务返回错误',
+ startedAt: '2026-08-21T00:00:07.000Z',
+ finishedAt: '2026-08-21T00:00:08.000Z'
+ }
+ );
+ const currentTimeline = timeline();
+ currentTimeline.approvals = [{
+ ...currentTimeline.approvals[0]!,
+ status: 'pending',
+ title: '确认工具调用',
+ summary: 'Agent 请求执行工具',
+ resolvedAt: null
+ }];
+
+ renderPanel({
+ language: 'en-US',
+ initialJob: currentJob,
+ getAgentTimeline: vi.fn(async () => currentTimeline)
+ });
+
+ expect(await screen.findByText('Confirm tool call')).toBeInTheDocument();
+ expect(screen.getByText('Updated creative settings')).toBeInTheDocument();
+ expect(screen.getByText('Target language, Bilingual subtitles, Dubbing'))
+ .toBeInTheDocument();
+ expect(screen.getByText('Configure the text model to continue')).toBeInTheDocument();
+ expect(screen.getByText('System updated the task status')).toBeInTheDocument();
+ expect(screen.getByText('Translating subtitles')).toBeInTheDocument();
+ expect(screen.getByText('Failed')).toBeInTheDocument();
+ expect(screen.getByText(
+ 'The Agent wants to use a tool to continue this task.'
+ )).toBeInTheDocument();
+
+ expect(screen.queryByText('请先完成文本翻译模型配置')).not.toBeInTheDocument();
+ expect(screen.queryByText('后台恢复任务状态')).not.toBeInTheDocument();
+ expect(screen.queryByText('正在翻译字幕')).not.toBeInTheDocument();
+ expect(screen.queryByText('配音服务返回错误')).not.toBeInTheDocument();
+ expect(screen.queryByText('确认工具调用')).not.toBeInTheDocument();
+ expect(screen.queryByText('Agent 请求执行工具')).not.toBeInTheDocument();
+
+ expect(screen.getByText('请检查当前设置')).toBeInTheDocument();
+ expect(screen.getByRole('heading', { name: '设置建议', level: 3 }))
+ .toBeInTheDocument();
+ expect(screen.getByText('先确认目标语言')).toBeInTheDocument();
+ });
+
it('把工作台操作和 Runtime 真实进度归并为一张 Stage 卡', async () => {
const runningJob = job();
runningJob.status = 'running';
@@ -354,7 +464,7 @@ describe('VideoTranslationAgentPanel', () => {
});
expect(screen.getByText(/工作台 · 字幕翻译/)).toBeInTheDocument();
- expect(screen.getByText('正在翻译字幕')).toBeInTheDocument();
+ expect(screen.getByText('翻译字幕')).toBeInTheDocument();
expect(screen.getByText('52%')).toBeInTheDocument();
expect(screen.getByRole('progressbar', { name: '字幕翻译进度' })).toHaveAttribute('aria-valuenow', '52');
expect(screen.queryByRole('status', { name: 'Agent 正在工作' })).not.toBeInTheDocument();
@@ -480,7 +590,8 @@ describe('VideoTranslationAgentPanel', () => {
getAgentTimeline
});
- expect(screen.getByText('翻译服务返回错误')).toBeInTheDocument();
+ expect(screen.getByText('执行失败')).toBeInTheDocument();
+ expect(screen.queryByText('翻译服务返回错误')).not.toBeInTheDocument();
expect(screen.getByText('67%')).toBeInTheDocument();
expect(screen.getByRole('progressbar', { name: '字幕翻译进度' })).toHaveAttribute(
'aria-valuetext',
@@ -594,13 +705,14 @@ describe('VideoTranslationAgentPanel', () => {
});
function renderPanel(options: {
+ language?: 'zh-CN' | 'en-US';
initialJob?: CreatorJob;
getAgentTimeline: ReturnType<typeof vi.fn>;
runAgentTurn?: ReturnType<typeof vi.fn>;
directAction?: ReturnType<typeof vi.fn>;
}) {
const result = render(
- <LanguageProvider initialPreference="zh-CN">
+ <LanguageProvider initialPreference={options.language ?? 'zh-CN'}>
<CreatorSessionProvider
initialJob={options.initialJob ?? job()}
service={{
diff --git a/apps/web/src/features/dashboard/creator-panel-adapters.ts b/apps/web/src/features/dashboard/creator-panel-adapters.ts
index d047c33f..44377853 100644
--- a/apps/web/src/features/dashboard/creator-panel-adapters.ts
+++ b/apps/web/src/features/dashboard/creator-panel-adapters.ts
@@ -462,6 +462,16 @@ function normalizeCommonActivity(
fields
};
}
+ if (activity.action === 'needs-input') {
+ return {
+ label: creatorSystemIssueText(readString(activity.details.code), l)
+ ?? l(
+ '任务需要处理后才能继续',
+ 'Action is required before the task can continue'
+ ),
+ fields: []
+ };
+ }
const directLabel = actionLabels[activity.action];
if (directLabel !== undefined) return { label: directLabel, fields: [] };
if (activity.action === 'run-stage') {
@@ -483,7 +493,13 @@ function normalizeCommonActivity(
activity.actor === 'system'
&& activity.summary.trim().length > 0
) {
- return { label: activity.summary, fields: [] };
+ return {
+ label: l(
+ '系统更新了任务状态',
+ 'System updated the task status'
+ ),
+ fields: []
+ };
}
return null;
}
@@ -611,6 +627,60 @@ function genericPhaseLabel(
return labels[phase] ?? null;
}
+export function creatorSystemIssueText(
+ code: string | null,
+ l: CreatorPanelLocalize
+): string | null {
+ if (code === null) return null;
+ const labels: Record<string, string> = {
+ creator_llm_config_missing: l(
+ '请先配置文本模型',
+ 'Configure the text model to continue'
+ ),
+ creator_transcription_config_missing: l(
+ '请先配置语音转录服务',
+ 'Configure speech transcription to continue'
+ ),
+ creator_tts_config_missing: l(
+ '请先配置配音服务',
+ 'Configure dubbing to continue'
+ ),
+ creator_image_config_missing: l(
+ '请先配置图像生成服务',
+ 'Configure image generation to continue'
+ ),
+ creator_video_config_missing: l(
+ '请先配置视频生成服务',
+ 'Configure video generation to continue'
+ ),
+ creator_video_model_unavailable: l(
+ '当前账号未开通所选视频模型',
+ 'The selected video model is not enabled for this account'
+ ),
+ unsupported_capability: l(
+ '当前服务不支持所需能力,请更换服务',
+ 'The current provider does not support the required capability'
+ ),
+ creator_cover_reference_missing: l(
+ '请先添加封面参考图',
+ 'Add a thumbnail reference image to continue'
+ ),
+ creator_stage_input_missing: l(
+ '任务缺少必需输入,请检查设置',
+ 'Required task input is missing. Check the settings.'
+ ),
+ network_unavailable: l(
+ '网络连接失败,请检查网络或代理设置后重试',
+ 'Network connection failed. Check the network or proxy settings and try again.'
+ ),
+ yt_dlp_update_recommended: l(
+ 'yt-dlp 可能已过期,请更新后重试',
+ 'yt-dlp may be outdated. Update it and try again.'
+ )
+ };
+ return labels[code] ?? null;
+}
+
function readRecord(value: CreatorJson | undefined): Record<string, CreatorJson> | null {
return value !== null && value !== undefined && typeof value === 'object' && !Array.isArray(value)
? value