oh-my-im 0.1.17 → 0.1.18
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/dist/bot-app.js +4 -1
- package/dist/group-worker.js +2 -13
- package/package.json +1 -1
package/dist/bot-app.js
CHANGED
|
@@ -691,7 +691,10 @@ export async function runApp(configOverride, options = {}) {
|
|
|
691
691
|
}
|
|
692
692
|
prompt = await buildCodexPrompt(bot, message, state.selectedSessions[agent]?.cwd ?? state.defaultWorkDir);
|
|
693
693
|
const selectedSession = state.selectedSessions[agent];
|
|
694
|
-
|
|
694
|
+
// Carry the per-conversation Agent and model selection into execution.
|
|
695
|
+
// Using the startup config here can leak the default agent's model into
|
|
696
|
+
// a private conversation after the user switches Agent.
|
|
697
|
+
const agentConfig = { ...currentConfig, codexWorkDir: selectedSession?.cwd ?? state.defaultWorkDir };
|
|
695
698
|
const result = await runAgent(agent, prompt, state.sessions[agent], agentConfig, {
|
|
696
699
|
onAbortReady: (abort) => { state.abort = abort; },
|
|
697
700
|
onSteerReady: (steer) => {
|
package/dist/group-worker.js
CHANGED
|
@@ -11,18 +11,9 @@ import { normalizeAgentModel, } from "./dws-dashboard.js";
|
|
|
11
11
|
import { dwsPath, listConversations, getCurrentDwsUser, listGroupBots, addBotToGroup, listGroupMembers, searchBots, startGroupEventStream, } from "./dws-client.js";
|
|
12
12
|
import { createLogger } from "./logger.js";
|
|
13
13
|
import { sendRobotGroupText, sendRobotWebhookText } from "./dingtalk-robot.js";
|
|
14
|
-
import { runDwsJson } from "./dws-client.js";
|
|
15
14
|
import { appendConversationLog } from "./conversation-log.js";
|
|
16
15
|
import { startPersonalHistoryPolling } from "./dws-history.js";
|
|
17
16
|
const log = createLogger("group-worker");
|
|
18
|
-
async function sendDwsFallbackText(openConversationId, content) {
|
|
19
|
-
// DWS message sending must target the exact openConversationId from the
|
|
20
|
-
// incoming group event. Do not use a group name or the configured target's
|
|
21
|
-
// display value here.
|
|
22
|
-
const result = await runDwsJson(["chat", "message", "send", "--conversation-id", openConversationId, "--text", content, "--yes"]);
|
|
23
|
-
if (result.success === false || (result.failedCount ?? 0) > 0)
|
|
24
|
-
throw new Error("DWS 失败原因通知发送失败");
|
|
25
|
-
}
|
|
26
17
|
function notifyGroupFailure(groupId, context, err, config) {
|
|
27
18
|
const reason = err instanceof Error ? err.message : String(err);
|
|
28
19
|
const message = `AI 处理失败:${context}\n群:${groupId}\n失败原因:${reason.slice(0, 1_500)}`;
|
|
@@ -1332,8 +1323,7 @@ function startGroupListener(seen, queues, cardState, sessions, cardClient, getDa
|
|
|
1332
1323
|
if (!currentConfig.clientId.trim()) {
|
|
1333
1324
|
const reason = "未配置钉钉应用 Client ID,无法确定要加入群的机器人";
|
|
1334
1325
|
log.warn(`ignored monitor open because client ID is missing group=${groupId}`);
|
|
1335
|
-
|
|
1336
|
-
.catch((notifyErr) => log.error(`DWS failure notification failed group=${groupId}: ${String(notifyErr)}`));
|
|
1326
|
+
log.warn(`AI capability open failed group=${groupId}: ${reason}; configure Client ID in the Web console or manually add robot=${currentConfig.robotName}`);
|
|
1337
1327
|
return;
|
|
1338
1328
|
}
|
|
1339
1329
|
const robotCode = currentConfig.clientId.trim();
|
|
@@ -1363,8 +1353,7 @@ function startGroupListener(seen, queues, cardState, sessions, cardClient, getDa
|
|
|
1363
1353
|
const guidance = /permission|denied|权限|forbidden|unauthorized/i.test(reason)
|
|
1364
1354
|
? "当前 DWS 登录账号可能没有加机器人进群权限,请让群主/群管理员手动将配置机器人加入本群后,再重新发送打开指令。"
|
|
1365
1355
|
: "请确认 Client ID 和机器人配置是否正确;如果自动加入失败,请让群主/群管理员手动将配置机器人加入本群后,再重新发送打开指令。";
|
|
1366
|
-
|
|
1367
|
-
.catch((notifyErr) => log.error(`DWS failure notification failed group=${groupId}: ${String(notifyErr)}`));
|
|
1356
|
+
log.error(`AI capability open failed group=${groupId}: ${reason}; ${guidance}`);
|
|
1368
1357
|
return;
|
|
1369
1358
|
}
|
|
1370
1359
|
}
|