koishi-plugin-chatluna-google-gemini-adapter 1.2.8 → 1.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.cjs +6 -7
- package/lib/index.mjs +6 -7
- package/lib/utils.d.ts +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -184,13 +184,12 @@ function extractSystemMessages(messages) {
|
|
|
184
184
|
messages.indexOf(lastSystemMessage)
|
|
185
185
|
);
|
|
186
186
|
return [
|
|
187
|
-
{
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
},
|
|
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"),
|
|
194
193
|
messages.slice(messages.indexOf(lastSystemMessage))
|
|
195
194
|
];
|
|
196
195
|
}
|
package/lib/index.mjs
CHANGED
|
@@ -167,13 +167,12 @@ function extractSystemMessages(messages) {
|
|
|
167
167
|
messages.indexOf(lastSystemMessage)
|
|
168
168
|
);
|
|
169
169
|
return [
|
|
170
|
-
{
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
},
|
|
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"),
|
|
177
176
|
messages.slice(messages.indexOf(lastSystemMessage))
|
|
178
177
|
];
|
|
179
178
|
}
|
package/lib/utils.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ 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[]): [
|
|
6
|
+
export declare function extractSystemMessages(messages: ChatCompletionResponseMessage[]): [string, ChatCompletionResponseMessage[]];
|
|
7
7
|
export declare function partAsType<T extends ChatPart>(part: ChatPart): T;
|
|
8
8
|
export declare function partAsTypeCheck<T extends ChatPart>(part: ChatPart, check: (part: ChatPart & unknown) => boolean): T | undefined;
|
|
9
9
|
export declare function formatToolsToGeminiAITools(tools: StructuredTool[], config: Config, model: string): Record<string, any>;
|
package/package.json
CHANGED