refactor: enable model configuration on default group (close #143)
This commit is contained in:
parent
45e9fd66e7
commit
813bf0bd66
@ -46,6 +46,8 @@ _✨ All in one 的 OpenAI 接口,整合各种 API 访问方式,开箱即用
|
|||||||
|
|
||||||
> **Warning**:使用 Docker 拉取的最新镜像可能是 `alpha` 版本,如果追求稳定性请手动指定版本。
|
> **Warning**:使用 Docker 拉取的最新镜像可能是 `alpha` 版本,如果追求稳定性请手动指定版本。
|
||||||
|
|
||||||
|
> **Warning**:从 `v0.3` 版本升级到 `v0.4` 版本需要手动迁移数据库,请手动执行[数据库迁移脚本](./bin/migration_v0.3-v0.4.sql)。
|
||||||
|
|
||||||
## 功能
|
## 功能
|
||||||
1. 支持多种 API 访问渠道,欢迎 PR 或提 issue 添加更多渠道:
|
1. 支持多种 API 访问渠道,欢迎 PR 或提 issue 添加更多渠道:
|
||||||
+ [x] OpenAI 官方通道
|
+ [x] OpenAI 官方通道
|
||||||
|
17
bin/migration_v0.3-v0.4.sql
Normal file
17
bin/migration_v0.3-v0.4.sql
Normal file
@ -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
|
||||||
|
);
|
@ -13,9 +13,6 @@ type Ability struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetRandomSatisfiedChannel(group string, model string) (*Channel, error) {
|
func GetRandomSatisfiedChannel(group string, model string) (*Channel, error) {
|
||||||
if group == "default" {
|
|
||||||
return GetRandomChannel()
|
|
||||||
}
|
|
||||||
ability := Ability{}
|
ability := Ability{}
|
||||||
var err error = nil
|
var err error = nil
|
||||||
if common.UsingSQLite {
|
if common.UsingSQLite {
|
||||||
|
Loading…
Reference in New Issue
Block a user