mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-10 14:20:45 +08:00
feat: add plugin version command
This commit is contained in:
parent
10ca7eec2c
commit
c5becbe379
24 changed files with 240 additions and 172 deletions
|
|
@ -77,6 +77,7 @@ const HELP_TEXT_LINES = [
|
|||
'/send 提交当前批次',
|
||||
'/cancel 取消当前批次',
|
||||
'/status 检查连接状态',
|
||||
'/version 查看插件版本',
|
||||
'/help 显示本帮助',
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -495,6 +495,7 @@ export function menuHelpText() {
|
|||
'',
|
||||
'📊 状态 / 压缩',
|
||||
'/status 连接状态',
|
||||
'/version 查看插件版本',
|
||||
'/compact 压缩当前会话上下文',
|
||||
'/archived on/off 会话列表显示/隐藏归档',
|
||||
'',
|
||||
|
|
@ -589,7 +590,10 @@ export function helpCard(extraTextLines = []) {
|
|||
const elements = [
|
||||
{ tag: 'div', text: markdown(t(HELP_CARD_FEATURES)) },
|
||||
{ tag: 'hr' },
|
||||
{ tag: 'div', text: markdown(t(HELP_TEXT_COMMANDS) + extraText) },
|
||||
{ tag: 'div', text: markdown([
|
||||
t(HELP_TEXT_COMMANDS),
|
||||
t('`/version` — 查看插件版本'),
|
||||
].join('\n') + extraText) },
|
||||
{ tag: 'hr' },
|
||||
{ tag: 'div', text: markdown(t(HELP_NUMBER_FALLBACK)) },
|
||||
{ tag: 'hr' },
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ function helpText() {
|
|||
t('/send 提交当前批次'),
|
||||
t('/cancel 取消当前批次'),
|
||||
t('/status 检查连接状态'),
|
||||
t('/version 查看插件版本'),
|
||||
t('/help 显示本帮助'),
|
||||
].join('\n');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
import { t } from './i18n.mjs';
|
||||
import manifest from '../../../package.json' with { type: 'json' };
|
||||
|
||||
const CONTROL_COMMAND = /^\/(?:stop|steer)(?=$|\s)/iu;
|
||||
const CONTROL_COMMAND = /^\/(?:stop|steer|version)(?=$|\s)/iu;
|
||||
const STOP_COMMAND = /^\/stop(?=$|\s)/iu;
|
||||
const VERSION_COMMAND = /^\/version(?=$|\s)/iu;
|
||||
const STOP_USAGE = '用法:/stop(不带参数)';
|
||||
const VERSION_USAGE = '用法:/version(不带参数)';
|
||||
const STEER_USAGE = '用法:/steer <补充指令>';
|
||||
const TEXT_ONLY = '控制命令仅支持纯文字,请移除图片后重试。';
|
||||
|
||||
|
|
@ -41,9 +44,16 @@ export async function runControlCommand(text, harness, state, key, {
|
|||
if (!isControlCommand(text)) return null;
|
||||
const command = text.trim();
|
||||
const stop = STOP_COMMAND.test(command);
|
||||
const version = VERSION_COMMAND.test(command);
|
||||
|
||||
if (hasImages) return commandResult(t(TEXT_ONLY));
|
||||
|
||||
if (version) {
|
||||
return /^\/version$/iu.test(command)
|
||||
? commandResult(`dsh-im v${manifest.version}`)
|
||||
: commandResult(t(VERSION_USAGE));
|
||||
}
|
||||
|
||||
if (stop) {
|
||||
if (!/^\/stop$/iu.test(command)) return commandResult(t(STOP_USAGE));
|
||||
const session = boundSession(harness, state, key);
|
||||
|
|
|
|||
|
|
@ -229,6 +229,7 @@ export default {
|
|||
'/new 开启全新会话': '/new Start a new session',
|
||||
'📊 状态 / 压缩': '📊 Status / compact',
|
||||
'/status 连接状态': '/status Connection status',
|
||||
'`/version` — 查看插件版本': '`/version` — show the plugin version',
|
||||
'/compact 压缩当前会话上下文': '/compact Compact the current session context',
|
||||
'/archived on/off 会话列表显示/隐藏归档': '/archived on/off Show/hide archived sessions',
|
||||
'👁 关注': '👁 Watches',
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ export default {
|
|||
'/stop 停止当前任务': '/stop Stop the current task',
|
||||
'/steer 补充指令 纠偏当前任务': '/steer <additional instruction> Steer the current task',
|
||||
'/status 检查连接状态': '/status Check the connection status',
|
||||
'/version 查看插件版本': '/version Show the plugin version',
|
||||
'/help 显示本帮助': '/help Show this help',
|
||||
'{label}机器人与 DeepSeek Harness 连接正常。':
|
||||
'The {label} bot is connected to DeepSeek Harness and working normally.',
|
||||
|
|
|
|||
|
|
@ -242,6 +242,7 @@ export default {
|
|||
|
||||
// control-command.mjs
|
||||
'用法:/stop(不带参数)': 'Usage: /stop (no arguments)',
|
||||
'用法:/version(不带参数)': 'Usage: /version (no arguments)',
|
||||
'用法:/steer <补充指令>': 'Usage: /steer <additional instruction>',
|
||||
'控制命令仅支持纯文字,请移除图片后重试。':
|
||||
'Control commands support text only; please remove images and try again.',
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export default {
|
|||
'停止当前任务': 'Stop the current task',
|
||||
'纠偏当前任务': 'Steer the current task',
|
||||
'检查连接状态': 'Check connection status',
|
||||
'查看插件版本': 'Show plugin version',
|
||||
'显示帮助': 'Show help',
|
||||
'该 Telegram 机器人已配置 Webhook,请先在原服务中移除 Webhook 后重试。':
|
||||
'This Telegram bot already has a Webhook configured. Remove the Webhook from the original service and try again.',
|
||||
|
|
|
|||
|
|
@ -494,6 +494,7 @@ export class TextHarnessBridge {
|
|||
t('/send 提交当前批次'),
|
||||
t('/cancel 取消当前批次'),
|
||||
t('/status 检查连接状态'),
|
||||
t('/version 查看插件版本'),
|
||||
t('/help 显示本帮助'),
|
||||
].join('\n'));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ export const TELEGRAM_COMMAND_MENU = Object.freeze([
|
|||
{ command: 'send', description: '提交当前批次' },
|
||||
{ command: 'cancel', description: '取消当前批次' },
|
||||
{ command: 'status', description: '检查连接状态' },
|
||||
{ command: 'version', description: '查看插件版本' },
|
||||
{ command: 'help', description: '显示帮助' },
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ function helpText() {
|
|||
t('/send 提交当前批次'),
|
||||
t('/cancel 取消当前批次'),
|
||||
t('/status 检查连接状态'),
|
||||
t('/version 查看插件版本'),
|
||||
t('/help 显示本帮助'),
|
||||
].join('\n');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ const HELP_TEXT = () => [
|
|||
t('/send 提交当前批次'),
|
||||
t('/cancel 取消当前批次'),
|
||||
t('/status 检查连接状态'),
|
||||
t('/version 查看插件版本'),
|
||||
t('/help 显示本帮助'),
|
||||
].join('\n');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue