适配星火v3 (#598)

* fix: 修复星火api上下文

* 将无星火ck的情况降低为warn

* feat: 添加星火设定自定义代码功能

* 修复星火api模式的一些问题

* 修复导出配置问题

* feat:添加工具箱快捷登录接口

* 添加工具箱快捷登录指令

* 阻止群聊使用快捷登录

* 添加Azure配置支持,修复重复的配置项冲突

* 移除旧版本渲染和新版本帮助

* 添加工具箱

* 更新工具箱替换原有后台

* 更新工具箱适配代码

* 后台适配Trss

* 修复trss不支持sendPrivateMsg的问题

* 优化路由

* 修复路由

* 适配其他uin

* 添加bing第三方绘图

* 修复bing绘图第三方调用错误

* 添加bing第三方绘图采样配置

* 修复错误

* 添加bing第三方绘图图片大小配置

* 修复视图错误

* 使用ap替换第三方绘图

* 适配trss

* server 适配trss

* 修复错误的后台版本更新

* 添加锅巴用户数据

* 修复server初始化消息错误

* 添加锅巴插件适配

* 更新后台页面

* 添加锅巴代理接口

* 优化锅巴接口代理

* 修复锅巴代理参数

* 删除调试信息

* 修复headers

* 更新后台锅巴插件支持

* 适配星火v3

* 适配星火v3

* 修复星火domain错误
This commit is contained in:
HalcyonAlcedo 2023-10-25 23:06:10 +08:00 committed by GitHub
parent c0936e6e2a
commit b7376407af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -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 = []
// 设定