mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
fix: gemini system cannot be empty
This commit is contained in:
parent
bbba9bc872
commit
e224272012
1 changed files with 7 additions and 5 deletions
|
|
@ -169,11 +169,6 @@ export class CustomGoogleGeminiClient extends GoogleGeminiClient {
|
|||
* @type Array<Content>
|
||||
*/
|
||||
contents: history,
|
||||
system_instruction: {
|
||||
parts: {
|
||||
text: systemMessage
|
||||
}
|
||||
},
|
||||
safetySettings: [
|
||||
{
|
||||
category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
|
||||
|
|
@ -204,6 +199,13 @@ export class CustomGoogleGeminiClient extends GoogleGeminiClient {
|
|||
},
|
||||
tools: []
|
||||
}
|
||||
if (systemMessage) {
|
||||
body.system_instruction = {
|
||||
parts: {
|
||||
text: systemMessage
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.tools?.length > 0) {
|
||||
body.tools.push({
|
||||
function_declarations: this.tools.map(tool => tool.function())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue