fix: 增加均衡模式

This commit is contained in:
ikechan8370 2024-03-15 10:52:21 +08:00
parent b822e49d9a
commit a4d07b9d46
6 changed files with 96 additions and 107 deletions

View file

@ -1057,7 +1057,7 @@ azure语音Azure 语音是微软 Azure 平台提供的一项语音服务,
let map = { let map = {
精准: 'Precise', 精准: 'Precise',
创意: 'Creative', 创意: 'Creative',
均衡: 'Precise', 均衡: 'Balanced',
Sydney: 'Creative', Sydney: 'Creative',
sydney: 'Creative', sydney: 'Creative',
悉尼: 'Creative', 悉尼: 'Creative',
@ -1069,7 +1069,7 @@ azure语音Azure 语音是微软 Azure 平台提供的一项语音服务,
Config.toneStyle = map[tongStyle] Config.toneStyle = map[tongStyle]
await this.reply('切换成功') await this.reply('切换成功')
} else { } else {
await this.reply('没有这种风格。支持的风格:`精准`和`创意`,均支持设定') await this.reply('没有这种风格。支持的风格:`精准`、`均衡`和`创意`,均支持设定')
} }
} }
@ -1103,9 +1103,11 @@ azure语音Azure 语音是微软 Azure 平台提供的一项语音服务,
api3: 'API3', api3: 'API3',
chatglm: 'ChatGLM-6B', chatglm: 'ChatGLM-6B',
claude: 'Claude', claude: 'Claude',
poe: 'Poe', claude2: 'claude.ai',
chatglm4: 'ChatGLM-4',
xh: '星火', xh: '星火',
qwen: '通义千问' qwen: '通义千问',
gemini: 'Gemini'
} }
let modeText = modeMap[mode || 'api'] let modeText = modeMap[mode || 'api']
let message = `请访问yunzai.chat查看文档。当前为 ${modeText} 模式。` let message = `请访问yunzai.chat查看文档。当前为 ${modeText} 模式。`

View file

@ -180,11 +180,12 @@ export function supportGuoba () {
{ {
field: 'toneStyle', field: 'toneStyle',
label: 'Bing模式', label: 'Bing模式',
bottomHelpMessage: 'Copilot的应答风格。默认为创意可切换为精准,均支持添加设定', bottomHelpMessage: 'Copilot的应答风格。默认为创意可切换为精准或均衡均为GPT-turbo',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options: [ options: [
{ label: '创意', value: 'Creative' }, { label: '创意', value: 'Creative' },
{ label: '均衡', value: 'Balanced' },
{ label: '精准', value: 'Precise' } { label: '精准', value: 'Precise' }
] ]
} }
@ -218,23 +219,12 @@ export function supportGuoba () {
bottomHelpMessage: '加强主人认知。希望机器人认清主人避免NTR可开启。开启后可能会与自设定的内容有部分冲突。sydney模式可以放心开启', bottomHelpMessage: '加强主人认知。希望机器人认清主人避免NTR可开启。开启后可能会与自设定的内容有部分冲突。sydney模式可以放心开启',
component: 'Switch' component: 'Switch'
}, },
{
field: 'sydneyGPT4Turbo',
label: '使用GPT4-turbo',
bottomHelpMessage: '目前仅Copilot Pro可开启。非pro用户开启会报错。',
component: 'Switch'
},
{ {
field: 'enableGenerateContents', field: 'enableGenerateContents',
label: '允许生成图像等内容', label: '允许生成图像等内容',
bottomHelpMessage: '开启后类似网页版能够发图。但是此选项会占用大量token自设定等模式下容易爆token', bottomHelpMessage: '开启后类似网页版能够发图。但是此选项会占用大量token自设定等模式下容易爆token',
component: 'Switch' component: 'Switch'
}, },
// {
// field: 'cognitiveReinforcementTip',
// label: '加强主人认知的后台prompt',
// component: 'InputTextArea'
// },
{ {
field: 'groupContextLength', field: 'groupContextLength',
label: '允许机器人读取近期的最多群聊聊天记录条数。', label: '允许机器人读取近期的最多群聊聊天记录条数。',

View file

@ -384,55 +384,8 @@ export default class SydneyAIClient {
if (tone.toLowerCase() === 'sydney' || tone.toLowerCase() === 'custom') { if (tone.toLowerCase() === 'sydney' || tone.toLowerCase() === 'custom') {
Config.toneStyle = 'Creative' Config.toneStyle = 'Creative'
} }
const isCreative = tone.toLowerCase().includes('creative') let optionsSets = getOptionSet(Config.toneStyle, Config.enableGenerateContents)
const toneOption = isCreative ? 'h3imaginative' : 'h3precise'
let optionsSets = [
'nlu_direct_response_filter',
'deepleo',
'disable_emoji_spoken_text',
'responsible_ai_policy_235',
'enablemm',
toneOption,
// 'dagslnv1',
// 'sportsansgnd',
// 'dl_edge_desc',
// 'noknowimg',
// 'dtappid',
// 'cricinfo',
// 'cricinfov2',
'dv3sugg',
'autosave',
// 'gencontentv3',
'iycapbing',
'iyxapbing',
// 'revimglnk',
// 'revimgsi2',
// 'revimgsrc1',
// 'revimgur',
// 'clgalileo',
// 'eredirecturl',
// copilot
'uquopt',
// 'botthrottle',
// 'dlimitationnc',
// 'hourthrot',
// 'gndlogcf',
// 'ciorigimage',
// 'codeintfile',
'eredirecturl',
// 'ldsummary',
// 'ldqa',
// 'sdretrieval',
// "gencontentv3",
// 'gpt4tmncnp'
]
if (!isCreative) {
optionsSets.push('clgalileo')
}
let source = 'cib-ccp'; let gptId = 'copilot' let source = 'cib-ccp'; let gptId = 'copilot'
if (Config.enableGenerateContents) {
optionsSets.push(...['gencontentv3'])
}
if (!Config.sydneyEnableSearch || toSummaryFileContent?.content) { if (!Config.sydneyEnableSearch || toSummaryFileContent?.content) {
optionsSets.push(...['nosearchall']) optionsSets.push(...['nosearchall'])
} }
@ -440,11 +393,6 @@ export default class SydneyAIClient {
tone = tone + 'Classic' tone = tone + 'Classic'
invocationId = 2 invocationId = 2
} }
if (Config.sydneyGPT4Turbo) {
// tone = 'Creative'
// optionsSets.push('gpt4tmnc')
invocationId = 1
}
// wtf gpts? // wtf gpts?
// if (Config.sydneyGPTs === 'Designer') { // if (Config.sydneyGPTs === 'Designer') {
// optionsSets.push(...['ai_persona_designer_gpt', 'flux_websearch_v14']) // optionsSets.push(...['ai_persona_designer_gpt', 'flux_websearch_v14'])
@ -484,32 +432,7 @@ export default class SydneyAIClient {
'SearchQuery', 'SearchQuery',
'GeneratedCode' 'GeneratedCode'
], ],
sliceIds: [ sliceIds: [],
// 'supllmnfe',
// 'nodescf',
// 'stcheckcf',
// 'invldrqcf',
// 'v6voice',
// 'vnextr100',
// 'sydvrate100',
// 'vnextvoice',
// 'scmcbasecf',
// 'cmcpupsalltf',
// 'sydtransjson',
// 'thdnsrchcf',
// '220dcl1bt15',
// '311dlicnc',
// '0215wcrwippsr',
// '0305hrthrot',
// '0130gpt4t',
// 'bingfccf',
// 'dissagrds0',
// '0228scs',
// 'scprompt1',
// '228pyfilenfb',
// 'ecipc',
// '3022tpvs0'
],
requestId: crypto.randomUUID(), requestId: crypto.randomUUID(),
traceId: genRanHex(32), traceId: genRanHex(32),
scenario: 'SERP', scenario: 'SERP',
@ -566,17 +489,17 @@ export default class SydneyAIClient {
spokenTextMode: 'None', spokenTextMode: 'None',
conversationId, conversationId,
previousMessages, previousMessages,
// plugins: [ plugins: [
// { {
// id: 'c310c353-b9f0-4d76-ab0d-1dd5e979cf68', id: 'c310c353-b9f0-4d76-ab0d-1dd5e979cf68',
// category: 1 category: 1
// } }
// ], ],
// extraExtensionParameters: { extraExtensionParameters: {
// 'gpt-creator-persona': { 'gpt-creator-persona': {
// personaId: 'copilot' personaId: 'copilot'
// } }
// } }
} }
if (encryptedconversationsignature) { if (encryptedconversationsignature) {
@ -1026,3 +949,73 @@ async function generateRandomIP () {
await redis.set('CHATGPT:BING_IP', ip, { EX: 86400 * 7 }) await redis.set('CHATGPT:BING_IP', ip, { EX: 86400 * 7 })
return ip return ip
} }
/**
*
* @param {'Precise' | 'Balanced' | 'Creative'} tone
*/
function getOptionSet (tone, generateContent = false) {
let optionset = [
'nlu_direct_response_filter',
'deepleo',
'disable_emoji_spoken_text',
'responsible_ai_policy_235',
'enablemm',
'dv3sugg',
'autosave',
'iyxapbing',
'iycapbing',
'enable_user_consent',
'fluxmemcst'
]
switch (tone) {
case 'Precise':
optionset.push(...[
'h3precise',
'sunoupsell',
'botthrottle',
'dlimitationnc',
'hourthrot',
'elec2t',
'elecgnd',
'gndlogcf',
'eredirecturl',
'clgalileo',
'gencontentv3'
])
break
case 'Balance':
optionset.push(...[
'galileo',
'saharagenconv5',
'sunoupsell',
'botthrottle',
'dlimitationnc',
'hourthrot',
'elec2t',
'elecgnd',
'gndlogcf',
'eredirecturl'
])
break
case 'Creative':
optionset.push(...[
'h3imaginative',
'sunoupsell',
'botthrottle',
'dlimitationnc',
'hourthrot',
'elec2t',
'elecgnd',
'gndlogcf',
'eredirecturl',
'clgalileo',
'gencontentv3'
])
break
}
if (generateContent) {
optionset.push('gencontentv3')
}
return optionset
}

View file

@ -218,6 +218,7 @@ var QwenApi = /** @class */ (function () {
} }
result.detail = response; result.detail = response;
result.text = response.output.choices[0].message.content; result.text = response.output.choices[0].message.content;
result.conversation = messages;
return [2 /*return*/, resolve(result)]; return [2 /*return*/, resolve(result)];
case 6: case 6:
err_1 = _f.sent(); err_1 = _f.sent();

View file

@ -228,6 +228,7 @@ export class QwenApi {
} }
result.detail = response result.detail = response
result.text = response.output.choices[0].message.content result.text = response.output.choices[0].message.content
result.conversation = messages
return resolve(result) return resolve(result)
} catch (err) { } catch (err) {
return reject(err) return reject(err)

View file

@ -31,6 +31,9 @@ const defaultConfig = {
drawCD: 30, drawCD: 30,
model: '', model: '',
temperature: 0.8, temperature: 0.8,
/**
* @type {'Precise' | 'Balanced' | 'Creative'}
*/
toneStyle: 'Creative', toneStyle: 'Creative',
sydney: pureSydneyInstruction, sydney: pureSydneyInstruction,
sydneyReverseProxy: 'https://666102.201666.xyz', sydneyReverseProxy: 'https://666102.201666.xyz',
@ -40,7 +43,6 @@ const defaultConfig = {
sydneyBrainWashStrength: 15, sydneyBrainWashStrength: 15,
sydneyBrainWashName: 'Sydney', sydneyBrainWashName: 'Sydney',
sydneyMood: false, sydneyMood: false,
sydneyGPT4Turbo: false,
sydneyGPTs: 'Copilot', sydneyGPTs: 'Copilot',
sydneyImageRecognition: false, sydneyImageRecognition: false,
sydneyMoodTip: 'Your response should be divided into two parts, namely, the text and your mood. The mood available to you can only include: blandness, happy, shy, frustrated, disgusted, and frightened.All content should be replied in this format {"text": "", "mood": ""}.All content except mood should be placed in text, It is important to ensure that the content you reply to can be parsed by json.', sydneyMoodTip: 'Your response should be divided into two parts, namely, the text and your mood. The mood available to you can only include: blandness, happy, shy, frustrated, disgusted, and frightened.All content should be replied in this format {"text": "", "mood": ""}.All content except mood should be placed in text, It is important to ensure that the content you reply to can be parsed by json.',