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 +1 -3
- package/lib/index.js +6 -8
- package/package.json +1 -1
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.
|
|
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(
|
|
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 (
|
|
827
|
-
for (const group of config.styleGroups) {
|
|
828
|
-
if (!group
|
|
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,
|
|
828
|
+
pushStyle(style, groupName);
|
|
831
829
|
}
|
|
832
830
|
}
|
|
833
831
|
}
|