mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
fix: use system_instruction instead of user for gemini client
This commit is contained in:
parent
65bb1539e2
commit
acb9e76b0e
1 changed files with 25 additions and 20 deletions
|
|
@ -116,26 +116,26 @@ export class CustomGoogleGeminiClient extends GoogleGeminiClient {
|
|||
async sendMessage (text, opt = {}) {
|
||||
let history = await this.getHistory(opt.parentMessageId)
|
||||
let systemMessage = opt.system
|
||||
if (systemMessage) {
|
||||
history = history.reverse()
|
||||
history.push({
|
||||
role: 'model',
|
||||
parts: [
|
||||
{
|
||||
text: 'ok'
|
||||
}
|
||||
]
|
||||
})
|
||||
history.push({
|
||||
role: 'user',
|
||||
parts: [
|
||||
{
|
||||
text: systemMessage
|
||||
}
|
||||
]
|
||||
})
|
||||
history = history.reverse()
|
||||
}
|
||||
// if (systemMessage) {
|
||||
// history = history.reverse()
|
||||
// history.push({
|
||||
// role: 'model',
|
||||
// parts: [
|
||||
// {
|
||||
// text: 'ok'
|
||||
// }
|
||||
// ]
|
||||
// })
|
||||
// history.push({
|
||||
// role: 'user',
|
||||
// parts: [
|
||||
// {
|
||||
// text: systemMessage
|
||||
// }
|
||||
// ]
|
||||
// })
|
||||
// history = history.reverse()
|
||||
// }
|
||||
const idThis = crypto.randomUUID()
|
||||
const idModel = crypto.randomUUID()
|
||||
const thisMessage = opt.functionResponse
|
||||
|
|
@ -169,6 +169,11 @@ export class CustomGoogleGeminiClient extends GoogleGeminiClient {
|
|||
* @type Array<Content>
|
||||
*/
|
||||
contents: history,
|
||||
system_instruction: {
|
||||
parts: {
|
||||
text: systemMessage
|
||||
}
|
||||
},
|
||||
safetySettings: [
|
||||
{
|
||||
category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue