@goodandready/dsh-messenger-gateway 0.3.21 → 0.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/adapters/discord.js +8 -0
- package/lib/adapters/slack.js +6 -0
- package/lib/adapters/telegram.js +712 -708
- package/lib/client.js +320 -1
- package/lib/commands.js +74 -73
- package/lib/config.js +104 -104
- package/lib/content-guard.js +14 -14
- package/lib/gateway.js +1772 -1737
- package/lib/index.js +532 -500
- package/lib/locales/en.js +123 -114
- package/lib/locales/index.js +21 -21
- package/lib/locales/zh.js +123 -114
- package/lib/scheduler.js +159 -159
- package/lib/telegram-errors.js +0 -0
- package/lib/text.js +39 -39
- package/lib/updater.js +304 -0
- package/package.json +1 -1
package/lib/locales/en.js
CHANGED
|
@@ -1,114 +1,123 @@
|
|
|
1
|
-
// Canonical English locale dictionary
|
|
2
|
-
export const en = {
|
|
3
|
-
// Command descriptions
|
|
4
|
-
'cmd.help': 'Show commands help',
|
|
5
|
-
'cmd.new': 'Start new session',
|
|
6
|
-
'cmd.stop': 'Interrupt current turn',
|
|
7
|
-
'cmd.model': 'Interactive model selector',
|
|
8
|
-
'cmd.role': 'Switch agent persona or role',
|
|
9
|
-
'cmd.rewind': 'Rewind last N turns',
|
|
10
|
-
'cmd.fork': 'Fork session into new branch',
|
|
11
|
-
'cmd.export': 'Export history to Markdown',
|
|
12
|
-
'cmd.skills': 'List active tools & skills',
|
|
13
|
-
'cmd.files': 'Workspace file explorer',
|
|
14
|
-
'cmd.get': 'Download file from workspace',
|
|
15
|
-
'cmd.remind': 'Set a timer or reminder',
|
|
16
|
-
'cmd.status': 'Gateway and model status',
|
|
17
|
-
'cmd.top': 'System resources (RAM, uptime)',
|
|
18
|
-
'cmd.keyboard': 'Toggle quick action buttons',
|
|
19
|
-
'cmd.voice': 'Voice reply mode',
|
|
20
|
-
'cmd.tts': 'Toggle speech in this chat',
|
|
21
|
-
'cmd.mute': 'Mute notifications in this chat',
|
|
22
|
-
'cmd.unmute': 'Unmute notifications in this chat',
|
|
23
|
-
'cmd.whoami': 'Show your messenger user ID',
|
|
24
|
-
'cmd.pair': 'Approve pairing code',
|
|
25
|
-
'cmd.sethome': 'Set primary notification home',
|
|
26
|
-
'cmd.setalert': 'Set alert notification target',
|
|
27
|
-
'cmd.bind': 'Bind preset or persona to forum topic',
|
|
28
|
-
'cmd.preset': 'Show or switch agent preset',
|
|
29
|
-
'cmd.cron': 'Schedule recurring autonomous report',
|
|
30
|
-
|
|
31
|
-
// Bot replies & statuses
|
|
32
|
-
'msg.start': 'Gateway connected. Send messages to the agent. /help for commands.',
|
|
33
|
-
'msg.steer_added': '↪️ Added to current turn',
|
|
34
|
-
'msg.turn_stopped': 'Turn interrupted.',
|
|
35
|
-
'msg.no_active_session': 'No active session found.',
|
|
36
|
-
'msg.unknown_command': 'Unknown command {cmd}. /help',
|
|
37
|
-
'msg.not_allowed': 'Access denied. Ask the owner to whitelist your ID.',
|
|
38
|
-
'msg.pairing_requested': 'Access required.\nYour ID: {userId}\nPairing code: {code}\n\nThe owner must send to bot:\n/pair {code}',
|
|
39
|
-
'msg.pairing_rate_limit': 'Pairing code already issued. Please wait or ask owner for /pair.',
|
|
40
|
-
'msg.pairing_approved': '✅ User {userId} successfully approved!',
|
|
41
|
-
'msg.pairing_invalid': 'Invalid or expired pairing code.',
|
|
42
|
-
'msg.muted_on': 'Notifications in this chat: muted (/unmute)',
|
|
43
|
-
'msg.muted_off': 'Notifications in this chat: enabled',
|
|
44
|
-
'msg.no_response': '(no response)',
|
|
45
|
-
'msg.agent_error': 'Agent error: {code}: {message}',
|
|
46
|
-
'msg.exception': 'Internal error: {message}',
|
|
47
|
-
|
|
48
|
-
// Photo & media
|
|
49
|
-
'photo.received_one': 'Photo received. Send a question — e.g. "what is in this photo?"',
|
|
50
|
-
'photo.received_many': 'Received {count} attachments. Send your question.',
|
|
51
|
-
'photo.hint_photo': '[Photo attached]',
|
|
52
|
-
'photo.hint_photos': '[{count} photos attached]',
|
|
53
|
-
'doc.hint': '[Document attached: {name}]',
|
|
54
|
-
|
|
55
|
-
// Interactive buttons & ask
|
|
56
|
-
'ask.confirm_title': '⚠️ Confirmation Required\nTool: <code>{tool}</code>{reason}',
|
|
57
|
-
'ask.allow_once': '✅ Allow Once',
|
|
58
|
-
'ask.allow_session': '🛡️ Allow for Session',
|
|
59
|
-
'ask.deny': '❌ Deny',
|
|
60
|
-
'ask.chose': 'Chose: {choice}',
|
|
61
|
-
'ask.done': 'Done',
|
|
62
|
-
'ask.cancel': 'Cancel',
|
|
63
|
-
'ask.canceled': 'Canceled',
|
|
64
|
-
'ask.expired': 'Interaction expired. Please try again.',
|
|
65
|
-
'ask.other_chat': 'Button belongs to another chat',
|
|
66
|
-
|
|
67
|
-
// Model selector
|
|
68
|
-
'model.title': '🤖 <b>Choose Provider:</b>',
|
|
69
|
-
'model.current': 'Current: <code>{current}</code>',
|
|
70
|
-
'model.provider_models': '🤖 <b>Provider:</b> <code>{provider}</code>\nSelect model (page {page}/{total}):',
|
|
71
|
-
'model.no_models': 'No models available for this provider',
|
|
72
|
-
'model.switched': '✅ Model successfully switched to: <b>{provider}/{model}</b>',
|
|
73
|
-
|
|
74
|
-
// Personas & Presets
|
|
75
|
-
'persona.title': '🎭 <b>Available Roles & Personas:</b>',
|
|
76
|
-
'persona.usage': 'Switch role: <code>/role coder</code> (or /role reset)',
|
|
77
|
-
'persona.reset': '🎭 Role reset to default (Default).',
|
|
78
|
-
'persona.switched': '🎭 Role changed to: {icon} <b>{name}</b>\n{description}',
|
|
79
|
-
'persona.unknown': 'Unknown role "{target}". List: /role list',
|
|
80
|
-
'persona.bound_topic': '📌 Topic bound to {kind}: <b>{name}</b>',
|
|
81
|
-
|
|
82
|
-
// Builtin persona descriptions
|
|
83
|
-
'persona.default.name': 'Default',
|
|
84
|
-
'persona.default.desc': 'General assistant, concise and balanced',
|
|
85
|
-
'persona.coder.name': 'Developer',
|
|
86
|
-
'persona.coder.desc': 'Senior developer, code focus without fluff',
|
|
87
|
-
'persona.writer.name': 'Editor',
|
|
88
|
-
'persona.writer.desc': 'Copywriter, clean text and clear tone',
|
|
89
|
-
'persona.analyst.name': 'Analyst',
|
|
90
|
-
'persona.analyst.desc': 'Structured decomposition and data analysis',
|
|
91
|
-
'persona.concise.name': 'Brief',
|
|
92
|
-
'persona.concise.desc': 'Ultra-short replies, 1-2 sentences',
|
|
93
|
-
|
|
94
|
-
// File explorer & export
|
|
95
|
-
'files.title': '📁 <b>Workspace:</b> <code>{path}</code>\nTotal files: {count}\n\n',
|
|
96
|
-
'files.empty': '📁 Directory is empty: <code>{path}</code>',
|
|
97
|
-
'files.download_hint': '\nDownload file: <code>/get <path></code>',
|
|
98
|
-
'files.not_found': 'File not found: {path}',
|
|
99
|
-
'export.title': '📄 Dialog export ({count} messages):',
|
|
100
|
-
'export.empty': 'Session is empty, nothing to export.',
|
|
101
|
-
|
|
102
|
-
// Reminders & Cron
|
|
103
|
-
'remind.scheduled': '⏰ Reminder set for {time} (in {duration}):\n{text}',
|
|
104
|
-
'remind.invalid': 'Invalid time format. Example: /remind 10m check deploy',
|
|
105
|
-
'remind.prefix': '⏰ <b>[Reminder]</b>\n{text}',
|
|
106
|
-
'cron.scheduled': '⏱️ Autonomous cron task scheduled: <code>{id}</code>\nSchedule: <code>{schedule}</code>\nPrompt: {prompt}',
|
|
107
|
-
'cron.list_title': '⏱️ <b>Scheduled Cron Tasks:</b>\n',
|
|
108
|
-
'cron.none': 'No active cron tasks.',
|
|
109
|
-
'cron.cancelled': '✅ Cron task cancelled: <code>{id}</code>',
|
|
110
|
-
'cron.prefix': '⏱️ <b>[Scheduled Report: {id}]</b>\n',
|
|
111
|
-
|
|
112
|
-
// Mirror & Forum
|
|
113
|
-
'mirror.created': '🪞 <b>[DSH Session Mirror]</b>\nSession: <code>{sessionId}</code>\nTitle: <b>{title}</b>\nMessages in this topic are synchronized with DSH.',
|
|
114
|
-
|
|
1
|
+
// Canonical English locale dictionary
|
|
2
|
+
export const en = {
|
|
3
|
+
// Command descriptions
|
|
4
|
+
'cmd.help': 'Show commands help',
|
|
5
|
+
'cmd.new': 'Start new session',
|
|
6
|
+
'cmd.stop': 'Interrupt current turn',
|
|
7
|
+
'cmd.model': 'Interactive model selector',
|
|
8
|
+
'cmd.role': 'Switch agent persona or role',
|
|
9
|
+
'cmd.rewind': 'Rewind last N turns',
|
|
10
|
+
'cmd.fork': 'Fork session into new branch',
|
|
11
|
+
'cmd.export': 'Export history to Markdown',
|
|
12
|
+
'cmd.skills': 'List active tools & skills',
|
|
13
|
+
'cmd.files': 'Workspace file explorer',
|
|
14
|
+
'cmd.get': 'Download file from workspace',
|
|
15
|
+
'cmd.remind': 'Set a timer or reminder',
|
|
16
|
+
'cmd.status': 'Gateway and model status',
|
|
17
|
+
'cmd.top': 'System resources (RAM, uptime)',
|
|
18
|
+
'cmd.keyboard': 'Toggle quick action buttons',
|
|
19
|
+
'cmd.voice': 'Voice reply mode',
|
|
20
|
+
'cmd.tts': 'Toggle speech in this chat',
|
|
21
|
+
'cmd.mute': 'Mute notifications in this chat',
|
|
22
|
+
'cmd.unmute': 'Unmute notifications in this chat',
|
|
23
|
+
'cmd.whoami': 'Show your messenger user ID',
|
|
24
|
+
'cmd.pair': 'Approve pairing code',
|
|
25
|
+
'cmd.sethome': 'Set primary notification home',
|
|
26
|
+
'cmd.setalert': 'Set alert notification target',
|
|
27
|
+
'cmd.bind': 'Bind preset or persona to forum topic',
|
|
28
|
+
'cmd.preset': 'Show or switch agent preset',
|
|
29
|
+
'cmd.cron': 'Schedule recurring autonomous report',
|
|
30
|
+
|
|
31
|
+
// Bot replies & statuses
|
|
32
|
+
'msg.start': 'Gateway connected. Send messages to the agent. /help for commands.',
|
|
33
|
+
'msg.steer_added': '↪️ Added to current turn',
|
|
34
|
+
'msg.turn_stopped': 'Turn interrupted.',
|
|
35
|
+
'msg.no_active_session': 'No active session found.',
|
|
36
|
+
'msg.unknown_command': 'Unknown command {cmd}. /help',
|
|
37
|
+
'msg.not_allowed': 'Access denied. Ask the owner to whitelist your ID.',
|
|
38
|
+
'msg.pairing_requested': 'Access required.\nYour ID: {userId}\nPairing code: {code}\n\nThe owner must send to bot:\n/pair {code}',
|
|
39
|
+
'msg.pairing_rate_limit': 'Pairing code already issued. Please wait or ask owner for /pair.',
|
|
40
|
+
'msg.pairing_approved': '✅ User {userId} successfully approved!',
|
|
41
|
+
'msg.pairing_invalid': 'Invalid or expired pairing code.',
|
|
42
|
+
'msg.muted_on': 'Notifications in this chat: muted (/unmute)',
|
|
43
|
+
'msg.muted_off': 'Notifications in this chat: enabled',
|
|
44
|
+
'msg.no_response': '(no response)',
|
|
45
|
+
'msg.agent_error': 'Agent error: {code}: {message}',
|
|
46
|
+
'msg.exception': 'Internal error: {message}',
|
|
47
|
+
|
|
48
|
+
// Photo & media
|
|
49
|
+
'photo.received_one': 'Photo received. Send a question — e.g. "what is in this photo?"',
|
|
50
|
+
'photo.received_many': 'Received {count} attachments. Send your question.',
|
|
51
|
+
'photo.hint_photo': '[Photo attached]',
|
|
52
|
+
'photo.hint_photos': '[{count} photos attached]',
|
|
53
|
+
'doc.hint': '[Document attached: {name}]',
|
|
54
|
+
|
|
55
|
+
// Interactive buttons & ask
|
|
56
|
+
'ask.confirm_title': '⚠️ Confirmation Required\nTool: <code>{tool}</code>{reason}',
|
|
57
|
+
'ask.allow_once': '✅ Allow Once',
|
|
58
|
+
'ask.allow_session': '🛡️ Allow for Session',
|
|
59
|
+
'ask.deny': '❌ Deny',
|
|
60
|
+
'ask.chose': 'Chose: {choice}',
|
|
61
|
+
'ask.done': 'Done',
|
|
62
|
+
'ask.cancel': 'Cancel',
|
|
63
|
+
'ask.canceled': 'Canceled',
|
|
64
|
+
'ask.expired': 'Interaction expired. Please try again.',
|
|
65
|
+
'ask.other_chat': 'Button belongs to another chat',
|
|
66
|
+
|
|
67
|
+
// Model selector
|
|
68
|
+
'model.title': '🤖 <b>Choose Provider:</b>',
|
|
69
|
+
'model.current': 'Current: <code>{current}</code>',
|
|
70
|
+
'model.provider_models': '🤖 <b>Provider:</b> <code>{provider}</code>\nSelect model (page {page}/{total}):',
|
|
71
|
+
'model.no_models': 'No models available for this provider',
|
|
72
|
+
'model.switched': '✅ Model successfully switched to: <b>{provider}/{model}</b>',
|
|
73
|
+
|
|
74
|
+
// Personas & Presets
|
|
75
|
+
'persona.title': '🎭 <b>Available Roles & Personas:</b>',
|
|
76
|
+
'persona.usage': 'Switch role: <code>/role coder</code> (or /role reset)',
|
|
77
|
+
'persona.reset': '🎭 Role reset to default (Default).',
|
|
78
|
+
'persona.switched': '🎭 Role changed to: {icon} <b>{name}</b>\n{description}',
|
|
79
|
+
'persona.unknown': 'Unknown role "{target}". List: /role list',
|
|
80
|
+
'persona.bound_topic': '📌 Topic bound to {kind}: <b>{name}</b>',
|
|
81
|
+
|
|
82
|
+
// Builtin persona descriptions
|
|
83
|
+
'persona.default.name': 'Default',
|
|
84
|
+
'persona.default.desc': 'General assistant, concise and balanced',
|
|
85
|
+
'persona.coder.name': 'Developer',
|
|
86
|
+
'persona.coder.desc': 'Senior developer, code focus without fluff',
|
|
87
|
+
'persona.writer.name': 'Editor',
|
|
88
|
+
'persona.writer.desc': 'Copywriter, clean text and clear tone',
|
|
89
|
+
'persona.analyst.name': 'Analyst',
|
|
90
|
+
'persona.analyst.desc': 'Structured decomposition and data analysis',
|
|
91
|
+
'persona.concise.name': 'Brief',
|
|
92
|
+
'persona.concise.desc': 'Ultra-short replies, 1-2 sentences',
|
|
93
|
+
|
|
94
|
+
// File explorer & export
|
|
95
|
+
'files.title': '📁 <b>Workspace:</b> <code>{path}</code>\nTotal files: {count}\n\n',
|
|
96
|
+
'files.empty': '📁 Directory is empty: <code>{path}</code>',
|
|
97
|
+
'files.download_hint': '\nDownload file: <code>/get <path></code>',
|
|
98
|
+
'files.not_found': 'File not found: {path}',
|
|
99
|
+
'export.title': '📄 Dialog export ({count} messages):',
|
|
100
|
+
'export.empty': 'Session is empty, nothing to export.',
|
|
101
|
+
|
|
102
|
+
// Reminders & Cron
|
|
103
|
+
'remind.scheduled': '⏰ Reminder set for {time} (in {duration}):\n{text}',
|
|
104
|
+
'remind.invalid': 'Invalid time format. Example: /remind 10m check deploy',
|
|
105
|
+
'remind.prefix': '⏰ <b>[Reminder]</b>\n{text}',
|
|
106
|
+
'cron.scheduled': '⏱️ Autonomous cron task scheduled: <code>{id}</code>\nSchedule: <code>{schedule}</code>\nPrompt: {prompt}',
|
|
107
|
+
'cron.list_title': '⏱️ <b>Scheduled Cron Tasks:</b>\n',
|
|
108
|
+
'cron.none': 'No active cron tasks.',
|
|
109
|
+
'cron.cancelled': '✅ Cron task cancelled: <code>{id}</code>',
|
|
110
|
+
'cron.prefix': '⏱️ <b>[Scheduled Report: {id}]</b>\n',
|
|
111
|
+
|
|
112
|
+
// Mirror & Forum
|
|
113
|
+
'mirror.created': '🪞 <b>[DSH Session Mirror]</b>\nSession: <code>{sessionId}</code>\nTitle: <b>{title}</b>\nMessages in this topic are synchronized with DSH.',
|
|
114
|
+
// Updates & Maintenance
|
|
115
|
+
'cmd.update': 'Check or install plugin update',
|
|
116
|
+
'update.installing': '⏳ <b>Updating plugin…</b>\nRunning DSH package installation in background…',
|
|
117
|
+
'update.already_latest': '✅ Plugin is already up to date (<code>v{version}</code>).',
|
|
118
|
+
'update.success': '🎉 <b>Successfully updated to v{version}!</b>\nPlease restart the service to apply changes: <code>sudo systemctl restart dsh-web.service</code>',
|
|
119
|
+
'update.failed': '❌ <b>Update failed:</b> {error}',
|
|
120
|
+
'update.available': '📦 <b>Update Available!</b>\nCurrent version: <code>v{current}</code>\nLatest release: <code>v{latest}</code>\n\nRun <code>/update now</code> to install.',
|
|
121
|
+
'update.current': '✅ <b>Messenger Gateway is up to date.</b>\nCurrent version: <code>v{version}</code>.',
|
|
122
|
+
'update.check_failed': '⚠️ Failed to check for updates: {error}',
|
|
123
|
+
}
|
package/lib/locales/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { en } from './en.js'
|
|
2
|
-
import { zh } from './zh.js'
|
|
3
|
-
|
|
4
|
-
export const locales = { en, zh }
|
|
5
|
-
|
|
6
|
-
export function getLocaleDictionary(locale = 'en') {
|
|
7
|
-
const norm = String(locale || '').toLowerCase()
|
|
8
|
-
if (norm.startsWith('zh')) return zh
|
|
9
|
-
return en
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function t(key, params = {}, locale = 'en') {
|
|
13
|
-
const dict = getLocaleDictionary(locale)
|
|
14
|
-
let template = dict[key] || en[key] || key
|
|
15
|
-
for (const [k, v] of Object.entries(params)) {
|
|
16
|
-
template = template.replaceAll(`{${k}}`, String(v))
|
|
17
|
-
}
|
|
18
|
-
return template
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { en, zh }
|
|
1
|
+
import { en } from './en.js'
|
|
2
|
+
import { zh } from './zh.js'
|
|
3
|
+
|
|
4
|
+
export const locales = { en, zh }
|
|
5
|
+
|
|
6
|
+
export function getLocaleDictionary(locale = 'en') {
|
|
7
|
+
const norm = String(locale || '').toLowerCase()
|
|
8
|
+
if (norm.startsWith('zh')) return zh
|
|
9
|
+
return en
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function t(key, params = {}, locale = 'en') {
|
|
13
|
+
const dict = getLocaleDictionary(locale)
|
|
14
|
+
let template = dict[key] || en[key] || key
|
|
15
|
+
for (const [k, v] of Object.entries(params)) {
|
|
16
|
+
template = template.replaceAll(`{${k}}`, String(v))
|
|
17
|
+
}
|
|
18
|
+
return template
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { en, zh }
|
package/lib/locales/zh.js
CHANGED
|
@@ -1,114 +1,123 @@
|
|
|
1
|
-
// Canonical Chinese (zh) locale dictionary
|
|
2
|
-
export const zh = {
|
|
3
|
-
// Command descriptions
|
|
4
|
-
'cmd.help': '显示帮助信息',
|
|
5
|
-
'cmd.new': '开始新会话',
|
|
6
|
-
'cmd.stop': '中断当前回答',
|
|
7
|
-
'cmd.model': '交互式模型选择器',
|
|
8
|
-
'cmd.role': '切换智能体角色/人设',
|
|
9
|
-
'cmd.rewind': '回退最近N轮对话',
|
|
10
|
-
'cmd.fork': '将会话派生到新分支',
|
|
11
|
-
'cmd.export': '导出历史记录为Markdown',
|
|
12
|
-
'cmd.skills': '列出当前可用工具与技能',
|
|
13
|
-
'cmd.files': '工作区文件浏览器',
|
|
14
|
-
'cmd.get': '从工作区下载文件',
|
|
15
|
-
'cmd.remind': '设置提醒或定时器',
|
|
16
|
-
'cmd.status': '查看网关与模型状态',
|
|
17
|
-
'cmd.top': '查看系统资源(内存、运行时间)',
|
|
18
|
-
'cmd.keyboard': '开关快捷操作键盘',
|
|
19
|
-
'cmd.voice': '设置语音回复模式',
|
|
20
|
-
'cmd.tts': '在此聊天开关语音朗读',
|
|
21
|
-
'cmd.mute': '在此聊天静音通知',
|
|
22
|
-
'cmd.unmute': '在此聊天恢复通知',
|
|
23
|
-
'cmd.whoami': '显示你的用户ID',
|
|
24
|
-
'cmd.pair': '批准配对申请码',
|
|
25
|
-
'cmd.sethome': '设置主通知频道',
|
|
26
|
-
'cmd.setalert': '设置告警通知目标',
|
|
27
|
-
'cmd.bind': '绑定预设或人设到论坛话题',
|
|
28
|
-
'cmd.preset': '查看或切换智能体预设',
|
|
29
|
-
'cmd.cron': '配置定时周期性任务报告',
|
|
30
|
-
|
|
31
|
-
// Bot replies & statuses
|
|
32
|
-
'msg.start': '网关已连接。请向智能体发送消息。发送 /help 查看命令。',
|
|
33
|
-
'msg.steer_added': '↪️ 已追加到当前回答',
|
|
34
|
-
'msg.turn_stopped': '回答已中断。',
|
|
35
|
-
'msg.no_active_session': '未找到活跃会话。',
|
|
36
|
-
'msg.unknown_command': '未知命令 {cmd}。发送 /help',
|
|
37
|
-
'msg.not_allowed': '访问受限。请联系管理员将您的ID加入白名单。',
|
|
38
|
-
'msg.pairing_requested': '需要访问配对。\n您的ID: {userId}\n配对码: {code}\n\n管理员请向机器人发送:\n/pair {code}',
|
|
39
|
-
'msg.pairing_rate_limit': '配对码已发出,请稍候或联系管理员。',
|
|
40
|
-
'msg.pairing_approved': '✅ 用户 {userId} 已成功授权!',
|
|
41
|
-
'msg.pairing_invalid': '配对码无效或已过期。',
|
|
42
|
-
'msg.muted_on': '此聊天通知:已静音 (/unmute)',
|
|
43
|
-
'msg.muted_off': '此聊天通知:已开启',
|
|
44
|
-
'msg.no_response': '(无回复)',
|
|
45
|
-
'msg.agent_error': '智能体错误: {code}: {message}',
|
|
46
|
-
'msg.exception': '内部处理异常: {message}',
|
|
47
|
-
|
|
48
|
-
// Photo & media
|
|
49
|
-
'photo.received_one': '已收到图片。请输入您的问题 — 例如:“图片中有什么?”',
|
|
50
|
-
'photo.received_many': '已收到 {count} 个附件。请输入您的问题。',
|
|
51
|
-
'photo.hint_photo': '[附加图片]',
|
|
52
|
-
'photo.hint_photos': '[附加了 {count} 张图片]',
|
|
53
|
-
'doc.hint': '[附加文件: {name}]',
|
|
54
|
-
|
|
55
|
-
// Interactive buttons & ask
|
|
56
|
-
'ask.confirm_title': '⚠️ 需要授权确认\n工具: <code>{tool}</code>{reason}',
|
|
57
|
-
'ask.allow_once': '✅ 允许单次',
|
|
58
|
-
'ask.allow_session': '🛡️ 本会话始终允许',
|
|
59
|
-
'ask.deny': '❌ 拒绝',
|
|
60
|
-
'ask.chose': '已选择: {choice}',
|
|
61
|
-
'ask.done': '完成',
|
|
62
|
-
'ask.cancel': '取消',
|
|
63
|
-
'ask.canceled': '已取消',
|
|
64
|
-
'ask.expired': '交互已超时,请重新发起。',
|
|
65
|
-
'ask.other_chat': '该按钮属于其他聊天',
|
|
66
|
-
|
|
67
|
-
// Model selector
|
|
68
|
-
'model.title': '🤖 <b>选择服务商:</b>',
|
|
69
|
-
'model.current': '当前: <code>{current}</code>',
|
|
70
|
-
'model.provider_models': '🤖 <b>服务商:</b> <code>{provider}</code>\n请选择模型 (第 {page}/{total} 页):',
|
|
71
|
-
'model.no_models': '该服务商暂无可用的模型',
|
|
72
|
-
'model.switched': '✅ 模型已成功切换至: <b>{provider}/{model}</b>',
|
|
73
|
-
|
|
74
|
-
// Personas & Presets
|
|
75
|
-
'persona.title': '🎭 <b>可用角色与人设:</b>',
|
|
76
|
-
'persona.usage': '切换角色: <code>/role coder</code> (或 /role reset)',
|
|
77
|
-
'persona.reset': '🎭 角色已重置为默认 (Default)。',
|
|
78
|
-
'persona.switched': '🎭 角色已切换为: {icon} <b>{name}</b>\n{description}',
|
|
79
|
-
'persona.unknown': '未知角色 "{target}"。列表请见: /role list',
|
|
80
|
-
'persona.bound_topic': '📌 话题已绑定到{kind}: <b>{name}</b>',
|
|
81
|
-
|
|
82
|
-
// Builtin persona descriptions
|
|
83
|
-
'persona.default.name': '默认',
|
|
84
|
-
'persona.default.desc': '通用智能助手,回答平衡清晰',
|
|
85
|
-
'persona.coder.name': '开发者',
|
|
86
|
-
'persona.coder.desc': '资深全栈工程师,直奔代码核心',
|
|
87
|
-
'persona.writer.name': '文案编辑',
|
|
88
|
-
'persona.writer.desc': '专业编辑润色,文笔优美流畅',
|
|
89
|
-
'persona.analyst.name': '分析师',
|
|
90
|
-
'persona.analyst.desc': '结构化逻辑拆解,深度数据分析',
|
|
91
|
-
'persona.concise.name': '极简',
|
|
92
|
-
'persona.concise.desc': '极速短促回复,1-2句话答复',
|
|
93
|
-
|
|
94
|
-
// File explorer & export
|
|
95
|
-
'files.title': '📁 <b>工作区路径:</b> <code>{path}</code>\n文件总计: {count}\n\n',
|
|
96
|
-
'files.empty': '📁 目录为空: <code>{path}</code>',
|
|
97
|
-
'files.download_hint': '\n下载文件命令: <code>/get <path></code>',
|
|
98
|
-
'files.not_found': '未找到文件: {path}',
|
|
99
|
-
'export.title': '📄 对话导出 ({count} 条消息):',
|
|
100
|
-
'export.empty': '会话为空,无消息可导出。',
|
|
101
|
-
|
|
102
|
-
// Reminders & Cron
|
|
103
|
-
'remind.scheduled': '⏰ 提醒已设置在 {time} ({duration} 后):\n{text}',
|
|
104
|
-
'remind.invalid': '时间格式错误。例如: /remind 10m 检查构建',
|
|
105
|
-
'remind.prefix': '⏰ <b>[提醒]</b>\n{text}',
|
|
106
|
-
'cron.scheduled': '⏱️ 定时任务已配置: <code>{id}</code>\n周期表达式: <code>{schedule}</code>\n指令: {prompt}',
|
|
107
|
-
'cron.list_title': '⏱️ <b>当前定时任务列表:</b>\n',
|
|
108
|
-
'cron.none': '暂无活动的定时任务。',
|
|
109
|
-
'cron.cancelled': '✅ 定时任务已取消: <code>{id}</code>',
|
|
110
|
-
'cron.prefix': '⏱️ <b>[定时报告: {id}]</b>\n',
|
|
111
|
-
|
|
112
|
-
// Mirror & Forum
|
|
113
|
-
'mirror.created': '🪞 <b>[DSH 会话镜像]</b>\n会话ID: <code>{sessionId}</code>\n标题: <b>{title}</b>\n此话题消息与 DSH 双向同步。',
|
|
114
|
-
|
|
1
|
+
// Canonical Chinese (zh) locale dictionary
|
|
2
|
+
export const zh = {
|
|
3
|
+
// Command descriptions
|
|
4
|
+
'cmd.help': '显示帮助信息',
|
|
5
|
+
'cmd.new': '开始新会话',
|
|
6
|
+
'cmd.stop': '中断当前回答',
|
|
7
|
+
'cmd.model': '交互式模型选择器',
|
|
8
|
+
'cmd.role': '切换智能体角色/人设',
|
|
9
|
+
'cmd.rewind': '回退最近N轮对话',
|
|
10
|
+
'cmd.fork': '将会话派生到新分支',
|
|
11
|
+
'cmd.export': '导出历史记录为Markdown',
|
|
12
|
+
'cmd.skills': '列出当前可用工具与技能',
|
|
13
|
+
'cmd.files': '工作区文件浏览器',
|
|
14
|
+
'cmd.get': '从工作区下载文件',
|
|
15
|
+
'cmd.remind': '设置提醒或定时器',
|
|
16
|
+
'cmd.status': '查看网关与模型状态',
|
|
17
|
+
'cmd.top': '查看系统资源(内存、运行时间)',
|
|
18
|
+
'cmd.keyboard': '开关快捷操作键盘',
|
|
19
|
+
'cmd.voice': '设置语音回复模式',
|
|
20
|
+
'cmd.tts': '在此聊天开关语音朗读',
|
|
21
|
+
'cmd.mute': '在此聊天静音通知',
|
|
22
|
+
'cmd.unmute': '在此聊天恢复通知',
|
|
23
|
+
'cmd.whoami': '显示你的用户ID',
|
|
24
|
+
'cmd.pair': '批准配对申请码',
|
|
25
|
+
'cmd.sethome': '设置主通知频道',
|
|
26
|
+
'cmd.setalert': '设置告警通知目标',
|
|
27
|
+
'cmd.bind': '绑定预设或人设到论坛话题',
|
|
28
|
+
'cmd.preset': '查看或切换智能体预设',
|
|
29
|
+
'cmd.cron': '配置定时周期性任务报告',
|
|
30
|
+
|
|
31
|
+
// Bot replies & statuses
|
|
32
|
+
'msg.start': '网关已连接。请向智能体发送消息。发送 /help 查看命令。',
|
|
33
|
+
'msg.steer_added': '↪️ 已追加到当前回答',
|
|
34
|
+
'msg.turn_stopped': '回答已中断。',
|
|
35
|
+
'msg.no_active_session': '未找到活跃会话。',
|
|
36
|
+
'msg.unknown_command': '未知命令 {cmd}。发送 /help',
|
|
37
|
+
'msg.not_allowed': '访问受限。请联系管理员将您的ID加入白名单。',
|
|
38
|
+
'msg.pairing_requested': '需要访问配对。\n您的ID: {userId}\n配对码: {code}\n\n管理员请向机器人发送:\n/pair {code}',
|
|
39
|
+
'msg.pairing_rate_limit': '配对码已发出,请稍候或联系管理员。',
|
|
40
|
+
'msg.pairing_approved': '✅ 用户 {userId} 已成功授权!',
|
|
41
|
+
'msg.pairing_invalid': '配对码无效或已过期。',
|
|
42
|
+
'msg.muted_on': '此聊天通知:已静音 (/unmute)',
|
|
43
|
+
'msg.muted_off': '此聊天通知:已开启',
|
|
44
|
+
'msg.no_response': '(无回复)',
|
|
45
|
+
'msg.agent_error': '智能体错误: {code}: {message}',
|
|
46
|
+
'msg.exception': '内部处理异常: {message}',
|
|
47
|
+
|
|
48
|
+
// Photo & media
|
|
49
|
+
'photo.received_one': '已收到图片。请输入您的问题 — 例如:“图片中有什么?”',
|
|
50
|
+
'photo.received_many': '已收到 {count} 个附件。请输入您的问题。',
|
|
51
|
+
'photo.hint_photo': '[附加图片]',
|
|
52
|
+
'photo.hint_photos': '[附加了 {count} 张图片]',
|
|
53
|
+
'doc.hint': '[附加文件: {name}]',
|
|
54
|
+
|
|
55
|
+
// Interactive buttons & ask
|
|
56
|
+
'ask.confirm_title': '⚠️ 需要授权确认\n工具: <code>{tool}</code>{reason}',
|
|
57
|
+
'ask.allow_once': '✅ 允许单次',
|
|
58
|
+
'ask.allow_session': '🛡️ 本会话始终允许',
|
|
59
|
+
'ask.deny': '❌ 拒绝',
|
|
60
|
+
'ask.chose': '已选择: {choice}',
|
|
61
|
+
'ask.done': '完成',
|
|
62
|
+
'ask.cancel': '取消',
|
|
63
|
+
'ask.canceled': '已取消',
|
|
64
|
+
'ask.expired': '交互已超时,请重新发起。',
|
|
65
|
+
'ask.other_chat': '该按钮属于其他聊天',
|
|
66
|
+
|
|
67
|
+
// Model selector
|
|
68
|
+
'model.title': '🤖 <b>选择服务商:</b>',
|
|
69
|
+
'model.current': '当前: <code>{current}</code>',
|
|
70
|
+
'model.provider_models': '🤖 <b>服务商:</b> <code>{provider}</code>\n请选择模型 (第 {page}/{total} 页):',
|
|
71
|
+
'model.no_models': '该服务商暂无可用的模型',
|
|
72
|
+
'model.switched': '✅ 模型已成功切换至: <b>{provider}/{model}</b>',
|
|
73
|
+
|
|
74
|
+
// Personas & Presets
|
|
75
|
+
'persona.title': '🎭 <b>可用角色与人设:</b>',
|
|
76
|
+
'persona.usage': '切换角色: <code>/role coder</code> (或 /role reset)',
|
|
77
|
+
'persona.reset': '🎭 角色已重置为默认 (Default)。',
|
|
78
|
+
'persona.switched': '🎭 角色已切换为: {icon} <b>{name}</b>\n{description}',
|
|
79
|
+
'persona.unknown': '未知角色 "{target}"。列表请见: /role list',
|
|
80
|
+
'persona.bound_topic': '📌 话题已绑定到{kind}: <b>{name}</b>',
|
|
81
|
+
|
|
82
|
+
// Builtin persona descriptions
|
|
83
|
+
'persona.default.name': '默认',
|
|
84
|
+
'persona.default.desc': '通用智能助手,回答平衡清晰',
|
|
85
|
+
'persona.coder.name': '开发者',
|
|
86
|
+
'persona.coder.desc': '资深全栈工程师,直奔代码核心',
|
|
87
|
+
'persona.writer.name': '文案编辑',
|
|
88
|
+
'persona.writer.desc': '专业编辑润色,文笔优美流畅',
|
|
89
|
+
'persona.analyst.name': '分析师',
|
|
90
|
+
'persona.analyst.desc': '结构化逻辑拆解,深度数据分析',
|
|
91
|
+
'persona.concise.name': '极简',
|
|
92
|
+
'persona.concise.desc': '极速短促回复,1-2句话答复',
|
|
93
|
+
|
|
94
|
+
// File explorer & export
|
|
95
|
+
'files.title': '📁 <b>工作区路径:</b> <code>{path}</code>\n文件总计: {count}\n\n',
|
|
96
|
+
'files.empty': '📁 目录为空: <code>{path}</code>',
|
|
97
|
+
'files.download_hint': '\n下载文件命令: <code>/get <path></code>',
|
|
98
|
+
'files.not_found': '未找到文件: {path}',
|
|
99
|
+
'export.title': '📄 对话导出 ({count} 条消息):',
|
|
100
|
+
'export.empty': '会话为空,无消息可导出。',
|
|
101
|
+
|
|
102
|
+
// Reminders & Cron
|
|
103
|
+
'remind.scheduled': '⏰ 提醒已设置在 {time} ({duration} 后):\n{text}',
|
|
104
|
+
'remind.invalid': '时间格式错误。例如: /remind 10m 检查构建',
|
|
105
|
+
'remind.prefix': '⏰ <b>[提醒]</b>\n{text}',
|
|
106
|
+
'cron.scheduled': '⏱️ 定时任务已配置: <code>{id}</code>\n周期表达式: <code>{schedule}</code>\n指令: {prompt}',
|
|
107
|
+
'cron.list_title': '⏱️ <b>当前定时任务列表:</b>\n',
|
|
108
|
+
'cron.none': '暂无活动的定时任务。',
|
|
109
|
+
'cron.cancelled': '✅ 定时任务已取消: <code>{id}</code>',
|
|
110
|
+
'cron.prefix': '⏱️ <b>[定时报告: {id}]</b>\n',
|
|
111
|
+
|
|
112
|
+
// Mirror & Forum
|
|
113
|
+
'mirror.created': '🪞 <b>[DSH 会话镜像]</b>\n会话ID: <code>{sessionId}</code>\n标题: <b>{title}</b>\n此话题消息与 DSH 双向同步。',
|
|
114
|
+
// Updates & Maintenance
|
|
115
|
+
'cmd.update': '检查或安装插件更新',
|
|
116
|
+
'update.installing': '⏳ <b>正在更新插件…</b>\n正在后台运行 DSH 软件包安装…',
|
|
117
|
+
'update.already_latest': '✅ 插件已是最新版本 (<code>v{version}</code>)。',
|
|
118
|
+
'update.success': '🎉 <b>已成功更新至 v{version}!</b>\n请重启服务以使更改生效:<code>sudo systemctl restart dsh-web.service</code>',
|
|
119
|
+
'update.failed': '❌ <b>更新失败:</b> {error}',
|
|
120
|
+
'update.available': '📦 <b>发现新版本!</b>\n当前版本:<code>v{current}</code>\n最新版本:<code>v{latest}</code>\n\n发送 <code>/update now</code> 立即安装。',
|
|
121
|
+
'update.current': '✅ <b>Messenger Gateway 已是最新版本。</b>\n当前版本:<code>v{version}</code>。',
|
|
122
|
+
'update.check_failed': '⚠️ 检查更新失败:{error}',
|
|
123
|
+
}
|