expose route metadata and remove stale route docs
This commit is contained in:
1 parent
8e9f0d52fd
commit
b2266d7e9d
3 files changed
+43
-3
No files matched your search
+9
-1
@@ -48,6 +48,14 @@ public class GatewayController {
|
||||
item.put("id", model.get("id"));
|
||||
item.put("object", "model");
|
||||
item.put("owned_by", model.get("providerId"));
|
||||
// Keep the OpenAI-compatible id as the exact catalog route UUID.
|
||||
// These descriptive fields let clients show the logical model and
|
||||
// source group without guessing that modelKey is a callable id.
|
||||
item.put("model_key", model.get("modelKey"));
|
||||
item.put("public_name", model.get("publicName"));
|
||||
item.put("vendor_name", model.get("vendorName"));
|
||||
item.put("source_label", model.get("sourceLabel"));
|
||||
item.put("upstream_model", model.get("upstreamModel"));
|
||||
item.put("type", model.get("type"));
|
||||
item.put("mode", model.get("mode"));
|
||||
return item;
|
||||
@@ -72,7 +80,7 @@ public class GatewayController {
|
||||
long startedAt = System.currentTimeMillis();
|
||||
String modelId = String.valueOf(input.getOrDefault("model", ""));
|
||||
Map<String, Object> model = catalogService.activeModel(modelId);
|
||||
if (model == null) throw new ApiException("MODEL_NOT_FOUND", "模型不存在或已下线", 404);
|
||||
if (model == null) throw new ApiException("MODEL_NOT_FOUND", "模型不存在或已下线;请使用当前 API Key 的 /v1/models 返回的渠道分组 ID", 404);
|
||||
if (!catalogService.keyCanInvoke(key, modelId)) throw new ApiException("MODEL_FORBIDDEN", "当前 Key 无权调用该模型", 403);
|
||||
if ("async".equals(model.get("mode"))) throw new ApiException("ASYNC_MODEL", "该模型需要使用异步任务接口", 400);
|
||||
String providerId=String.valueOf(model.get("providerId"));
|
||||
|
||||
Reference in new issue
Block a user