koishi-plugin-chatluna 1.2.1 → 1.3.0-alpha.0

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.cjs CHANGED
@@ -1291,8 +1291,8 @@ async function defaultFactory(ctx, service) {
1291
1291
  service.registerChatChain(
1292
1292
  "plugin",
1293
1293
  {
1294
- "zh-CN": "插件模式(基于 LangChain 的 Agent)",
1295
- "en-US": "Plugin mode (based on LangChain Agent)"
1294
+ "zh-CN": "Agent 模式",
1295
+ "en-US": "Agent mode"
1296
1296
  },
1297
1297
  async (params) => {
1298
1298
  return ChatLunaPluginChain.fromLLMAndTools(
@@ -6517,7 +6517,7 @@ var inject2 = {
6517
6517
  };
6518
6518
  var logger;
6519
6519
  var usage = `
6520
- ## chatluna v1.1
6520
+ ## chatluna v1.3 beta
6521
6521
 
6522
6522
  ChatLuna 插件交流 QQ 群:282381753 (有问题或出现 Bug 先加群问)
6523
6523
 
package/lib/index.d.ts CHANGED
@@ -20,5 +20,5 @@ export declare const inject2: {
20
20
  };
21
21
  };
22
22
  export declare let logger: Logger;
23
- export declare const usage = "\n## chatluna v1.1\n\nChatLuna \u63D2\u4EF6\u4EA4\u6D41 QQ \u7FA4\uFF1A282381753 \uFF08\u6709\u95EE\u9898\u6216\u51FA\u73B0 Bug \u5148\u52A0\u7FA4\u95EE\uFF09\n\n\u7FA4\u91CC\u76EE\u524D\u6CA1\u6709\u642D\u8F7D\u8BE5\u63D2\u4EF6\u7684 bot\uFF0C\u52A0\u7FA4\u7684\u8BDD\u6700\u597D\u662F\u6765\u8BE2\u95EE\u95EE\u9898\u6216\u8005\u63D0\u51FA\u610F\u89C1\u7684\u3002\n\n\u8BBF\u95EE [https://chatluna.chat](https://chatluna.chat) \u6765\u4E86\u89E3\u5982\u4F55\u4F7F\u7528 Chatluna\u3002\n\u4E5F\u53EF\u4EE5\u8BBF\u95EE [https://preset.chatluna.chat](https://preset.chatluna.chat) \u8FDB\u5165\u5728\u7EBF\u9884\u8BBE\u7F16\u8F91\u5668\u3002\u66F4\u6709\u9884\u8BBE\u5E7F\u573A\u6765\u6D4F\u89C8\u548C\u4E0B\u8F7D\u4F60\u5FC3\u4EEA\u7684\u9884\u8BBE\u3002\n";
23
+ export declare const usage = "\n## chatluna v1.3 beta\n\nChatLuna \u63D2\u4EF6\u4EA4\u6D41 QQ \u7FA4\uFF1A282381753 \uFF08\u6709\u95EE\u9898\u6216\u51FA\u73B0 Bug \u5148\u52A0\u7FA4\u95EE\uFF09\n\n\u7FA4\u91CC\u76EE\u524D\u6CA1\u6709\u642D\u8F7D\u8BE5\u63D2\u4EF6\u7684 bot\uFF0C\u52A0\u7FA4\u7684\u8BDD\u6700\u597D\u662F\u6765\u8BE2\u95EE\u95EE\u9898\u6216\u8005\u63D0\u51FA\u610F\u89C1\u7684\u3002\n\n\u8BBF\u95EE [https://chatluna.chat](https://chatluna.chat) \u6765\u4E86\u89E3\u5982\u4F55\u4F7F\u7528 Chatluna\u3002\n\u4E5F\u53EF\u4EE5\u8BBF\u95EE [https://preset.chatluna.chat](https://preset.chatluna.chat) \u8FDB\u5165\u5728\u7EBF\u9884\u8BBE\u7F16\u8F91\u5668\u3002\u66F4\u6709\u9884\u8BBE\u5E7F\u573A\u6765\u6D4F\u89C8\u548C\u4E0B\u8F7D\u4F60\u5FC3\u4EEA\u7684\u9884\u8BBE\u3002\n";
24
24
  export declare function apply(ctx: Context, config: Config): void;
package/lib/index.mjs CHANGED
@@ -1275,8 +1275,8 @@ async function defaultFactory(ctx, service) {
1275
1275
  service.registerChatChain(
1276
1276
  "plugin",
1277
1277
  {
1278
- "zh-CN": "插件模式(基于 LangChain 的 Agent)",
1279
- "en-US": "Plugin mode (based on LangChain Agent)"
1278
+ "zh-CN": "Agent 模式",
1279
+ "en-US": "Agent mode"
1280
1280
  },
1281
1281
  async (params) => {
1282
1282
  return ChatLunaPluginChain.fromLLMAndTools(
@@ -6524,7 +6524,7 @@ var inject2 = {
6524
6524
  };
6525
6525
  var logger;
6526
6526
  var usage = `
6527
- ## chatluna v1.1
6527
+ ## chatluna v1.3 beta
6528
6528
 
6529
6529
  ChatLuna 插件交流 QQ 群:282381753 (有问题或出现 Bug 先加群问)
6530
6530
 
@@ -22,4 +22,4 @@ export type CreateOpenAIAgentParams = {
22
22
  };
23
23
  export declare function createOpenAIAgent({ llm, tools, prompt }: CreateOpenAIAgentParams): RunnableSequence<{
24
24
  steps: AgentStep[];
25
- }, AgentAction | AgentFinish | AgentAction[]>;
25
+ }, AgentAction | AgentAction[] | AgentFinish>;
@@ -72,7 +72,7 @@ export type CreateReactAgentParams = {
72
72
  */
73
73
  export declare function createReactAgent({ llm, tools, prompt, streamRunnable, instructions }: CreateReactAgentParams): Promise<AgentRunnableSequence<{
74
74
  steps: AgentStep[];
75
- }, import("@langchain/core/agents").AgentFinish | import("@langchain/core/agents").AgentAction[]>>;
75
+ }, import("@langchain/core/agents").AgentAction[] | import("@langchain/core/agents").AgentFinish>>;
76
76
  /**
77
77
  * Construct the scratchpad that lets the agent continue its thought process.
78
78
  * @param intermediateSteps
package/lib/preset.cjs CHANGED
@@ -191,6 +191,12 @@ var PresetService = class {
191
191
  );
192
192
  }
193
193
  async addPreset(preset) {
194
+ if (this._presets.some(
195
+ (p) => p.triggerKeyword.join(",") === preset.triggerKeyword.join(",")
196
+ )) {
197
+ logger.warn(`preset ${preset.path} already exists`);
198
+ return;
199
+ }
194
200
  this._presets.push(preset);
195
201
  this._updateSchema();
196
202
  }
package/lib/preset.mjs CHANGED
@@ -164,6 +164,12 @@ var PresetService = class {
164
164
  );
165
165
  }
166
166
  async addPreset(preset) {
167
+ if (this._presets.some(
168
+ (p) => p.triggerKeyword.join(",") === preset.triggerKeyword.join(",")
169
+ )) {
170
+ logger.warn(`preset ${preset.path} already exists`);
171
+ return;
172
+ }
167
173
  this._presets.push(preset);
168
174
  this._updateSchema();
169
175
  }
@@ -742,10 +742,15 @@ Please consider this quote when generating your response. User's message: ${mess
742
742
  }
743
743
  if (quoteMessage.additional_kwargs["images"]) {
744
744
  const currentImages = message.additional_kwargs["images"] ?? [];
745
+ const currentImageHashs = message.additional_kwargs["imageHashs"] ?? [];
745
746
  message.additional_kwargs["images"] = [
746
747
  ...currentImages,
747
748
  ...quoteMessage.additional_kwargs["images"]
748
749
  ];
750
+ message.additional_kwargs["imageHashs"] = [
751
+ ...currentImageHashs,
752
+ ...quoteMessage.additional_kwargs["imageHashs"]
753
+ ];
749
754
  }
750
755
  }
751
756
  return message;
@@ -729,10 +729,15 @@ Please consider this quote when generating your response. User's message: ${mess
729
729
  }
730
730
  if (quoteMessage.additional_kwargs["images"]) {
731
731
  const currentImages = message.additional_kwargs["images"] ?? [];
732
+ const currentImageHashs = message.additional_kwargs["imageHashs"] ?? [];
732
733
  message.additional_kwargs["images"] = [
733
734
  ...currentImages,
734
735
  ...quoteMessage.additional_kwargs["images"]
735
736
  ];
737
+ message.additional_kwargs["imageHashs"] = [
738
+ ...currentImageHashs,
739
+ ...quoteMessage.additional_kwargs["imageHashs"]
740
+ ];
736
741
  }
737
742
  }
738
743
  return message;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-chatluna",
3
3
  "description": "chatluna for koishi",
4
- "version": "1.2.1",
4
+ "version": "1.3.0-alpha.0",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.mjs",
7
7
  "typings": "lib/index.d.ts",
@@ -5,7 +5,7 @@ keywords:
5
5
  prompts:
6
6
  - role: system
7
7
  content: |-
8
- You are ChatGPT, a large language model trained by OpenAI, based on the GPT-4 architecture.
8
+ You are ChatGPT, a large language model trained by OpenAI.
9
9
  Knowledge cutoff: 2024-06 Current date: {date}
10
10
 
11
11
  Structure your responses with iterative thinking: