Merge pull request #4 from ikechan8370/v2

up
This commit is contained in:
ycxom 2025-02-04 16:36:31 +08:00 committed by GitHub
commit 0d117dd557
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -184,11 +184,6 @@ export class CustomGoogleGeminiClient extends GoogleGeminiClient {
* @type Array<Content> * @type Array<Content>
*/ */
contents: history, contents: history,
system_instruction: {
parts: {
text: systemMessage
}
},
safetySettings: [ safetySettings: [
{ {
category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
@ -219,6 +214,13 @@ export class CustomGoogleGeminiClient extends GoogleGeminiClient {
}, },
tools: [] tools: []
} }
if (systemMessage) {
body.system_instruction = {
parts: {
text: systemMessage
}
}
}
if (this.tools?.length > 0) { if (this.tools?.length > 0) {
body.tools.push({ body.tools.push({
function_declarations: this.tools.map(tool => tool.function()) function_declarations: this.tools.map(tool => tool.function())