feat: 添加 :new 系统命令创建新会话
- Core: 新增 :new/:n 命令返回 new_session action - Server: 处理 new_session action 创建新会话 - UI: useChat 添加 onSessionSwitch 回调 - Web/Desktop: ChatPage 和 App 实现会话切换逻辑
This commit is contained in:
@@ -4,12 +4,14 @@
|
||||
|
||||
import type { SystemCommand } from '../types.js';
|
||||
import { clearCommand } from './clear.js';
|
||||
import { newCommand } from './new.js';
|
||||
|
||||
/**
|
||||
* 所有内置系统命令
|
||||
*/
|
||||
export const builtinSystemCommands: SystemCommand[] = [
|
||||
clearCommand,
|
||||
newCommand,
|
||||
];
|
||||
|
||||
export { clearCommand };
|
||||
export { clearCommand, newCommand };
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* :new 系统命令
|
||||
*
|
||||
* 创建新会话并切换到新会话
|
||||
*/
|
||||
|
||||
import type { SystemCommand } from '../types.js';
|
||||
|
||||
export const newCommand: SystemCommand = {
|
||||
name: 'new',
|
||||
description: '创建新会话并切换',
|
||||
aliases: ['n'],
|
||||
execute: async (_context) => {
|
||||
// 实际的创建操作由 Server 层处理
|
||||
// 这里只返回操作指令
|
||||
return {
|
||||
success: true,
|
||||
message: '正在创建新会话...',
|
||||
action: { type: 'new_session' },
|
||||
};
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user