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

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
@@ -10,6 +10,11 @@ export interface StyleConfig {
10
10
  commandName: string;
11
11
  prompt: string;
12
12
  }
13
+ export interface StyleGroupConfig {
14
+ typeName: string;
15
+ typeDescription?: string;
16
+ prompts: StyleConfig[];
17
+ }
13
18
  export interface UserData {
14
19
  userId: string;
15
20
  userName: string;
@@ -41,6 +46,7 @@ export interface Config {
41
46
  rateLimitMax: number;
42
47
  adminUsers: string[];
43
48
  styles: StyleConfig[];
49
+ styleGroups?: StyleGroupConfig[];
44
50
  logLevel: 'info' | 'debug';
45
51
  }
46
52
  export interface RechargeRecord {
package/lib/index.js CHANGED
@@ -604,6 +604,10 @@ var COMMANDS = {
604
604
  RECHARGE_HISTORY: "图像充值记录",
605
605
  FUNCTION_LIST: "图像功能"
606
606
  };
607
+ var StyleItemSchema = import_koishi.Schema.object({
608
+ commandName: import_koishi.Schema.string().required().description("命令名称(不含前缀斜杠)"),
609
+ prompt: import_koishi.Schema.string().role("textarea", { rows: 4 }).required().description("生成 prompt")
610
+ });
607
611
  var Config = import_koishi.Schema.intersect([
608
612
  import_koishi.Schema.object({
609
613
  provider: import_koishi.Schema.union([
@@ -641,10 +645,7 @@ var Config = import_koishi.Schema.intersect([
641
645
  }),
642
646
  // 自定义风格命令配置
643
647
  import_koishi.Schema.object({
644
- styles: import_koishi.Schema.array(import_koishi.Schema.object({
645
- commandName: import_koishi.Schema.string().required().description("命令名称(不含前缀斜杠)"),
646
- prompt: import_koishi.Schema.string().role("textarea", { rows: 4 }).required().description("生成 prompt")
647
- })).role("table").default([
648
+ styles: import_koishi.Schema.array(StyleItemSchema).role("table").default([
648
649
  {
649
650
  commandName: "变手办",
650
651
  prompt: "将这张照片变成手办模型。在它后面放置一个印有图像主体的盒子,桌子上有一台电脑显示Blender建模过程。在盒子前面添加一个圆形塑料底座,角色手办站在上面。如果可能的话,将场景设置在室内"
@@ -652,24 +653,15 @@ var Config = import_koishi.Schema.intersect([
652
653
  {
653
654
  commandName: "变写实",
654
655
  prompt: "请根据用户提供的图片,在严格保持主体身份、外观特征与姿态不变的前提下,生成一张照片级真实感的超写实摄影作品。要求:1. 采用专业相机拍摄(如佳能EOS R5),使用85mm f/1.4人像镜头,呈现柯达Portra 400胶片质感,8K超高清画质,HDR高动态范围,电影级打光效果;2. 画面应具有照片级真实感、超现实主义风格和高细节表现,确保光影、皮肤质感、服饰纹理与背景环境都贴近真实世界;3. 使用自然光影营造真实氛围,呈现raw and natural的原始自然感,具有authentic film snapshot的真实胶片质感;4. 整体需具备tactile feel触感质感和simulated texture模拟纹理细节,可以适度优化噪点与瑕疵,但不要改变主体特征或添加额外元素;5. 整体效果需像专业摄影棚拍摄的真实照片,具有电影级画质;6. 如果主体是人物脸部,脸部生成效果应参考欧美混血白人精致美丽帅气英俊的外观特征进行生成,保持精致立体的五官轮廓、健康光泽的肌肤质感、优雅的气质和自然的表情,确保面部特征协调美观。"
655
- },
656
- {
657
- commandName: "生成设定",
658
- prompt: "请根据用户提供的图片,智能识别图像主体的类型(人物角色、道具物品、载具、建筑、生物等),然后自动生成相应的完整设定方案。要求:1. 首先分析并识别主体的类型和特征;2. 严格遵循原图的艺术风格和细节度,保持与原图一致的视觉风格(如二次元、写实、手绘、3D渲染等)和细节表现水平;3. 去除原图中包含的所有光照信息,包括阴影、高光、明暗对比等,使用均匀、无方向性的平光或标准设定图光照,确保设定图呈现清晰、无光影干扰的展示效果;4. 如果主体是人物角色,生成角色设定(Character Design),包括:比例设定(不同身高对比、头身比等)、三视图(正面、侧面、背面)、表情设定(Expression Sheet)、动作设定(Pose Sheet - 各种常见姿势)、服装设定(Costume Design);5. 如果主体是道具、武器、载具或物品,生成道具设定(Prop/Item Design),包括:功能结构图(Functional Components)、状态变化展示(State Variations)、细节特写(Detail Close-ups);6. 如果主体是建筑或场景,生成建筑/场景设定,包括:结构图、不同角度视图、细节展示;7. 如果主体是生物(非人类),生成生物设定,包括:形态特征、不同姿态、细节展示;8. 根据主体的实际类型,智能选择最合适的设定内容,确保生成的设定方案完整、专业且符合该类型的设计规范。"
659
- },
660
- {
661
- commandName: "改姿势",
662
- prompt: "请根据用户提供的图片,在严格保持主体身份、外观特征、服装细节、艺术风格和整体氛围不变的前提下,生成一个新的姿势造型。新姿势应该更加帅气、可爱、有张力或符合主体内容的动态感,展现出更好的视觉表现力。要求:1. 完全保持主体的面部特征、发型、服装、配饰等所有细节不变;2. 完全保持原有的艺术风格(如二次元、写实、手绘等)不变;3. 只改变身体的姿势、动作和姿态,让主体看起来更有活力和表现力;4. 姿势应该自然、协调,符合主体的身份和性格特征;5. 保持背景环境的基本风格不变(可以适当调整视角或构图)。"
663
- },
664
- {
665
- commandName: "修改设计",
666
- prompt: "请根据用户提供的图片,在严格保持原有设计语言、视觉风格、功能特征和整体主题不变的前提下,对图像主体的结构设计进行修改。要求:1. 完全保持原有的设计语言和视觉风格(如现代简约、复古、科幻、奇幻等)不变;2. 保持主体的核心功能特征和身份定位不变;3. 可以合理且美观地添加、删改或修改结构元素(如装饰细节、功能组件、线条轮廓、比例关系等),使设计更加完善和美观;4. 所有修改必须符合原有主题的视觉风格,增强设计美感而不破坏原有设计语言;5. 修改后的设计应该更加协调、统一,具有更好的视觉层次和设计完整性;6. 保持色彩方案、材质质感和整体氛围的一致性。"
667
- },
668
- {
669
- commandName: "变像素",
670
- prompt: "请根据用户提供的图片,将图像主体转换为经典的8位像素艺术风格。要求:1. 完全保持主体的身份、外观特征和核心识别元素不变,确保转换后仍然清晰可识别;2. 采用极简的8位像素风格,使用有限的复古调色板(通常为16-256色),营造经典街机游戏的美学氛围;3. 所有细节都进行像素化处理,使用清晰的像素块和锐利的边缘,避免平滑渐变;4. 采用干净的块状形式,保持简单、标志性的设计,突出主体的核心特征;5. 背景可以简化为纯色背景(如纯白或纯黑),或者保持简单的像素化背景,确保主体突出;6. 整体风格应具有强烈的复古游戏感,让人联想到经典街机游戏和早期电子游戏的视觉美学;7. 保持主体的比例和基本结构,但用像素块重新诠释所有细节。"
671
656
  }
672
657
  ]).description("自定义风格命令配置")
658
+ }),
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("可选:类型说明"),
663
+ prompts: import_koishi.Schema.array(StyleItemSchema).role("table").default([]).description("属于该类型的 prompt 列表")
664
+ })).role("table").default([]).description("按类型管理的 prompt 组,保存时将自动展开为 styles")
673
665
  })
674
666
  ]);
675
667
  function apply(ctx, config) {
@@ -812,11 +804,41 @@ function apply(ctx, config) {
812
804
  return modifiers;
813
805
  }
814
806
  __name(parseStyleCommandModifiers, "parseStyleCommandModifiers");
807
+ const styleDefinitions = collectStyleDefinitions();
808
+ function collectStyleDefinitions() {
809
+ const unique = /* @__PURE__ */ new Map();
810
+ const pushStyle = /* @__PURE__ */ __name((style, groupName) => {
811
+ if (!style?.commandName || !style?.prompt) return;
812
+ if (unique.has(style.commandName)) {
813
+ logger.warn("检测到重复的风格命令名称,已跳过", { commandName: style.commandName, groupName });
814
+ return;
815
+ }
816
+ unique.set(style.commandName, {
817
+ ...style,
818
+ groupName
819
+ });
820
+ }, "pushStyle");
821
+ if (Array.isArray(config.styles)) {
822
+ for (const style of config.styles) {
823
+ pushStyle(style);
824
+ }
825
+ }
826
+ if (Array.isArray(config.styleGroups)) {
827
+ for (const group of config.styleGroups) {
828
+ if (!group?.typeName || !Array.isArray(group.prompts)) continue;
829
+ for (const style of group.prompts) {
830
+ pushStyle(style, group.typeName);
831
+ }
832
+ }
833
+ }
834
+ return Array.from(unique.values());
835
+ }
836
+ __name(collectStyleDefinitions, "collectStyleDefinitions");
815
837
  function getStyleCommands() {
816
- if (!config.styles || !Array.isArray(config.styles)) return [];
817
- return config.styles.filter((style) => style.commandName && style.prompt).map((style) => ({
838
+ if (!styleDefinitions.length) return [];
839
+ return styleDefinitions.filter((style) => style.commandName && style.prompt).map((style) => ({
818
840
  name: style.commandName,
819
- description: "图像风格转换"
841
+ description: style.groupName ? `图像风格转换(${style.groupName})` : "图像风格转换"
820
842
  }));
821
843
  }
822
844
  __name(getStyleCommands, "getStyleCommands");
@@ -1202,8 +1224,8 @@ ${infoParts.join("\n")}`;
1202
1224
  }
1203
1225
  }
1204
1226
  __name(processImage, "processImage");
1205
- if (config.styles && Array.isArray(config.styles)) {
1206
- for (const style of config.styles) {
1227
+ if (styleDefinitions.length > 0) {
1228
+ for (const style of styleDefinitions) {
1207
1229
  if (style.commandName && style.prompt) {
1208
1230
  ctx.command(`${style.commandName} [img:text]`, "图像风格转换").option("num", "-n <num:number> 生成图片数量 (1-4)").action(async (argv, img) => {
1209
1231
  const { session, options } = argv;
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.7",
4
+ "version": "0.2.9",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [