feat(frontend): 合并 i18n 模式与消息工具兼容

This commit is contained in:
肖应宇 2026-03-28 22:54:05 +08:00
parent c67dad6db5
commit e6e23925c2
4 changed files with 84 additions and 0 deletions

View File

@ -48,6 +48,10 @@ export const enUS: Translations = {
save: "Save",
install: "Install",
create: "Create",
export: "Export",
exportAsMarkdown: "Export as Markdown",
exportAsJSON: "Export as JSON",
exportSuccess: "Conversation exported",
removeAttachment: "Remove attachment",
},
@ -286,6 +290,26 @@ export const enUS: Translations = {
failed: "Subtask failed",
},
// Token Usage
tokenUsage: {
title: "Token Usage",
input: "Input",
output: "Output",
total: "Total",
},
// Shortcuts
shortcuts: {
searchActions: "Search actions...",
noResults: "No results found.",
actions: "Actions",
keyboardShortcuts: "Keyboard Shortcuts",
keyboardShortcutsDescription:
"Navigate DeerFlow faster with keyboard shortcuts.",
openCommandPalette: "Open Command Palette",
toggleSidebar: "Toggle Sidebar",
},
// Settings
settings: {
title: "Settings",

View File

@ -37,6 +37,10 @@ export interface Translations {
save: string;
install: string;
create: string;
export: string;
exportAsMarkdown: string;
exportAsJSON: string;
exportSuccess: string;
removeAttachment: string;
};
@ -216,6 +220,25 @@ export interface Translations {
failed: string;
};
// Token Usage
tokenUsage: {
title: string;
input: string;
output: string;
total: string;
};
// Shortcuts
shortcuts: {
searchActions: string;
noResults: string;
actions: string;
keyboardShortcuts: string;
keyboardShortcutsDescription: string;
openCommandPalette: string;
toggleSidebar: string;
};
// Settings
settings: {
title: string;

View File

@ -48,6 +48,10 @@ export const zhCN: Translations = {
save: "保存",
install: "安装",
create: "创建",
export: "导出",
exportAsMarkdown: "导出为 Markdown",
exportAsJSON: "导出为 JSON",
exportSuccess: "对话已导出",
removeAttachment: "移除附件",
},
@ -277,6 +281,25 @@ export const zhCN: Translations = {
failed: "子任务失败",
},
// Token Usage
tokenUsage: {
title: "Token 用量",
input: "输入",
output: "输出",
total: "总计",
},
// Shortcuts
shortcuts: {
searchActions: "搜索操作...",
noResults: "未找到结果。",
actions: "操作",
keyboardShortcuts: "键盘快捷键",
keyboardShortcutsDescription: "使用键盘快捷键更快地操作 DeerFlow。",
openCommandPalette: "打开命令面板",
toggleSidebar: "切换侧边栏",
},
// Settings
settings: {
title: "设置",

View File

@ -317,6 +317,14 @@ export interface UploadedFile {
path: string;
}
// Compatibility type for newer UI modules.
export interface FileInMessage {
filename: string;
size: string | number;
path?: string;
status?: "uploading" | "uploaded";
}
/**
* Result of parsing uploaded files from message content
*/
@ -363,3 +371,9 @@ export function parseUploadedFiles(content: string): ParsedUploadedFiles {
return { files, cleanContent };
}
export function stripUploadedFilesTag(content: string): string {
return content
.replace(/<uploaded_files>[\s\S]*?<\/uploaded_files>/g, "")
.trim();
}