feat: PNG头像替换SVG + 支持/init命令

This commit is contained in:
cc-dan
2026-03-18 01:46:09 +00:00
parent 7ec87714c5
commit 41b7757c19
6 changed files with 112 additions and 92 deletions

View File

@@ -11,6 +11,7 @@
{ cmd: '/mode', desc: '查看/切换权限模式' },
{ cmd: '/cost', desc: '查看会话费用' },
{ cmd: '/compact', desc: '压缩上下文' },
{ cmd: '/init', desc: '生成/更新 CLAUDE.md' },
{ cmd: '/help', desc: '显示帮助' },
];

BIN
public/claude.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
public/codex.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -1021,10 +1021,10 @@ body.session-loading-active {
background: transparent;
border: none;
}
/* Codex avatar: GPT logo on green bg */
/* Codex avatar: transparent bg to match the supplied asset */
.msg.assistant.agent-codex .msg-avatar {
background: #10a37f;
color: #fff;
background: transparent;
border: none;
}
.msg-bubble {

View File

@@ -2055,6 +2055,25 @@ function handleSlashCommand(ws, text, sessionId, fallbackAgent) {
break;
}
case '/init': {
if (agent !== 'claude') {
wsSend(ws, { type: 'system_message', message: '/init 仅支持 ClaudeCodex 暂不支持该命令。' });
break;
}
if (!sessionId || !session) {
wsSend(ws, { type: 'system_message', message: '请先进入一个会话后再执行 /init。' });
break;
}
if (activeProcesses.has(sessionId)) {
wsSend(ws, { type: 'system_message', message: '当前会话正在处理中,请先等待完成或点击停止。' });
break;
}
wsSend(ws, { type: 'system_message', message: '正在分析项目并生成 CLAUDE.md ...' });
pendingSlashCommands.set(session.id, { kind: 'init' });
handleMessage(ws, { text: '/init', sessionId: session.id, mode: session.permissionMode || 'yolo' }, { hideInHistory: true });
break;
}
case '/mode': {
const modeInput = parts[1];
const VALID_MODES = ['default', 'plan', 'yolo'];
@@ -2088,7 +2107,7 @@ function handleSlashCommand(ws, text, sessionId, fallbackAgent) {
type: 'system_message',
message: agent === 'codex'
? base + '\n/model [名称] — 查看/切换 Codex 模型(自由输入)\n/compact — 执行 Codex /compact 压缩上下文'
: base + '\n/model [名称] — 查看/切换模型opus, sonnet, haiku\n/compact — 执行 Claude 原生上下文压缩(保留压缩计划并可自动续跑)',
: base + '\n/model [名称] — 查看/切换模型opus, sonnet, haiku\n/compact — 执行 Claude 原生上下文压缩(保留压缩计划并可自动续跑)\n/init — 分析项目并生成/更新 CLAUDE.md',
});
break;
}