koishi-plugin-ai-puzzle 0.1.2 → 0.1.3
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/batch.d.ts +2 -0
- package/lib/index.js +8 -6
- package/package.json +1 -1
package/lib/batch.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export declare class BatchManager {
|
|
|
21
21
|
getPendingNames(channelId: string): string[];
|
|
22
22
|
consumeReserve(channelId: string): PuzzleData | null;
|
|
23
23
|
clearReserve(channelId: string): void;
|
|
24
|
+
/** 清除频道所有批量相关数据(切换模板时调用) */
|
|
25
|
+
clearAll(channelId: string): void;
|
|
24
26
|
batchGenerate(channelId: string, count: number, keyword: string, onProgress?: (msg: string) => void): Promise<{
|
|
25
27
|
names: string[];
|
|
26
28
|
puzzles: PuzzleData[];
|
package/lib/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var require_package = __commonJS({
|
|
|
36
36
|
module2.exports = {
|
|
37
37
|
name: "koishi-plugin-ai-puzzle",
|
|
38
38
|
description: "使用AI生成猜谜谜题,支持多模式游戏、模糊匹配、图片渲染",
|
|
39
|
-
version: "0.1.
|
|
39
|
+
version: "0.1.3",
|
|
40
40
|
main: "lib/index.js",
|
|
41
41
|
typings: "lib/index.d.ts",
|
|
42
42
|
files: [
|
|
@@ -768,6 +768,12 @@ var BatchManager = class {
|
|
|
768
768
|
clearReserve(channelId) {
|
|
769
769
|
this.reservePool.delete(channelId);
|
|
770
770
|
}
|
|
771
|
+
/** 清除频道所有批量相关数据(切换模板时调用) */
|
|
772
|
+
clearAll(channelId) {
|
|
773
|
+
this.reservePool.delete(channelId);
|
|
774
|
+
this.batchStatus.delete(channelId);
|
|
775
|
+
this.pendingNames.delete(channelId);
|
|
776
|
+
}
|
|
771
777
|
async batchGenerate(channelId, count, keyword, onProgress) {
|
|
772
778
|
const send = /* @__PURE__ */ __name((msg) => {
|
|
773
779
|
if (onProgress) onProgress(msg);
|
|
@@ -1038,12 +1044,8 @@ var GameOrchestrator = class {
|
|
|
1038
1044
|
state.preGenerated = null;
|
|
1039
1045
|
this.stateManager.saveModeConfig(channelId).catch(() => {
|
|
1040
1046
|
});
|
|
1047
|
+
this.batchManager.clearAll(channelId);
|
|
1041
1048
|
this.logger.info("[Game] switchTemplate: channel=%s, 模板=%s", channelId, keyword);
|
|
1042
|
-
if (state.preMode) {
|
|
1043
|
-
this.preGenerate(channelId).catch((e) => {
|
|
1044
|
-
this.logger.error("switchTemplate preGenerate failed:", e);
|
|
1045
|
-
});
|
|
1046
|
-
}
|
|
1047
1049
|
return `已切换提示词模板为:${keyword}`;
|
|
1048
1050
|
}
|
|
1049
1051
|
/** 切换模式(通用) */
|