Go implementation of DeepSeek Harness and self-hosted personal agent.
Go
import { extensionChinese } from './extensions/messages'
import { proactiveChinese } from './settings/proactiveState'
export type Language = 'en' | 'zh-CN'
const chinese: Readonly<Record<string, string>> = {
'Copy table': '复制表格', 'Copy code': '复制代码', 'Copied': '已复制', 'Copy failed. Try again.': '复制失败,重试', 'Code': '代码',
'Table — scroll horizontally': '表格,可左右滚动', 'Code — scroll horizontally': '代码,可左右滚动',
...extensionChinese,
...proactiveChinese,
'Switch to dark theme': '切换为深色主题',
'Switch to light theme': '切换为浅色主题',
'Main navigation': '主导航',
'Tasks': '定时任务',
'Your conversations': '你的会话',
'Message Go Bot': '发送消息给 Go Bot',
'Download file': '下载文件',
'Close image': '关闭图片',
'Image preview': '图片预览',
'Download image': '下载图片',
'Scheduled work, all in one place.': '在这里查看助手安排的定时任务。',
'Refresh tasks': '刷新任务',
'Could not load tasks. Try again.': '无法读取任务,请重试。',
'Upcoming': '即将执行',
'Completed': '已完成',
'Loading tasks…': '正在加载任务…',
'No upcoming tasks': '暂无待执行任务',
'No completed tasks': '暂无已完成任务',
'Ask your agent to schedule something in a conversation.': '你可以在会话中让助手安排定时任务。',
'Active': '运行中',
'Paused': '已暂停',
'Next run': '下次执行',
'Schedule': '执行规则',
'Delivery target': '投递会话',
'New conversation each time': '每次新建会话',
'Create a conversation once': '首次新建会话后复用',
'Existing conversation': '指定会话',
'Last delivery': '最近投递',
'Working directory': '工作目录',
'Instructions': '任务内容',
'The last delivery is queued or running.': '最近一次投递正在排队或执行。',
'Open conversation': '打开会话',
'One time': '单次执行',
'Every': '每',
'hours': '小时',
'minutes': '分钟',
'seconds': '秒',
'Daily': '每天',
'Weekly': '每周',
'Custom rule': '自定义规则',
'Add an endpoint to start chatting.': '添加端点后即可开始聊天。',
'Main chat': '主会话',
'Preparing browser and Office capabilities…': '正在准备浏览器与 Office 能力…',
'Some plugins could not be prepared.': '部分插件未能准备完成。',
'View plugins': '查看插件',
'Set up a model to start chatting.': '请先配置模型,再开始聊天。',
'The model for this chat is unavailable. Choose another model.': '当前会话的模型不可用,请重新选择。',
'Your message and attachments are kept in the composer.': '文字和附件已保留在输入框中。',
"Brave Search API key": "Brave 搜索 API 密钥", "Tavily API key": "Tavily API 密钥",
"Approve this plan and leave plan mode?": "确认方案后开始执行,或提出修改意见继续规划。",
"Approve": "按此方案执行", "Keep planning": "继续完善方案",
"Leave plan mode; the plan is carried out from the next step.": "退出规划模式,从下一步开始执行方案。",
"Stay in plan mode; feedback goes back to the model.": "保持规划模式,将修改意见交给助手。",
"Plan review": "方案审阅", "Review the plan": "审阅方案",
"Approval needed": "待审批", "Answer needed": "待回答",
"Model ID": "模型 ID", "Add model": "添加模型", "Remove model": "移除模型", "Move up": "上移", "Move down": "下移",
"The first model is the endpoint default.": "第一个模型是此端点的默认模型。",
"Discard unsaved changes?": "放弃未保存的修改?",
"Supports OpenAI Responses and Anthropic Messages compatible endpoints.": "支持 OpenAI Responses 和 Anthropic Messages 兼容接口。",
"API protocol": "接口协议",
"Choose the API format provided by your service, regardless of the model name.": "按服务商提供的接口格式选择,与模型名称无关。",
"Request URL": "请求地址",
"Choose a supported API protocol.": "请选择支持的接口协议。",
"Enter a base URL without /messages, /responses, or /chat/completions.": "请填写基础地址,不包含 /messages、/responses 或 /chat/completions。",
"This model will be used from the next turn.": "将在下一轮使用此模型。",
"Language": "语言",
"Go Bot Chat": "Go Bot 会话",
"Create an account": "创建账号",
"Open your account": "打开账号",
"Account name": "账号名",
"Use 1–64 lowercase letters, digits, underscores or hyphens. Start with a letter or digit.": "使用 1–64 个小写字母、数字、下划线或连字符,以字母或数字开头。",
"Create account": "创建账号",
"Open account": "打开账号",
"Creating account…": "正在创建账号…",
"Opening your account…": "正在打开账号…",
"Open an existing account": "打开已有账号",
"Account not found. Create it or check the name.": "找不到该账号。请创建账号或检查账号名。",
"This account already exists. Open it instead.": "该账号已存在,请直接打开。",
"Could not open the account. Try again.": "无法打开账号,请重试。",
"This chat is busy. Try again when it finishes.": "会话正在执行,请等待当前回复结束。",
"This chat still has scheduled reminders. Remove them before deleting it.": "该会话还有定时任务,请先移除任务。",
"The chat could not be deleted. Try again.": "无法删除会话,请重试。",
"Could not confirm the Host stopped. Try again to check its status.": "无法确认 Host 是否已停止,请重试以检查状态。",
"Could not stop your Host. Try again.": "无法停止 Host,请重试。",
"Could not load chats.": "无法读取会话列表。",
"Could not start your Host. Try again.": "无法启动 Host,请重试。",
"This chat is no longer available.": "该会话已不可用。",
"Host unavailable": "Host 不可用",
"Set up an endpoint and a default model before creating a chat.": "请先配置端点和默认模型,再创建会话。",
"Could not confirm a new chat. Check the list before trying again.": "无法确认会话是否已创建,请检查会话列表后再试。",
"Stop this chat and delete its active schedules? The chat history and files will be kept.": "停止此会话并删除关联的活跃任务?会话记录和文件会保留。",
"Open chats": "打开会话列表",
"Close chats": "关闭会话列表",
"Back to chats": "返回会话",
"Settings": "设置",
"Models": "模型",
"Web search": "网页搜索",
"Image generation": "图片生成",
"Chats": "会话",
"New chat": "新建会话",
"Open model settings": "打开模型设置",
"Retry": "重试",
"No chats yet": "暂无会话",
"Actions for {name}": "{name}的操作",
"Load more": "加载更多",
"Personal workspace": "个人工作区",
"Account actions": "账号操作",
"File system": "文件系统",
"Stopping Host…": "正在停止 Host…",
"Stop Host": "停止 Host",
"Chat actions": "会话操作",
"Delete chat": "删除会话",
"Delete chat?": "删除此会话?",
"will disappear from the chat list. Its data will stay on disk.": "将从会话列表隐藏,数据会保留在磁盘上。",
"Cancel": "取消",
"Deleting…": "正在删除…",
"Could not load model settings.": "无法读取模型设置。",
"Settings were saved, but the Host could not apply them. Reopen the account to load the saved settings.": "设置已保存,但 Host 未能应用。请重新打开账号。",
"Enter an API key for the new endpoint address.": "请输入新端点的 API 密钥。",
"Check the endpoint URL, API key, and model IDs. Model IDs must be unique.": "请检查端点地址、API 密钥和模型 ID。模型 ID 不得重复。",
"Could not confirm the change. Refresh settings before trying again.": "无法确认修改已生效,请刷新设置后重试。",
"Only OpenAI-compatible Responses API endpoints are supported.": "支持 OpenAI 兼容的 Responses API 端点。",
"Loading model settings…": "正在加载模型设置…",
"Add an endpoint to create your first chat.": "添加端点后即可创建第一个会话。",
"Endpoint saved.": "端点已保存。",
"Default endpoint": "默认端点",
"API key saved": "API 密钥已保存",
"API key missing": "缺少 API 密钥",
"Default model": "默认模型",
"Edit": "编辑",
"Set as default": "设为默认",
"Default endpoint updated.": "已更新默认端点。",
"Remove this endpoint? Chats that use it will need a new model.": "移除此端点?使用它的会话需要重新选择模型。",
"Endpoint removed.": "端点已移除。",
"Remove": "移除",
"Endpoint added.": "端点已添加。",
"Add endpoint": "添加端点",
"Edit endpoint": "编辑端点",
"Name": "名称",
"Base URL": "端点地址",
"API key": "API 密钥",
"Leave blank to keep saved key": "留空以保留已保存的密钥",
"Model IDs": "模型 ID",
"One model per line. The first model is the endpoint default.": "每行填写一个模型。第一个模型为该端点的默认模型。",
"Saving…": "正在保存…",
"Save endpoint": "保存端点",
"DeepSeek Search API": "DeepSeek 搜索 API",
"BigModel API key": "智谱 BigModel API 密钥",
"Doubao Search Custom API key": "豆包搜索 API 密钥",
"Volcengine Ark API key": "火山方舟 API 密钥",
"OpenAI API key": "OpenAI API 密钥",
"Google AI Studio API key": "Google AI Studio API 密钥",
"Could not load provider settings.": "无法加载供应商设置。",
"{name} is now in use.": "已启用 {name}。",
"{name} API key removed.": "已移除 {name} 的 API 密钥。",
"{name} settings saved.": "已保存 {name} 的设置。",
"Settings were saved, but the Host could not apply them. Retry or reopen the account.": "设置已保存,但 Host 未能应用。请重试或重新打开账号。",
"Enter a valid model name or endpoint ID.": "请输入有效的模型名称或端点 ID。",
"Save an API key before using this provider.": "使用该供应商前,请先保存 API 密钥。",
"Enter a valid API key.": "请输入有效的 API 密钥。",
"Could not confirm the change. Try again.": "无法确认修改已生效,请重试。",
"Choose the service your agent uses to generate images.": "选择 Agent 用于生成图片的服务。",
"Choose the service your agent uses to search the web.": "选择 Agent 用于网页搜索的服务。",
"Loading provider settings…": "正在加载供应商设置…",
"Waiting for the Host to apply the saved change.": "正在等待 Host 应用已保存的设置。",
"In use": "当前使用",
"No provider is in use. Save a key and choose a provider.": "尚未启用供应商。请保存密钥并选择供应商。",
"{title} providers": "{title}供应商",
"No API key": "未设置 API 密钥",
"Retry applying {name}": "重试启用 {name}",
"Use {name}": "使用 {name}",
"Edit {name}": "编辑 {name}",
"Set up {name}": "配置 {name}",
"Retry apply": "重试应用",
"Use provider": "使用该供应商",
"Set up": "配置",
"Model name or endpoint ID": "模型名称或端点 ID",
"Model name": "模型名称",
"Leave blank to keep the saved key": "留空以保留已保存的密钥",
"Save settings": "保存设置",
"Remove key": "移除密钥",
"Build a provider adapter": "编写供应商适配器",
"This directory is no longer available.": "该目录已不可用。",
"The Host is unavailable. Try again after it reconnects.": "Host 暂不可用,请在重新连接后重试。",
"Could not list this directory.": "无法读取此目录。",
"Docker volume": "Docker 卷",
"Instance filesystem": "实例文件系统",
"Path copied.": "已复制路径。",
"Could not copy the path.": "无法复制路径。",
"Loading…": "正在加载…",
"Empty directory": "空目录",
"Close file system": "关闭文件系统",
"Refresh file tree": "刷新文件树",
"Copy path": "复制路径",
"Good morning": "早上好",
"Good afternoon": "下午好",
"Good evening": "晚上好",
"Choose an available model for this chat.": "请为当前会话选择可用模型。",
"The Host could not apply the current model settings. Reopen the account or save the model settings again.": "Host 无法应用当前模型设置。请重新打开账号或保存模型设置。",
"The message or its attachments exceed the upload limit.": "消息或附件超过上传限制。",
"An attached image could not be read. Remove it and try again.": "无法读取图片附件,请移除后重试。",
"The message was not accepted. Check it and try again.": "消息未被接收,请检查后重试。",
"Delivery could not be confirmed. Check the conversation before sending again.": "无法确认消息已送达。再次发送前请先检查会话。",
"Chat history could not be loaded.": "无法加载会话记录。",
"Older messages could not be loaded.": "无法加载更早的消息。",
"The queued message could not be updated.": "无法更新排队中的消息。",
"Generation could not be stopped.": "无法停止生成。",
"Attachments to send": "待发送附件",
"Remove {name}": "移除 {name}",
"Message": "消息",
"Ask anything…": "问点什么…",
"Add attachments": "添加附件",
"Stop generating": "停止生成",
"Send message": "发送消息",
"How can I help you today?": "今天想做什么?",
"Conversation": "会话消息",
"Loading chat…": "正在加载会话…",
"Load earlier messages": "加载更早的消息",
"Preparing a reply…": "正在准备回复…",
"Generating…": "正在生成…",
"Reconnecting…": "正在重新连接…",
"Back to latest": "回到最新消息",
"Queued messages": "排队中的消息",
"Attachment": "附件",
"Waiting to steer": "等待引导",
"Steer": "引导",
"Delete": "删除",
"{name} is empty.": "{name} 是空文件。",
"An attachment name exceeds 255 bytes.": "附件文件名超过 255 字节。",
"{name} exceeds {limit} MiB.": "{name} 超过 {limit} MiB。",
"A message can attach up to 20 images and 8 other files.": "每条消息最多可添加 20 张图片和 8 个其他文件。",
"Attachments cannot exceed 200 MiB per message.": "每条消息的附件总大小不能超过 200 MiB。",
"Scheduled task": "定时任务",
"Background task": "后台任务",
"The reply was interrupted.": "回复已中断。",
"The agent could not finish its reply.": "助手未能完成回复。",
"Table": "表格",
"Read file": "读取文件",
"Write file": "写入文件",
"Edit file": "编辑文件",
"Read image": "查看图片",
"Previous images": "向左浏览图片",
"Next images": "向右浏览图片",
"View images": "查看图片",
"1 image": "1 张",
"{count} images": "{count} 张",
"Images — scroll horizontally": "图片,可左右滑动",
"No images to display.": "没有可显示的图片。",
"Image unavailable. Retry": "图片暂不可用,重试",
"Generate image": "生成图片",
"Run command": "执行命令",
"Search the web": "搜索网页",
"Open web page": "打开网页",
"Present files": "交付文件",
"Load skill": "加载技能",
"Create scheduled task": "创建定时任务",
"List scheduled tasks": "列出定时任务",
"View scheduled task": "查看定时任务",
"Edit scheduled task": "修改定时任务",
"{count} tool steps": "{count} 个工具步骤",
"{count} running": "{count} 个执行中",
"{count} interrupted": "{count} 个已中断",
"Finished": "已完成",
"Done": "已完成",
"Failed": "失败",
"Stopped": "已停止",
"Running": "执行中",
"Duration {time}": "用时 {time}",
"File unavailable.": "文件不可用。",
"Image unavailable.": "图片不可用。",
"Loading image": "正在加载图片",
"Open image": "打开图片",
"Could not load the chat model.": "无法读取当前会话的模型。",
"Model choice was saved, but the Host could not apply it. Try again.": "模型选择已保存,但 Host 未能应用。请重试。",
"Could not switch models. Try again.": "无法切换模型,请重试。",
"Model unavailable": "模型不可用",
"Choose model": "选择模型",
"Configure model": "配置模型",
"Endpoint": "端点",
"Could not read chat permission.": "无法读取会话权限。",
"Could not change chat permission.": "无法切换会话权限。",
"Chat permission": "会话权限",
"Permissions": "权限",
"Permissions for this chat": "当前会话的权限",
"Full access": "全权限",
"Workspace write": "工作区可写",
"Read only": "只读",
"Allow writes anywhere the Host tools can access.": "允许写入 Host 工具能够访问的位置。",
"Allow writes in this chat’s workspace. Ask before widening access.": "允许写入当前会话工作区。扩大权限前需要审批。",
"Read files and ask before any writes.": "允许读取文件。写入前需要审批。",
"The decision could not be sent. Try again.": "无法提交审批结果,请重试。",
"Tool approval": "工具审批",
"Approval required": "需要执行审批",
"Allow once applies to this operation only.": "本次授权仅适用于这项操作。",
"Deny": "拒绝",
"Allow once": "仅允许一次",
"The answer could not be sent. Try again.": "无法发送答案,请重试。",
"Agent question": "助手提问",
"You can still answer": "仍可回答此问题",
"The agent has a question": "助手需要你的回答",
"Custom answer for {question}": "自定义回答:{question}",
"Type your own answer": "输入自定义答案",
"Answer sent": "答案已发送",
"Send answer": "提交答案",
}
export function translate(language: Language, message: string, values?: Record<string, string | number>) {
const text = language === 'zh-CN' && Object.hasOwn(chinese, message) ? chinese[message] : message
return values ? text.replace(/\{(\w+)\}/g, (token, key: string) => String(values[key] ?? token)) : text
}