Skip to content

Commit

Permalink
适配星火v3 (#598)
Browse files Browse the repository at this point in the history
* 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错误
  • Loading branch information
HalcyonAlcedo authored Oct 25, 2023
1 parent c0936e6 commit b737640
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions resources/view/setting_view.json
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,10 @@
"label": "讯飞星火认知大模型V2.0",
"value": "apiv2"
},
{
"label": "讯飞星火认知大模型V3.0",
"value": "apiv3"
},
{
"label": "讯飞星火助手",
"value": "assistants"
Expand Down
12 changes: 9 additions & 3 deletions utils/xinghuo/xinghuo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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: {
Expand All @@ -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,
Expand Down Expand Up @@ -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 = []
// 设定
Expand Down

0 comments on commit b737640

Please sign in to comment.