Skip to content

Commit

Permalink
refactor: enable model configuration on default group (close songquan…
Browse files Browse the repository at this point in the history
  • Loading branch information
songquanpeng committed Jun 9, 2023
1 parent 45e9fd6 commit 813bf0b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ _✨ All in one 的 OpenAI 接口,整合各种 API 访问方式,开箱即用

> **Warning**:使用 Docker 拉取的最新镜像可能是 `alpha` 版本,如果追求稳定性请手动指定版本。
> **Warning**:从 `v0.3` 版本升级到 `v0.4` 版本需要手动迁移数据库,请手动执行[数据库迁移脚本](./bin/migration_v0.3-v0.4.sql)
## 功能
1. 支持多种 API 访问渠道,欢迎 PR 或提 issue 添加更多渠道:
+ [x] OpenAI 官方通道
Expand Down
17 changes: 17 additions & 0 deletions bin/migration_v0.3-v0.4.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
INSERT INTO abilities (`group`, model, channel_id, enabled)
SELECT c.`group`, m.model, c.id, 1
FROM channels c
CROSS JOIN (
SELECT 'gpt-3.5-turbo' AS model UNION ALL
SELECT 'gpt-3.5-turbo-0301' AS model UNION ALL
SELECT 'gpt-4' AS model UNION ALL
SELECT 'gpt-4-0314' AS model
) AS m
WHERE c.status = 1
AND NOT EXISTS (
SELECT 1
FROM abilities a
WHERE a.`group` = c.`group`
AND a.model = m.model
AND a.channel_id = c.id
);
3 changes: 0 additions & 3 deletions model/ability.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ type Ability struct {
}

func GetRandomSatisfiedChannel(group string, model string) (*Channel, error) {
if group == "default" {
return GetRandomChannel()
}
ability := Ability{}
var err error = nil
if common.UsingSQLite {
Expand Down

0 comments on commit 813bf0b

Please sign in to comment.