mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
添加后台对话模式选项
This commit is contained in:
parent
8efcce45a0
commit
554f6a69f3
3 changed files with 32 additions and 7 deletions
|
|
@ -832,7 +832,7 @@ export class chatgpt extends plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 处理suno生成
|
// 处理suno生成
|
||||||
if ((use === 'bing' || use === 'xh') && Config.enableChatSuno) {
|
if ((use === 'bing' || use === 'xh' || use === 'gemini') && Config.enableChatSuno) {
|
||||||
const sunoList = extractMarkdownJson(chatMessage.text)
|
const sunoList = extractMarkdownJson(chatMessage.text)
|
||||||
for (let suno of sunoList) {
|
for (let suno of sunoList) {
|
||||||
if (suno.json.option == 'Suno') {
|
if (suno.json.option == 'Suno') {
|
||||||
|
|
|
||||||
|
|
@ -645,6 +645,11 @@ class Core {
|
||||||
}
|
}
|
||||||
promptAddition && (prompt += promptAddition)
|
promptAddition && (prompt += promptAddition)
|
||||||
option.systemMessage = await handleSystem(e, opts.systemMessage)
|
option.systemMessage = await handleSystem(e, opts.systemMessage)
|
||||||
|
/*
|
||||||
|
if (Config.enableChatSuno) {
|
||||||
|
option.systemMessage += '如果我要求你生成音乐或写歌,你需要回复适合Suno生成音乐的信息。请使用Verse、Chorus、Bridge、Outro和End等关键字对歌词进行分段,如[Verse]。返回的消息需要使用markdown包裹的JSON格式,结构为```json{"option": "Suno", "tags": "style", "title": "title of the song", "lyrics": "lyrics"}```。'
|
||||||
|
}
|
||||||
|
*/
|
||||||
systemAddition && (option.systemMessage += systemAddition)
|
systemAddition && (option.systemMessage += systemAddition)
|
||||||
opts.completionParams.parameters.tools = Object.keys(funcMap)
|
opts.completionParams.parameters.tools = Object.keys(funcMap)
|
||||||
.map(k => funcMap[k].function)
|
.map(k => funcMap[k].function)
|
||||||
|
|
@ -811,6 +816,9 @@ class Core {
|
||||||
.join('\n')
|
.join('\n')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Config.enableChatSuno) {
|
||||||
|
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], 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.system = system
|
||||||
return await client.sendMessage(prompt, option)
|
return await client.sendMessage(prompt, option)
|
||||||
} else if (use === 'chatglm4') {
|
} else if (use === 'chatglm4') {
|
||||||
|
|
@ -834,6 +842,11 @@ class Core {
|
||||||
let maxModelTokens = getMaxModelTokens(completionParams.model)
|
let maxModelTokens = getMaxModelTokens(completionParams.model)
|
||||||
// let system = promptPrefix
|
// let system = promptPrefix
|
||||||
let system = await handleSystem(e, promptPrefix, maxModelTokens)
|
let system = await handleSystem(e, promptPrefix, maxModelTokens)
|
||||||
|
/*
|
||||||
|
if (Config.enableChatSuno) {
|
||||||
|
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], The returned message is in JSON format, with a structure of ```json{"option": "Suno", "tags": "style", "title": "title of the song", "lyrics": "lyrics"}```.'
|
||||||
|
}
|
||||||
|
*/
|
||||||
logger.debug(system)
|
logger.debug(system)
|
||||||
let opts = {
|
let opts = {
|
||||||
apiBaseUrl: Config.openAiBaseUrl,
|
apiBaseUrl: Config.openAiBaseUrl,
|
||||||
|
|
|
||||||
|
|
@ -70,13 +70,29 @@
|
||||||
"value": "xh"
|
"value": "xh"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Slack Claude",
|
"label": "通义千问",
|
||||||
"value": "claude"
|
"value": "qwen"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Gemini",
|
"label": "Gemini",
|
||||||
"value": "gemini"
|
"value": "gemini"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"label": "Slack Claude",
|
||||||
|
"value": "claude"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Claude2",
|
||||||
|
"value": "claude2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "ChatGLM4",
|
||||||
|
"value": "chatglm4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "ChatGLM",
|
||||||
|
"value": "chatglm"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"label": "Azure OpenAI",
|
"label": "Azure OpenAI",
|
||||||
"value": "azure"
|
"value": "azure"
|
||||||
|
|
@ -85,10 +101,6 @@
|
||||||
"label": "ChatGPT API3",
|
"label": "ChatGPT API3",
|
||||||
"value": "api3"
|
"value": "api3"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"label": "ChatGLM",
|
|
||||||
"value": "chatglm"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": "浏览器",
|
"label": "浏览器",
|
||||||
"value": "browser"
|
"value": "browser"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue