mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
Merge branch 'v2' into v2
This commit is contained in:
commit
be91e25415
26 changed files with 1029 additions and 632 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { Config } from './utils/config.js'
|
||||
import { speakers } from './utils/tts.js'
|
||||
import AzureTTS from './utils/tts/microsoft-azure.js'
|
||||
import VoiceVoxTTS from './utils/tts/voicevox.js'
|
||||
import { supportConfigurations as azureRoleList } from './utils/tts/microsoft-azure.js'
|
||||
import { supportConfigurations as voxRoleList } from './utils/tts/voicevox.js'
|
||||
// 支持锅巴
|
||||
export function supportGuoba () {
|
||||
return {
|
||||
|
|
@ -40,15 +40,15 @@ export function supportGuoba () {
|
|||
component: 'InputTextArea'
|
||||
},
|
||||
{
|
||||
field: 'groupWhitelist',
|
||||
label: '群聊白名单',
|
||||
bottomHelpMessage: '设置后只有白名单内的群可以使用本插件。用英文逗号隔开',
|
||||
field: 'whitelist',
|
||||
label: '对话白名单',
|
||||
bottomHelpMessage: '只有在白名单内的QQ号或群组才能使用本插件进行对话。如果需要添加QQ号,请在号码前面加上^符号(例如:^123456),多个号码之间请用英文逗号(,)隔开。白名单优先级高于黑名单。',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
field: 'groupBlacklist',
|
||||
label: '群聊黑名单',
|
||||
bottomHelpMessage: '设置后名单内的群禁止使用本插件。用英文逗号隔开',
|
||||
field: 'blacklist',
|
||||
label: '对话黑名单',
|
||||
bottomHelpMessage: '名单内的群或QQ号将无法使用本插件进行对话。如果需要添加QQ号,请在QQ号前面加上^符号(例如:^123456),并用英文逗号(,)将各个号码分隔开。',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
|
|
@ -102,7 +102,10 @@ export function supportGuoba () {
|
|||
bottomHelpMessage: 'vits-uma-genshin-honkai语音模式下,未指定角色时使用的角色。若留空,将使用随机角色回复。若用户通过指令指定了角色,将忽略本设定',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: speakers.concat('随机').map(s => { return { label: s, value: s } })
|
||||
options: [{
|
||||
label: '随机',
|
||||
value: '随机'
|
||||
}].concat(speakers.map(s => { return { label: s, value: s } }))
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -111,12 +114,16 @@ export function supportGuoba () {
|
|||
bottomHelpMessage: '微软Azure语音模式下,未指定角色时使用的角色。若用户通过指令指定了角色,将忽略本设定',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: AzureTTS.supportConfigurations.map(item => {
|
||||
return {
|
||||
label: `${item.name}-${item.gender}-${item.languageDetail}`,
|
||||
value: item.code
|
||||
}
|
||||
})
|
||||
options: [{
|
||||
label: '随机',
|
||||
value: '随机'
|
||||
},
|
||||
...azureRoleList.flatMap(item => [
|
||||
item.roleInfo
|
||||
]).map(s => ({
|
||||
label: s,
|
||||
value: s
|
||||
}))]
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -125,11 +132,17 @@ export function supportGuoba () {
|
|||
bottomHelpMessage: 'VoiceVox语音模式下,未指定角色时使用的角色。若留空,将使用随机角色回复。若用户通过指令指定了角色,将忽略本设定',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: VoiceVoxTTS.supportConfigurations.map(item => {
|
||||
return item.styles.map(style => {
|
||||
return `${item.name}-${style.name}`
|
||||
}).concat(item.name)
|
||||
}).flat().concat('随机').map(s => { return { label: s, value: s } })
|
||||
options: [{
|
||||
label: '随机',
|
||||
value: '随机'
|
||||
},
|
||||
...voxRoleList.flatMap(item => [
|
||||
...item.styles.map(style => `${item.name}-${style.name}`),
|
||||
item.name
|
||||
]).map(s => ({
|
||||
label: s,
|
||||
value: s
|
||||
}))]
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -307,6 +320,12 @@ export function supportGuoba () {
|
|||
bottomHelpMessage: 'OpenAI的ApiKey,用于访问OpenAI的API接口',
|
||||
component: 'InputPassword'
|
||||
},
|
||||
{
|
||||
field: 'model',
|
||||
label: 'OpenAI 模型',
|
||||
bottomHelpMessage: 'gpt-4, gpt-4-0314, gpt-4-32k, gpt-4-32k-0314, gpt-3.5-turbo, gpt-3.5-turbo-0301。默认为gpt-3.5-turbo,gpt-4需账户支持',
|
||||
component: 'Input'
|
||||
},
|
||||
{
|
||||
field: 'openAiBaseUrl',
|
||||
label: 'OpenAI API服务器地址',
|
||||
|
|
@ -383,6 +402,12 @@ export function supportGuoba () {
|
|||
bottomHelpMessage: '加强主人认知。希望机器人认清主人,避免NTR可开启。开启后可能会与自设定的内容有部分冲突。sydney模式可以放心开启',
|
||||
component: 'Switch'
|
||||
},
|
||||
{
|
||||
field: 'enableGenerateContents',
|
||||
label: '允许生成图像等内容',
|
||||
bottomHelpMessage: '开启后类似网页版能够发图。但是此选项会占用大量token,自设定等模式下容易爆token',
|
||||
component: 'Switch'
|
||||
},
|
||||
// {
|
||||
// field: 'cognitiveReinforcementTip',
|
||||
// label: '加强主人认知的后台prompt',
|
||||
|
|
@ -780,7 +805,19 @@ export function supportGuoba () {
|
|||
for (let [keyPath, value] of Object.entries(data)) {
|
||||
// 处理黑名单
|
||||
if (keyPath === 'blockWords' || keyPath === 'promptBlockWords' || keyPath === 'initiativeChatGroups') { value = value.toString().split(/[,,;;\|]/) }
|
||||
if (Config[keyPath] != value) { Config[keyPath] = value }
|
||||
if (Config[keyPath] !== value) { Config[keyPath] = value }
|
||||
}
|
||||
// 正确储存azureRoleSelect结果
|
||||
const azureSpeaker = azureRoleList.find(config => {
|
||||
let i = config.roleInfo || config.code
|
||||
if (i === data.azureTTSSpeaker) {
|
||||
return config
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
if (typeof azureSpeaker === 'object' && azureSpeaker !== null) {
|
||||
Config.azureTTSSpeaker = azureSpeaker.code
|
||||
}
|
||||
return Result.ok({}, '保存成功~')
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue