mirror of
https://github.com/Yanyutin753/RefreshToV1Api.git
synced 2025-12-21 01:06:34 +08:00
[feat] 自带的三个模型支持多名对一个模型映射
This commit is contained in:
@@ -11,9 +11,9 @@ services:
|
|||||||
- PROXY_API_PREFIX=<Pandora-Next的PROXY_API_PREFIX>
|
- PROXY_API_PREFIX=<Pandora-Next的PROXY_API_PREFIX>
|
||||||
- UPLOAD_BASE_URL=<50011端口在公网可以访问到的地址,如:http://1.2.3.4:50011,如果使用了反代需填入反代后的域名如:https://pandora-backend-api.com>
|
- UPLOAD_BASE_URL=<50011端口在公网可以访问到的地址,如:http://1.2.3.4:50011,如果使用了反代需填入反代后的域名如:https://pandora-backend-api.com>
|
||||||
- KEY_FOR_GPTS_INFO=<一个仅用于获取GPTs信息的fk> # 如果不需要额外使用gpts,可以不填
|
- KEY_FOR_GPTS_INFO=<一个仅用于获取GPTs信息的fk> # 如果不需要额外使用gpts,可以不填
|
||||||
- GPT_4_S_New_Name=gpt-4-s # gpt-4-s模型的自定义模型名称
|
- GPT_4_S_New_Name=gpt-4-s # gpt-4-s模型的自定义模型名称,支持同时设置多个,用英文逗号分隔
|
||||||
- GPT_4_MOBILE_NEW_NAME=gpt-4-mobile # gpt-4-mobile模型的自定义模型名称
|
- GPT_4_MOBILE_NEW_NAME=gpt-4-mobile # gpt-4-mobile模型的自定义模型名称,支持同时设置多个,用英文逗号分隔
|
||||||
- GPT_3_5_NEW_NAME=gpt-3.5-turbo # gpt-3.5-turbo模型的自定义模型名称
|
- GPT_3_5_NEW_NAME=gpt-3.5-turbo # gpt-3.5-turbo模型的自定义模型名称,支持同时设置多个,用英文逗号分隔
|
||||||
volumes:
|
volumes:
|
||||||
- ./log:/app/log
|
- ./log:/app/log
|
||||||
- ./images:/app/images
|
- ./images:/app/images
|
||||||
|
|||||||
39
main.py
39
main.py
@@ -103,9 +103,9 @@ PROXY_API_PREFIX = os.getenv('PROXY_API_PREFIX', '')
|
|||||||
UPLOAD_BASE_URL = os.getenv('UPLOAD_BASE_URL', '')
|
UPLOAD_BASE_URL = os.getenv('UPLOAD_BASE_URL', '')
|
||||||
KEY_FOR_GPTS_INFO = os.getenv('KEY_FOR_GPTS_INFO', '')
|
KEY_FOR_GPTS_INFO = os.getenv('KEY_FOR_GPTS_INFO', '')
|
||||||
|
|
||||||
VERSION = '0.1.5'
|
VERSION = '0.1.6'
|
||||||
# VERSION = 'test'
|
# VERSION = 'test'
|
||||||
UPDATE_INFO = '支持自定义自带的三种模型的名称'
|
UPDATE_INFO = '对于自带的三个模型,支持多个名字映射到同一个模型'
|
||||||
# UPDATE_INFO = '【仅供临时测试使用】 '
|
# UPDATE_INFO = '【仅供临时测试使用】 '
|
||||||
|
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
@@ -128,26 +128,29 @@ with app.app_context():
|
|||||||
|
|
||||||
print(f"==========================================")
|
print(f"==========================================")
|
||||||
|
|
||||||
# 从环境变量中读取模型名称
|
# 从环境变量中读取模型名称,支持用逗号分隔的多个名称
|
||||||
GPT_4_S_New_Name = os.getenv('GPT_4_S_New_Name', 'gpt-4-s')
|
GPT_4_S_New_Names = os.getenv('GPT_4_S_New_Name', 'gpt-4-s').split(',')
|
||||||
GPT_4_MOBILE_NEW_NAME = os.getenv('GPT_4_MOBILE_NEW_NAME', 'gpt-4-mobile')
|
GPT_4_MOBILE_NEW_NAMES = os.getenv('GPT_4_MOBILE_NEW_NAME', 'gpt-4-mobile').split(',')
|
||||||
GPT_3_5_NEW_NAME = os.getenv('GPT_3_5_NEW_NAME', 'gpt-3.5-turbo')
|
GPT_3_5_NEW_NAMES = os.getenv('GPT_3_5_NEW_NAME', 'gpt-3.5-turbo').split(',')
|
||||||
|
|
||||||
# 更新 gpts_configurations 列表
|
# 更新 gpts_configurations 列表,支持多个映射
|
||||||
gpts_configurations = [
|
gpts_configurations = []
|
||||||
{
|
for name in GPT_4_S_New_Names:
|
||||||
"name": GPT_4_S_New_Name,
|
gpts_configurations.append({
|
||||||
|
"name": name.strip(),
|
||||||
"ori_name": "gpt-4-s"
|
"ori_name": "gpt-4-s"
|
||||||
},
|
})
|
||||||
{
|
for name in GPT_4_MOBILE_NEW_NAMES:
|
||||||
"name": GPT_4_MOBILE_NEW_NAME,
|
gpts_configurations.append({
|
||||||
|
"name": name.strip(),
|
||||||
"ori_name": "gpt-4-mobile"
|
"ori_name": "gpt-4-mobile"
|
||||||
},
|
})
|
||||||
{
|
for name in GPT_3_5_NEW_NAMES:
|
||||||
"name": GPT_3_5_NEW_NAME,
|
gpts_configurations.append({
|
||||||
|
"name": name.strip(),
|
||||||
"ori_name": "gpt-3.5-turbo"
|
"ori_name": "gpt-3.5-turbo"
|
||||||
}
|
})
|
||||||
]
|
|
||||||
|
|
||||||
print(f"GPTS 配置信息")
|
print(f"GPTS 配置信息")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user