refactor(*): 稳定期治理 - 收敛核心架构、错误语义并修复跨项目数据竞态
This commit is contained in:
@@ -42,39 +42,4 @@ func RegisterModelCatalogRoutes(r *gin.RouterGroup, svc *service.Service) {
|
||||
ok(c, catalog)
|
||||
})
|
||||
|
||||
r.POST("/model-catalog/quote", func(c *gin.Context) {
|
||||
if _, err := currentUser(c, svc); err != nil {
|
||||
failService(c, err)
|
||||
return
|
||||
}
|
||||
var req struct {
|
||||
ModelID string `json:"modelId"`
|
||||
Intent service.ModelRequestIntent `json:"intent"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
fail(c, http.StatusBadRequest, errors.New("模型报价请求格式错误"))
|
||||
return
|
||||
}
|
||||
|
||||
// 根据 frontendModelsEnabled 决定使用哪种报价方式
|
||||
frontendEnabled, err := svc.FeatureEnabled(service.FeatureFrontendModels)
|
||||
if err != nil {
|
||||
failService(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
if frontendEnabled {
|
||||
// 使用前台模型报价
|
||||
quote, err := svc.QuoteLogicalModel(req.ModelID, req.Intent)
|
||||
if err != nil {
|
||||
failService(c, err)
|
||||
return
|
||||
}
|
||||
ok(c, gin.H{"quote": quote})
|
||||
} else {
|
||||
// 使用系统渠道模型报价
|
||||
// TODO: 实现系统渠道模型报价逻辑
|
||||
fail(c, http.StatusNotImplemented, errors.New("系统渠道模型报价功能尚未实现"))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user