koishi-plugin-chatluna-google-gemini-adapter 1.2.9 → 1.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.cjs CHANGED
@@ -184,12 +184,18 @@ function extractSystemMessages(messages) {
184
184
  messages.indexOf(lastSystemMessage)
185
185
  );
186
186
  return [
187
- systemMessages.reduce((acc, cur) => {
188
- acc.push(...cur.parts);
189
- return acc;
190
- }, []).map((part) => {
191
- return partAsType(part).text;
192
- }).join("\n\n\n"),
187
+ {
188
+ parts: [
189
+ {
190
+ text: systemMessages.reduce((acc, cur) => {
191
+ acc.push(...cur.parts);
192
+ return acc;
193
+ }, []).map((part) => {
194
+ return partAsType(part).text;
195
+ }).join("\n\n\n")
196
+ }
197
+ ]
198
+ },
193
199
  messages.slice(messages.indexOf(lastSystemMessage))
194
200
  ];
195
201
  }
package/lib/index.mjs CHANGED
@@ -167,12 +167,18 @@ function extractSystemMessages(messages) {
167
167
  messages.indexOf(lastSystemMessage)
168
168
  );
169
169
  return [
170
- systemMessages.reduce((acc, cur) => {
171
- acc.push(...cur.parts);
172
- return acc;
173
- }, []).map((part) => {
174
- return partAsType(part).text;
175
- }).join("\n\n\n"),
170
+ {
171
+ parts: [
172
+ {
173
+ text: systemMessages.reduce((acc, cur) => {
174
+ acc.push(...cur.parts);
175
+ return acc;
176
+ }, []).map((part) => {
177
+ return partAsType(part).text;
178
+ }).join("\n\n\n")
179
+ }
180
+ ]
181
+ },
176
182
  messages.slice(messages.indexOf(lastSystemMessage))
177
183
  ];
178
184
  }
package/lib/utils.d.ts CHANGED
@@ -3,7 +3,10 @@ import { StructuredTool } from '@langchain/core/tools';
3
3
  import { ChatCompletionFunction, ChatCompletionResponseMessage, ChatCompletionResponseMessageRoleEnum, ChatPart } from './types';
4
4
  import { Config } from '.';
5
5
  export declare function langchainMessageToGeminiMessage(messages: BaseMessage[], model?: string): Promise<ChatCompletionResponseMessage[]>;
6
- export declare function extractSystemMessages(messages: ChatCompletionResponseMessage[]): [string, ChatCompletionResponseMessage[]];
6
+ export declare function extractSystemMessages(messages: ChatCompletionResponseMessage[]): [
7
+ Omit<ChatCompletionResponseMessage, 'role'>,
8
+ ChatCompletionResponseMessage[]
9
+ ];
7
10
  export declare function partAsType<T extends ChatPart>(part: ChatPart): T;
8
11
  export declare function partAsTypeCheck<T extends ChatPart>(part: ChatPart, check: (part: ChatPart & unknown) => boolean): T | undefined;
9
12
  export declare function formatToolsToGeminiAITools(tools: StructuredTool[], config: Config, model: string): Record<string, any>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-chatluna-google-gemini-adapter",
3
3
  "description": "google-gemini adapter for chatluna",
4
- "version": "1.2.9",
4
+ "version": "1.2.10",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.mjs",
7
7
  "typings": "lib/index.d.ts",