koishi-plugin-cocoyyy-console 1.0.16-beta.6 → 1.0.16-beta.7
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/lib/index.js +9 -9
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1463,7 +1463,7 @@ async function callOpenRouter(api_url, api_key, api_model = "gpt-4o-mini", messa
|
|
|
1463
1463
|
const err = error;
|
|
1464
1464
|
const status = err.response?.status;
|
|
1465
1465
|
const detail = err.response?.data?.error || err.response?.data?.message || err.message;
|
|
1466
|
-
logger.error("[callOpenRouter Error]: OpenRouter 请求失败" +
|
|
1466
|
+
logger.error("[callOpenRouter Error]: OpenRouter 请求失败" + detail);
|
|
1467
1467
|
const errorMessage = `test error${status ? `(${status})` : ""}: ${detail}`;
|
|
1468
1468
|
return { err: errorMessage, resp: null };
|
|
1469
1469
|
}
|
|
@@ -1495,7 +1495,7 @@ async function checkShitOrNot(session, parttern_msg, config) {
|
|
|
1495
1495
|
chatHistory.push({ role: "user", content: [{ type: "text", text: parttern_msg }] });
|
|
1496
1496
|
const { err, resp } = await callOpenRouter(config.api_url, config.api_key, config.api_model, chatHistory);
|
|
1497
1497
|
if (err != null) {
|
|
1498
|
-
logger.error("[callOpenRouter
|
|
1498
|
+
logger.error("[callOpenRouter Error1]: " + err);
|
|
1499
1499
|
return null;
|
|
1500
1500
|
}
|
|
1501
1501
|
chatHistory.push({ role: "assistant", content: [{ type: "text", text: resp }] });
|
|
@@ -1510,12 +1510,12 @@ async function checkShitOrNot(session, parttern_msg, config) {
|
|
|
1510
1510
|
...imageUrls.map((url) => ({ type: "image_url", image_url: { url } }))
|
|
1511
1511
|
];
|
|
1512
1512
|
chatHistory.push({ role: "user", content: targetContent });
|
|
1513
|
-
const
|
|
1514
|
-
if (
|
|
1515
|
-
logger.error("[callOpenRouter
|
|
1513
|
+
const { err: err2, resp: resp2 } = await callOpenRouter(config.api_url, config.api_key, config.api_model, chatHistory);
|
|
1514
|
+
if (err2 != null) {
|
|
1515
|
+
logger.error("[callOpenRouter Error2]: " + err2);
|
|
1516
1516
|
return null;
|
|
1517
1517
|
}
|
|
1518
|
-
return
|
|
1518
|
+
return resp2;
|
|
1519
1519
|
}
|
|
1520
1520
|
__name(checkShitOrNot, "checkShitOrNot");
|
|
1521
1521
|
|
|
@@ -1571,12 +1571,12 @@ son判断模式列表:
|
|
|
1571
1571
|
});
|
|
1572
1572
|
ctx.command("son <参数>", "判定是否为史").action(async ({ session }, ...args) => {
|
|
1573
1573
|
if (!dev_mode) {
|
|
1574
|
-
if (!is_at_bot_quote(session)) return "
|
|
1574
|
+
if (!is_at_bot_quote(session)) return "请提供正确格式1,如: [引用消息] @bot son [判断模式]";
|
|
1575
1575
|
} else {
|
|
1576
|
-
if (!session.quote) return "
|
|
1576
|
+
if (!session.quote) return "请提供正确格式2,如: [引用消息] @bot son [判断模式]";
|
|
1577
1577
|
}
|
|
1578
1578
|
const parttern = args?.[0];
|
|
1579
|
-
if (!parttern) return "
|
|
1579
|
+
if (!parttern) return "请提供正确格式3,如: [引用消息] @bot son [判断模式]";
|
|
1580
1580
|
if (!local_config) return "未加载配置文件,请查看日志";
|
|
1581
1581
|
const parttern_msg = local_config.shit_or_not?.prompts[parttern];
|
|
1582
1582
|
if (!parttern_msg) return "未找到判断模式,请查看日志";
|