refactor: 模型错误解析改为 ErrorMessageMapping 配置驱动
- parseModelError 按模型配置的 ErrorMessageMapping(schema 树)解析错误响应 - 成功判定: code 提取为空 / code 节点配置 defaultValue 且提取值等于它 → 成功 - 未配置 mapping 不识别错误(纯配置驱动), 删硬编码 ModelErrorResp/ModelError1Resp - DTO 加 errorMessageMapping 字段, update.sql 建 error_message_mapping JSONB 列 - 单测: parse_error_test.go 覆盖扁平/嵌套/数组/纯字符串路径/未配置/坏 JSON
This commit is contained in:
+9
-1
@@ -353,4 +353,12 @@ UPDATE model_gateway_model_manage r SET
|
||||
FROM model_gateway_model_manage s
|
||||
WHERE r.system_model = false AND s.system_model = true
|
||||
AND r.model_name = s.model_name
|
||||
AND r.ref_system_model_id IS NULL;
|
||||
AND r.ref_system_model_id IS NULL;
|
||||
|
||||
-- =========================
|
||||
-- 错误消息映射:model_manage 新增 error_message_mapping(JSONB,schema 树形态,解析模型错误响应用)
|
||||
-- =========================
|
||||
ALTER TABLE model_gateway_model_manage
|
||||
ADD COLUMN IF NOT EXISTS error_message_mapping JSONB DEFAULT NULL;
|
||||
COMMENT ON COLUMN model_gateway_model_manage.error_message_mapping
|
||||
IS '错误消息映射:{code,message} 的 schema 树(type/attrs/value/defaultValue),解析模型错误响应,defaultValue 为成功码';
|
||||
Reference in New Issue
Block a user