feat: 支持多语言提示词本地化和界面优化
- 添加 prompt_locale 参数支持简体中文、繁体中文和英文提示词本地化 - 移除内置 agents 配置以简化系统架构 - 更新 ContextBuilder 使用动态提示词模板而非硬编码内容 - 在 AgentLoop、Web 接口和 AgentService 中传递 locale 参数 - 添加输出语言指令确保用户界面内容按指定语言生成 - 扩展前端 LanguageSwitcher 组件支持三种语言选项 - 优化 Header 和侧边栏组件的响应式布局和文本截断处理 - 更新测试用例验证不同语言环境下的提示词正确性
This commit is contained in:
@ -143,6 +143,48 @@ describe('buildTaskTimelineCards', () => {
|
||||
expect(cards[6].relatedArtifactIds).toEqual(['artifact-summary']);
|
||||
});
|
||||
|
||||
it('localizes generated milestone titles for English and Traditional Chinese', () => {
|
||||
const task = makeTask();
|
||||
const processEvents: ProcessEvent[] = [
|
||||
{
|
||||
event_id: 'evt-plan',
|
||||
run_id: 'run-main',
|
||||
parent_run_id: null,
|
||||
kind: 'task_planned',
|
||||
actor_type: 'agent',
|
||||
actor_id: 'planner',
|
||||
actor_name: 'Task Planner',
|
||||
text: 'Plan created.',
|
||||
created_at: '2026-05-26T10:01:00.000Z',
|
||||
},
|
||||
{
|
||||
event_id: 'evt-tool-start',
|
||||
run_id: 'run-main',
|
||||
parent_run_id: null,
|
||||
kind: 'tool_call_started',
|
||||
actor_type: 'mcp',
|
||||
actor_id: 'user_files_list',
|
||||
actor_name: 'user_files_list',
|
||||
text: 'Calling tool: user_files_list.',
|
||||
created_at: '2026-05-26T10:02:00.000Z',
|
||||
},
|
||||
];
|
||||
|
||||
const englishCards = buildTaskTimelineCards({ task, processEvents, locale: 'en-US' });
|
||||
const traditionalCards = buildTaskTimelineCards({ task, processEvents, locale: 'zh-Hant' });
|
||||
|
||||
expect(englishCards.map((card) => card.title)).toEqual([
|
||||
'Task created',
|
||||
'Execution plan',
|
||||
'Calling tool: user_files_list',
|
||||
]);
|
||||
expect(traditionalCards.map((card) => card.title)).toEqual([
|
||||
'任務已創建',
|
||||
'執行計劃',
|
||||
'調用工具:user_files_list',
|
||||
]);
|
||||
});
|
||||
|
||||
it('appends result and acceptance cards for closed tasks with feedback', () => {
|
||||
const task = makeTask({
|
||||
is_open: false,
|
||||
|
||||
Reference in New Issue
Block a user