feat(models): 支持按使用场景筛选模型

Gateway 模型接口校验 usage_scene,并与 server-main 严格场景目录取交集;显式场景查询在上游不可用时关闭失败,避免返回不应暴露的模型。\n\n验证:env -u AI_GATEWAY_TEST_DATABASE_URL go test ./... -count=1
This commit is contained in:
chengcheng
2026-07-27 13:15:23 +08:00
parent de10875439
commit 31c32690b2
5 changed files with 443 additions and 0 deletions
+32
View File
@@ -8381,6 +8381,14 @@ paths:
/api/v1/models:
get:
description: 按当前用户权限返回可用于 Playground 或 API 调用的模型列表。
parameters:
- description: 模型可选场景;不传时保持原有行为
enum:
- canvas_model_node
- desktop
in: query
name: usage_scene
type: string
produces:
- application/json
responses:
@@ -8388,6 +8396,10 @@ paths:
description: OK
schema:
$ref: '#/definitions/httpapi.PlatformModelListResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
"401":
description: Unauthorized
schema:
@@ -8396,6 +8408,10 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
"502":
description: Bad Gateway
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
security:
- BearerAuth: []
summary: 列出可调用模型
@@ -8615,6 +8631,14 @@ paths:
/api/v1/playground/models:
get:
description: 按当前用户权限返回可用于 Playground 或 API 调用的模型列表。
parameters:
- description: 模型可选场景;不传时保持原有行为
enum:
- canvas_model_node
- desktop
in: query
name: usage_scene
type: string
produces:
- application/json
responses:
@@ -8622,6 +8646,10 @@ paths:
description: OK
schema:
$ref: '#/definitions/httpapi.PlatformModelListResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
"401":
description: Unauthorized
schema:
@@ -8630,6 +8658,10 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
"502":
description: Bad Gateway
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
security:
- BearerAuth: []
summary: 列出可调用模型