mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
fix: gemini mode text & FunctionCall
This commit is contained in:
parent
e6af4083c2
commit
1682b715fd
2 changed files with 14 additions and 3 deletions
|
|
@ -79,7 +79,8 @@ export class CustomGoogleGeminiClient extends GoogleGeminiClient {
|
|||
* maxOutputTokens: number?,
|
||||
* temperature: number?,
|
||||
* topP: number?,
|
||||
* tokK: number?
|
||||
* tokK: number?,
|
||||
* replyPureTextCallback: Function
|
||||
* }} opt
|
||||
* @returns {Promise<{conversationId: string?, parentMessageId: string, text: string, id: string}>}
|
||||
*/
|
||||
|
|
@ -200,9 +201,14 @@ export class CustomGoogleGeminiClient extends GoogleGeminiClient {
|
|||
console.log(JSON.stringify(response))
|
||||
}
|
||||
responseContent = response.candidates[0].content
|
||||
if (responseContent.parts[0].functionCall) {
|
||||
if (responseContent.parts.find(i => i.functionCall)) {
|
||||
// functionCall
|
||||
const functionCall = responseContent.parts[0].functionCall
|
||||
const functionCall = responseContent.parts.find(i => i.functionCall).functionCall
|
||||
const text = responseContent.parts.find(i => i.text).text
|
||||
if (text) {
|
||||
// send reply first
|
||||
opt.replyPureTextCallback && await opt.replyPureTextCallback(text)
|
||||
}
|
||||
// Gemini有时候只回复一个空的functionCall,无语死了
|
||||
if (functionCall.name) {
|
||||
logger.info(JSON.stringify(functionCall))
|
||||
|
|
|
|||
|
|
@ -824,6 +824,11 @@ class Core {
|
|||
system += 'If I ask you to generate music or write songs, you need to reply with information suitable for Suno to generate music. Please use keywords such as Verse, Chorus, Bridge, Outro, and End to segment the lyrics, such as [Verse 1], The returned message is in JSON format, with a structure of ```json{"option": "Suno", "tags": "style", "title": "title of the song", "lyrics": "lyrics"}```.'
|
||||
}
|
||||
option.system = system
|
||||
option.replyPureTextCallback = async (msg) => {
|
||||
if (msg) {
|
||||
await e.reply(msg, true)
|
||||
}
|
||||
}
|
||||
return await client.sendMessage(prompt, option)
|
||||
} else if (use === 'chatglm4') {
|
||||
const client = new ChatGLM4Client({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue