chatccc 0.2.98 → 0.2.99
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/package.json +1 -1
- package/src/orchestrator.ts +51 -28
package/package.json
CHANGED
package/src/orchestrator.ts
CHANGED
|
@@ -287,34 +287,6 @@ export async function handleCommand(
|
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
if (textLower === "/model") {
|
|
291
|
-
logTrace(tid, "BRANCH", { cmd: "/model" });
|
|
292
|
-
|
|
293
|
-
const defaultTool = resolveDefaultAgentTool();
|
|
294
|
-
const models = getAllModelsForTool(defaultTool);
|
|
295
|
-
let currentModel = "";
|
|
296
|
-
if (defaultTool === "cursor") currentModel = config.cursor.model;
|
|
297
|
-
else if (defaultTool === "codex") currentModel = config.codex.model;
|
|
298
|
-
else currentModel = CLAUDE_MODEL;
|
|
299
|
-
|
|
300
|
-
if (platform.kind === "wechat") {
|
|
301
|
-
const lines = [currentModel ? `当前模型 (${defaultTool}): ${currentModel}` : `当前模型 (${defaultTool}): 未指定`];
|
|
302
|
-
if (models.length > 0) {
|
|
303
|
-
lines.push("", "可切换模型:");
|
|
304
|
-
for (const m of models) lines.push(` ${m}`);
|
|
305
|
-
lines.push("", "在会话中输入 /model <模型名> 切换模型");
|
|
306
|
-
} else {
|
|
307
|
-
lines.push("", "没有可切换的模型。请在 config.json 中配置模型字段。");
|
|
308
|
-
}
|
|
309
|
-
await platform.sendText(chatId, lines.join("\n")).catch(() => {});
|
|
310
|
-
} else {
|
|
311
|
-
const card = buildModelCard(currentModel, models, defaultTool);
|
|
312
|
-
await platform.sendRawCard(chatId, card);
|
|
313
|
-
}
|
|
314
|
-
logTrace(tid, "DONE", { outcome: "model_query", defaultTool });
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
290
|
if (textLower === "/new" || textLower.startsWith("/new ")) {
|
|
319
291
|
const toolArg = text.slice(5).trim().toLowerCase();
|
|
320
292
|
const tool = toolArg || resolveDefaultAgentTool();
|
|
@@ -1082,6 +1054,30 @@ export async function handleCommand(
|
|
|
1082
1054
|
return;
|
|
1083
1055
|
}
|
|
1084
1056
|
|
|
1057
|
+
// /model — 查看当前会话的可用模型(根据会话 Agent 类型)
|
|
1058
|
+
if (textLower === "/model") {
|
|
1059
|
+
logTrace(tid, "BRANCH", { cmd: "/model", sessionId, tool: descriptionTool });
|
|
1060
|
+
const models = getAllModelsForTool(descriptionTool as AgentTool);
|
|
1061
|
+
const currentModel = getEffectiveModelForTool(descriptionTool, sessionId);
|
|
1062
|
+
|
|
1063
|
+
if (platform.kind === "wechat") {
|
|
1064
|
+
const lines = [currentModel ? `当前模型 (${toolLabel}): ${currentModel}` : `当前模型 (${toolLabel}): 未指定`];
|
|
1065
|
+
if (models.length > 0) {
|
|
1066
|
+
lines.push("", "可切换模型:");
|
|
1067
|
+
for (const m of models) lines.push(` ${m}`);
|
|
1068
|
+
lines.push("", "输入 /model <模型名> 切换模型");
|
|
1069
|
+
} else {
|
|
1070
|
+
lines.push("", "没有可切换的模型。请在 config.json 中配置模型字段。");
|
|
1071
|
+
}
|
|
1072
|
+
await platform.sendText(chatId, lines.join("\n")).catch(() => {});
|
|
1073
|
+
} else {
|
|
1074
|
+
const card = buildModelCard(currentModel, models, descriptionTool);
|
|
1075
|
+
await platform.sendRawCard(chatId, card);
|
|
1076
|
+
}
|
|
1077
|
+
logTrace(tid, "DONE", { outcome: "model_query", tool: descriptionTool });
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1085
1081
|
// /git <args>:在「当前会话工作目录」执行 git 命令
|
|
1086
1082
|
if (textLower.startsWith("/git ") || textLower === "/git") {
|
|
1087
1083
|
const args = text === "/git" ? "" : text.slice(5).trim();
|
|
@@ -1213,6 +1209,33 @@ export async function handleCommand(
|
|
|
1213
1209
|
return;
|
|
1214
1210
|
}
|
|
1215
1211
|
|
|
1212
|
+
// 无会话上下文 → 检查是否是 /model 查询
|
|
1213
|
+
if (textLower === "/model") {
|
|
1214
|
+
const defaultTool = resolveDefaultAgentTool();
|
|
1215
|
+
const models = getAllModelsForTool(defaultTool);
|
|
1216
|
+
let currentModel = "";
|
|
1217
|
+
if (defaultTool === "cursor") currentModel = config.cursor.model;
|
|
1218
|
+
else if (defaultTool === "codex") currentModel = config.codex.model;
|
|
1219
|
+
else currentModel = CLAUDE_MODEL;
|
|
1220
|
+
|
|
1221
|
+
if (platform.kind === "wechat") {
|
|
1222
|
+
const lines = [currentModel ? `当前模型 (${defaultTool}): ${currentModel}` : `当前模型 (${defaultTool}): 未指定`];
|
|
1223
|
+
if (models.length > 0) {
|
|
1224
|
+
lines.push("", "可切换模型:");
|
|
1225
|
+
for (const m of models) lines.push(` ${m}`);
|
|
1226
|
+
lines.push("", "在会话中输入 /model <模型名> 切换模型");
|
|
1227
|
+
} else {
|
|
1228
|
+
lines.push("", "没有可切换的模型。请在 config.json 中配置模型字段。");
|
|
1229
|
+
}
|
|
1230
|
+
await platform.sendText(chatId, lines.join("\n")).catch(() => {});
|
|
1231
|
+
} else {
|
|
1232
|
+
const card = buildModelCard(currentModel, models, defaultTool);
|
|
1233
|
+
await platform.sendRawCard(chatId, card);
|
|
1234
|
+
}
|
|
1235
|
+
logTrace(tid, "DONE", { outcome: "model_query", defaultTool });
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1216
1239
|
// 无会话上下文 → help card
|
|
1217
1240
|
logTrace(tid, "SEND", { method: "help_card", chatId });
|
|
1218
1241
|
const card = buildHelpCard(text, { defaultToolLabel: toolDisplayName(resolveDefaultAgentTool()) });
|