koishi-plugin-image-prompt 2.0.0 → 2.0.1

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 CHANGED
@@ -1519,6 +1519,7 @@ function apply(ctx, config) {
1519
1519
  await bot.sendMessage(channelId, body, guildId);
1520
1520
  }
1521
1521
  const agentHistories = /* @__PURE__ */ new Map();
1522
+ let agentUrlWarned = false;
1522
1523
  function agentHistoryKey(session) {
1523
1524
  return `${session.platform}:${session.channelId || session.userId || ""}`;
1524
1525
  }
@@ -1802,6 +1803,10 @@ Negative prompt: ${String(args.negative_prompt).trim()}` : prompt;
1802
1803
  const model = agentCfg.model || selector.model || "Qwen/Qwen2.5-7B-Instruct";
1803
1804
  const url = agentCfg.baseUrl || selector.baseUrl || config.baseUrl;
1804
1805
  const apiKey = agentCfg.apiKey || selector.apiKey || config.apiKey;
1806
+ if (!agentCfg.baseUrl && !selector.baseUrl && !agentUrlWarned) {
1807
+ agentUrlWarned = true;
1808
+ ctx.logger.warn("Agent \u7528\u7684\u662F\u7ED8\u56FE\u63A5\u53E3\u5730\u5740\uFF08\u300CAI \u6A21\u578B\u63A5\u53E3 \u2192 \u5BF9\u8BDD\u63A5\u53E3\u5730\u5740\u300D\u7559\u7A7A\u4E86\uFF09\u3002\u7ED8\u56FE\u6A21\u578B\u4E0D\u4F1A\u804A\u5929\u4E5F\u4E0D\u4F1A\u8C03\u5DE5\u5177\uFF0C\u8BF7\u5728\u300CAI \u6A21\u578B\u63A5\u53E3\u300D\u6216\u300CAgent \u914D\u7F6E\u300D\u91CC\u5355\u72EC\u586B\u4E00\u4E2A\u652F\u6301\u5DE5\u5177\u8C03\u7528\u7684\u5BF9\u8BDD\u6A21\u578B\u5730\u5740");
1809
+ }
1805
1810
  const timeout = (agentCfg.timeout || selector.timeout || 60) * 1e3;
1806
1811
  const temperature = typeof agentCfg.temperature === "number" ? agentCfg.temperature : typeof selector.temperature === "number" ? selector.temperature : 0.3;
1807
1812
  const maxTokens = typeof agentCfg.maxTokens === "number" ? agentCfg.maxTokens : 8e3;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-image-prompt",
3
3
  "description": "多功能 AI 图像处理插件:Agent 模式把「查不查图库 / 要不要追问 / 什么时候开画」全交给模型自己决定,支持手办化、Coser 化、Minecraft 化等 47 种风格与自定义提示词",
4
- "version": "2.0.0",
4
+ "version": "2.0.1",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
package/src/index.ts CHANGED
@@ -1977,6 +1977,8 @@ export function apply(ctx: Context, config: CommandConfig) {
1977
1977
 
1978
1978
  // 每个频道最近几轮的对话(agent 记忆,只存纯文本,重启即失效)
1979
1979
  const agentHistories = new Map<string, any[]>()
1980
+ /** 「agent 接口地址没单独配」这条警告只打一次,别刷屏 */
1981
+ let agentUrlWarned = false
1980
1982
 
1981
1983
  function agentHistoryKey(session: Session): string {
1982
1984
  return `${session.platform}:${session.channelId || session.userId || ''}`
@@ -2348,6 +2350,12 @@ export function apply(ctx: Context, config: CommandConfig) {
2348
2350
  const model = agentCfg.model || selector.model || 'Qwen/Qwen2.5-7B-Instruct'
2349
2351
  const url = agentCfg.baseUrl || selector.baseUrl || config.baseUrl
2350
2352
  const apiKey = agentCfg.apiKey || selector.apiKey || config.apiKey
2353
+ // agent 要用的是**对话**模型。接口地址一个都没填时会落到绘图接口上,
2354
+ // 而绘图模型(gpt-image 之类)根本不会聊天/调工具,这里提前说清楚。
2355
+ if (!agentCfg.baseUrl && !selector.baseUrl && !agentUrlWarned) {
2356
+ agentUrlWarned = true
2357
+ ctx.logger.warn('Agent 用的是绘图接口地址(「AI 模型接口 → 对话接口地址」留空了)。绘图模型不会聊天也不会调工具,请在「AI 模型接口」或「Agent 配置」里单独填一个支持工具调用的对话模型地址')
2358
+ }
2351
2359
  const timeout = (agentCfg.timeout || selector.timeout || 60) * 1000
2352
2360
  const temperature = typeof agentCfg.temperature === 'number'
2353
2361
  ? agentCfg.temperature