feat: 新增模型扩展映射与查询配置字段

This commit is contained in:
2026-05-23 18:08:08 +08:00
parent 5416e7a983
commit a28fcbaee9
9 changed files with 203 additions and 151 deletions

View File

@@ -51,6 +51,8 @@ CREATE TABLE IF NOT EXISTS asynch_models (
"reserve_ratio": 0.2,
"min_reserve": 512,
}'::jsonb -- Token配置
extend_mapping JSONB NOT NULL DEFAULT '{}'::jsonb,
query_config JSONB NOT NULL DEFAULT '{}'::jsonb;
);
CREATE UNIQUE INDEX IF NOT EXISTS uk_asynch_models_tenant_creator_chat ON asynch_models(tenant_id, creator) WHERE is_chat_model = 1 AND deleted_at IS NULL;
CREATE UNIQUE INDEX IF NOT EXISTS uk_asynch_models_tenant_model_name ON asynch_models(tenant_id, creator, model_name);
@@ -94,6 +96,8 @@ COMMENT ON COLUMN asynch_models.auto_clean_seconds IS '已下载(state=4 后的
COMMENT ON COLUMN asynch_models.remark IS '备注';
COMMENT ON COLUMN asynch_models.response_token_field IS '响应中消耗token的字段映射';
COMMENT ON COLUMN asynch_models.operator_name IS '运营商名称';
COMMENT ON COLUMN asynch_models.extend_mapping IS '附加映射(请求时候额外字段)';
COMMENT ON COLUMN asynch_models.query_config IS '查询结果配置通过task_id查询结果相关配置';
COMMENT ON COLUMN asynch_models.token_config IS '{
"zh_ratio": 1.0, // 中文字符→token系数
"en_ratio": 1.3, // 英文单词→token系数