koishi-plugin-aka-ai-generator 0.2.9 → 0.2.10

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.d.ts CHANGED
@@ -11,8 +11,6 @@ export interface StyleConfig {
11
11
  prompt: string;
12
12
  }
13
13
  export interface StyleGroupConfig {
14
- typeName: string;
15
- typeDescription?: string;
16
14
  prompts: StyleConfig[];
17
15
  }
18
16
  export interface UserData {
@@ -46,7 +44,7 @@ export interface Config {
46
44
  rateLimitMax: number;
47
45
  adminUsers: string[];
48
46
  styles: StyleConfig[];
49
- styleGroups?: StyleGroupConfig[];
47
+ styleGroups?: Record<string, StyleGroupConfig>;
50
48
  logLevel: 'info' | 'debug';
51
49
  }
52
50
  export interface RechargeRecord {
package/lib/index.js CHANGED
@@ -657,11 +657,9 @@ var Config = import_koishi.Schema.intersect([
657
657
  ]).description("自定义风格命令配置")
658
658
  }),
659
659
  import_koishi.Schema.object({
660
- styleGroups: import_koishi.Schema.array(import_koishi.Schema.object({
661
- typeName: import_koishi.Schema.string().required().description("类型名称,用于分组展示"),
662
- typeDescription: import_koishi.Schema.string().role("textarea", { rows: 2 }).description("可选:类型说明"),
660
+ styleGroups: import_koishi.Schema.dict(import_koishi.Schema.object({
663
661
  prompts: import_koishi.Schema.array(StyleItemSchema).role("table").default([]).description("属于该类型的 prompt 列表")
664
- })).role("table").default([]).description("按类型管理的 prompt 组,保存时将自动展开为 styles")
662
+ })).role("table").default({}).description("按类型管理的 prompt 组,键名即为分组名称")
665
663
  })
666
664
  ]);
667
665
  function apply(ctx, config) {
@@ -823,11 +821,11 @@ function apply(ctx, config) {
823
821
  pushStyle(style);
824
822
  }
825
823
  }
826
- if (Array.isArray(config.styleGroups)) {
827
- for (const group of config.styleGroups) {
828
- if (!group?.typeName || !Array.isArray(group.prompts)) continue;
824
+ if (config.styleGroups && typeof config.styleGroups === "object") {
825
+ for (const [groupName, group] of Object.entries(config.styleGroups)) {
826
+ if (!groupName || !group || !Array.isArray(group.prompts)) continue;
829
827
  for (const style of group.prompts) {
830
- pushStyle(style, group.typeName);
828
+ pushStyle(style, groupName);
831
829
  }
832
830
  }
833
831
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-aka-ai-generator",
3
3
  "description": "自用AI生成插件(GPTGod & Yunwu)",
4
- "version": "0.2.9",
4
+ "version": "0.2.10",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [