diff --git a/resources/view/setting_view.json b/resources/view/setting_view.json index 78ebca40..c3d7c0d9 100644 --- a/resources/view/setting_view.json +++ b/resources/view/setting_view.json @@ -718,6 +718,10 @@ "label": "讯飞星火认知大模型V2.0", "value": "apiv2" }, + { + "label": "讯飞星火认知大模型V3.0", + "value": "apiv3" + }, { "label": "讯飞星火助手", "value": "assistants" diff --git a/utils/xinghuo/xinghuo.js b/utils/xinghuo/xinghuo.js index 6ee1bf00..04aa7280 100644 --- a/utils/xinghuo/xinghuo.js +++ b/utils/xinghuo/xinghuo.js @@ -90,6 +90,8 @@ export default class XinghuoClient { let APILink = '/v1.1/chat' if (Config.xhmode == 'apiv2') { APILink = '/v2.1/chat' + } else if (Config.xhmode == 'apiv3') { + APILink = '/v3.1/chat' } const date = new Date().toGMTString() const algorithm = 'hmac-sha256' @@ -179,7 +181,11 @@ export default class XinghuoClient { // 获取ws链接 const wsUrl = Config.xhmode == 'assistants' ? Config.xhAssistants : await this.getWsUrl() if (!wsUrl) throw new Error('缺少依赖:crypto。请安装依赖后重试') - + let domain = 'general' + if (Config.xhmode == 'apiv2') + domain = "generalv2" + else if (Config.xhmode == 'apiv3') + domain = "generalv3" // 编写消息内容 const wsSendData = { header: { @@ -188,7 +194,7 @@ export default class XinghuoClient { }, parameter: { chat: { - domain: Config.xhmode == 'api' ? "general" : "generalv2", + domain: domain, temperature: Config.xhTemperature, // 核采样阈值 max_tokens: Config.xhMaxTokens, // tokens最大长度 chat_id: chatId, @@ -378,7 +384,7 @@ export default class XinghuoClient { let chatId = option?.chatId let image = option?.image - if (Config.xhmode == 'api' || Config.xhmode == 'apiv2' || Config.xhmode == 'assistants') { + if (Config.xhmode == 'api' || Config.xhmode == 'apiv2' || Config.xhmode == 'apiv3' || Config.xhmode == 'assistants') { if (!Config.xhAppId || !Config.xhAPISecret || !Config.xhAPIKey) throw new Error('未配置api') let Prompt = [] // 设定