koishi-plugin-cocoyyy-console 1.1.0-beta.1 → 1.1.0-beta.2
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 +7 -3
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1519,6 +1519,9 @@ async function callOpenRouter(api_url, api_key, api_model = "gpt-4o-mini", messa
|
|
|
1519
1519
|
let err = null;
|
|
1520
1520
|
if (typeof reply === "string") {
|
|
1521
1521
|
responseText = reply.trim();
|
|
1522
|
+
if (!responseText) {
|
|
1523
|
+
err = "OpenRouter 返回空内容";
|
|
1524
|
+
}
|
|
1522
1525
|
} else if (Array.isArray(reply)) {
|
|
1523
1526
|
responseText = reply.map((part) => part?.text ?? "").join("").trim();
|
|
1524
1527
|
if (!responseText) {
|
|
@@ -2142,17 +2145,17 @@ function registerGameCommands(ctx, game_config, ai_config) {
|
|
|
2142
2145
|
return `[所有命令都需要@bot]
|
|
2143
2146
|
游戏列表:
|
|
2144
2147
|
${gameList.map((item) => item.command + ": " + item.name).join("\n ")}
|
|
2145
|
-
|
|
2148
|
+
输入@bot startgame [游戏]开始游戏,如果遇到问题请联系开发人员。`;
|
|
2146
2149
|
});
|
|
2147
2150
|
ctx.command("startgame <参数>", "开始游戏,参数为游戏名称").action(async ({ session }, ...args) => {
|
|
2148
2151
|
if (!dev_mode) {
|
|
2149
2152
|
if (!is_at_bot(session)) return;
|
|
2150
2153
|
}
|
|
2151
2154
|
const game = args?.[0];
|
|
2152
|
-
if (!game) return "请提供正确格式,如:@bot
|
|
2155
|
+
if (!game) return "请提供正确格式,如:@bot startgame [游戏]";
|
|
2153
2156
|
switch (game) {
|
|
2154
2157
|
case gameList[0].command:
|
|
2155
|
-
await session.send("
|
|
2158
|
+
await session.send("正在开始游戏...后续问答请参照格式:@bot [问题]");
|
|
2156
2159
|
const resp = await startSituationPuzzle(ai_config);
|
|
2157
2160
|
return checkResp(resp);
|
|
2158
2161
|
default:
|
|
@@ -2174,6 +2177,7 @@ function registerGameMiddleware(ctx, ai_config) {
|
|
|
2174
2177
|
const { content, uid, userId } = session;
|
|
2175
2178
|
if (ctx.bots[uid]) return next();
|
|
2176
2179
|
if (!is_at_bot(session)) return next();
|
|
2180
|
+
logger.info("[game middleware Info]: " + session.content);
|
|
2177
2181
|
const resp = await questSituationPuzzle(session.content, ai_config);
|
|
2178
2182
|
return checkResp(resp);
|
|
2179
2183
|
});
|