diff --git a/control-plane-java/src/main/java/com/moyi/controlplane/catalog/CatalogService.java b/control-plane-java/src/main/java/com/moyi/controlplane/catalog/CatalogService.java index de45145..41ce7fb 100644 --- a/control-plane-java/src/main/java/com/moyi/controlplane/catalog/CatalogService.java +++ b/control-plane-java/src/main/java/com/moyi/controlplane/catalog/CatalogService.java @@ -49,7 +49,7 @@ public class CatalogService { public List> listModels(boolean includeDisabled) { String statusClause = " WHERE m.deleted_at IS NULL AND p.deleted_at IS NULL AND d.deleted_at IS NULL" + (includeDisabled ? "" : " AND m.status = 'active' AND p.status = 'active' AND d.status = 'active'"); - return jdbc.query("SELECT m.* FROM model_catalog m JOIN model_providers p ON p.id=m.provider_id JOIN model_definitions d ON d.id=m.logical_model_id" + statusClause + " ORDER BY m.public_name, m.source_label", this::mapModel); + return jdbc.query("SELECT m.*, d.vendor_name FROM model_catalog m JOIN model_providers p ON p.id=m.provider_id JOIN model_definitions d ON d.id=m.logical_model_id" + statusClause + " ORDER BY m.public_name, m.source_label", this::mapModel); } public List> listDefinitions(boolean includeDisabled) { @@ -58,6 +58,7 @@ public class CatalogService { item.put("id", rs.getString("id")); item.put("publicName", rs.getString("public_name")); item.put("modelKey", rs.getString("model_key")); + item.put("vendorName", rs.getString("vendor_name")); item.put("type", rs.getString("model_type")); item.put("mode", rs.getString("call_mode")); item.put("description", rs.getString("description")); @@ -78,13 +79,14 @@ public class CatalogService { String name = required(value, "publicName"); String type = required(value, "type"); String mode = required(value, "mode"); + String vendorName = optional(value, "vendorName", "未标注"); String status = status(value); - if (name.length() > 160 || !MODEL_TYPES.contains(type) || !CALL_MODES.contains(mode)) throw new ApiException("INVALID_MODEL", "模型名称、类型或调用模式无效"); + if (name.length() > 160 || vendorName.length() > 120 || !MODEL_TYPES.contains(type) || !CALL_MODES.contains(mode)) throw new ApiException("INVALID_MODEL", "模型名称、厂商、类型或调用模式无效"); if (creating) { id = UUID.randomUUID().toString(); - jdbc.update("INSERT INTO model_definitions (id, model_key, public_name, model_type, call_mode, description, input_types, output_types, status) VALUES (?, ?, ?, ?, ?, ?, CAST(? AS jsonb), CAST(? AS jsonb), ?)", id, optional(value, "modelKey", null), name, type, mode, optional(value, "description", ""), jsonArray(value.get("inputTypes")), jsonArray(value.get("outputTypes")), status); + jdbc.update("INSERT INTO model_definitions (id, model_key, public_name, vendor_name, model_type, call_mode, description, input_types, output_types, status) VALUES (?, ?, ?, ?, ?, ?, ?, CAST(? AS jsonb), CAST(? AS jsonb), ?)", id, optional(value, "modelKey", null), name, vendorName, type, mode, optional(value, "description", ""), jsonArray(value.get("inputTypes")), jsonArray(value.get("outputTypes")), status); } else { - jdbc.update("UPDATE model_definitions SET model_key=?, public_name=?, model_type=?, call_mode=?, description=?, input_types=CAST(? AS jsonb), output_types=CAST(? AS jsonb), status=?, updated_at=now() WHERE id=?", optional(value,"modelKey",null), name, type, mode, optional(value,"description",""), jsonArray(value.get("inputTypes")), jsonArray(value.get("outputTypes")), status, id); + jdbc.update("UPDATE model_definitions SET model_key=?, public_name=?, vendor_name=?, model_type=?, call_mode=?, description=?, input_types=CAST(? AS jsonb), output_types=CAST(? AS jsonb), status=?, updated_at=now() WHERE id=?", optional(value,"modelKey",null), name, vendorName, type, mode, optional(value,"description",""), jsonArray(value.get("inputTypes")), jsonArray(value.get("outputTypes")), status, id); jdbc.update("UPDATE model_catalog SET model_key=?, public_name=?, model_type=?, call_mode=?, description=?, input_types=CAST(? AS jsonb), output_types=CAST(? AS jsonb), updated_at=now() WHERE logical_model_id=? AND deleted_at IS NULL", optional(value,"modelKey",null), name, type, mode, optional(value,"description",""), jsonArray(value.get("inputTypes")), jsonArray(value.get("outputTypes")), id); } auth.audit(creating ? "model_definition.created" : "model_definition.updated", admin.id(), new AuthService.RequestMeta(null,null), Map.of("modelId",id)); @@ -371,6 +373,16 @@ public class CatalogService { } } + public Map requireOwnedKey(String sessionToken, String keyId, AuthService auth) { + var user = auth.requireUser(sessionToken); + try { + return jdbc.queryForObject("SELECT * FROM platform_api_keys WHERE id=? AND user_id=? AND status='active' AND deleted_at IS NULL", + this::mapApiKey, UUID.fromString(keyId), user.id()); + } catch (IllegalArgumentException | EmptyResultDataAccessException exception) { + throw new ApiException("INVALID_API_KEY", "请选择当前账号下已启用的 API Key", 403); + } + } + public Map activeModel(String id) { return findActiveModel(id); } @@ -406,12 +418,12 @@ public class CatalogService { } private Map findModel(String id) { - try { return jdbc.queryForObject("SELECT * FROM model_catalog WHERE id = ? AND deleted_at IS NULL", this::mapModel, id); } + try { return jdbc.queryForObject("SELECT m.*, d.vendor_name FROM model_catalog m JOIN model_definitions d ON d.id=m.logical_model_id WHERE m.id = ? AND m.deleted_at IS NULL", this::mapModel, id); } catch (EmptyResultDataAccessException exception) { return null; } } private Map findActiveModel(String id) { - try { return jdbc.queryForObject("SELECT m.* FROM model_catalog m JOIN model_providers p ON p.id=m.provider_id JOIN model_definitions d ON d.id=m.logical_model_id WHERE m.id = ? AND m.status = 'active' AND p.status='active' AND d.status='active' AND m.deleted_at IS NULL AND p.deleted_at IS NULL AND d.deleted_at IS NULL", this::mapModel, id); } + try { return jdbc.queryForObject("SELECT m.*, d.vendor_name FROM model_catalog m JOIN model_providers p ON p.id=m.provider_id JOIN model_definitions d ON d.id=m.logical_model_id WHERE m.id = ? AND m.status = 'active' AND p.status='active' AND d.status='active' AND m.deleted_at IS NULL AND p.deleted_at IS NULL AND d.deleted_at IS NULL", this::mapModel, id); } catch (EmptyResultDataAccessException exception) { return null; } } @@ -451,6 +463,7 @@ public class CatalogService { model.put("logicalModelId", resultSet.getString("logical_model_id")); model.put("providerId", resultSet.getString("provider_id")); putIfNotNull(model, "modelKey", resultSet.getString("model_key")); + putIfNotNull(model, "vendorName", resultSet.getString("vendor_name")); putIfNotNull(model, "sourceLabel", resultSet.getString("source_label")); model.put("publicName", resultSet.getString("public_name")); model.put("upstreamModel", resultSet.getString("upstream_model")); diff --git a/control-plane-java/src/main/java/com/moyi/controlplane/gateway/GatewayController.java b/control-plane-java/src/main/java/com/moyi/controlplane/gateway/GatewayController.java index ef09520..2ddd527 100644 --- a/control-plane-java/src/main/java/com/moyi/controlplane/gateway/GatewayController.java +++ b/control-plane-java/src/main/java/com/moyi/controlplane/gateway/GatewayController.java @@ -63,7 +63,12 @@ public class GatewayController { @RequestHeader(value = "Idempotency-Key", required = false) String idempotencyKey, HttpServletResponse servletResponse ) { - Map key = requireKey(authorization); + return executeChat(requireKey(authorization), input, idempotencyKey, servletResponse); + } + + // Both the public gateway and the authenticated playground share admission and billing. + public ResponseEntity> executeChat(Map key, + Map input, String idempotencyKey, HttpServletResponse servletResponse) { long startedAt = System.currentTimeMillis(); String modelId = String.valueOf(input.getOrDefault("model", "")); Map model = catalogService.activeModel(modelId); diff --git a/control-plane-java/src/main/java/com/moyi/controlplane/gateway/PlaygroundController.java b/control-plane-java/src/main/java/com/moyi/controlplane/gateway/PlaygroundController.java new file mode 100644 index 0000000..2ce8667 --- /dev/null +++ b/control-plane-java/src/main/java/com/moyi/controlplane/gateway/PlaygroundController.java @@ -0,0 +1,55 @@ +package com.moyi.controlplane.gateway; + +import com.moyi.controlplane.auth.AuthController; +import com.moyi.controlplane.auth.AuthService; +import com.moyi.controlplane.catalog.CatalogService; +import com.moyi.controlplane.common.ApiException; +import com.moyi.controlplane.task.AsyncTaskService; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import java.util.Map; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/api/playground/keys/{keyId}") +public class PlaygroundController { + private final AuthService auth; + private final CatalogService catalog; + private final GatewayController gateway; + private final AsyncTaskService tasks; + + public PlaygroundController(AuthService auth, CatalogService catalog, GatewayController gateway, AsyncTaskService tasks) { + this.auth = auth; + this.catalog = catalog; + this.gateway = gateway; + this.tasks = tasks; + } + + @PostMapping(value="/chat/completions", consumes="application/json") + public ResponseEntity> chat(@PathVariable String keyId, + @RequestBody Map input, + @RequestHeader(value="Idempotency-Key", required=false) String idempotencyKey, + HttpServletRequest request, HttpServletResponse response) { + return gateway.executeChat(requireKey(request, keyId), input, idempotencyKey, response); + } + + @PostMapping(value="/{type:3d|video}/tasks", consumes="application/json") + public ResponseEntity> createTask(@PathVariable String keyId, @PathVariable String type, + @RequestBody Map input, HttpServletRequest request) { + return ResponseEntity.accepted().body(Map.of("task", tasks.createForKey(requireKey(request, keyId), type, input))); + } + + @GetMapping("/tasks/{taskId}") + public Map task(@PathVariable String keyId, @PathVariable String taskId, HttpServletRequest request) { + return Map.of("task", tasks.getForKey(requireKey(request, keyId), taskId)); + } + + private Map requireKey(HttpServletRequest request, String keyId) { + // A custom header prevents cross-site forms from spending a cookie-authenticated wallet. + // Cross-origin scripts must pass the existing explicit CORS origin allowlist. + if (!"playground".equals(request.getHeader("X-Moyi-Source"))) + throw new ApiException("PLAYGROUND_REQUEST_REQUIRED", "请通过在线调试页面发起调用", 403); + return catalog.requireOwnedKey(AuthController.sessionToken(request), keyId, auth); + } +} diff --git a/control-plane-java/src/main/java/com/moyi/controlplane/task/AsyncTaskService.java b/control-plane-java/src/main/java/com/moyi/controlplane/task/AsyncTaskService.java index 851fd65..1dd5f62 100644 --- a/control-plane-java/src/main/java/com/moyi/controlplane/task/AsyncTaskService.java +++ b/control-plane-java/src/main/java/com/moyi/controlplane/task/AsyncTaskService.java @@ -49,7 +49,11 @@ public class AsyncTaskService { @Transactional public Map create(String authorization, String taskType, Map input) { - Map key = requireKey(authorization); + return createForKey(requireKey(authorization), taskType, input); + } + + @Transactional + public Map createForKey(Map key, String taskType, Map input) { gatewayGuard.checkRate(UUID.fromString(String.valueOf(key.get("id"))), false); String modelId = String.valueOf(input.getOrDefault("model", "")); Map model = catalogService.activeModel(modelId); @@ -77,7 +81,10 @@ public class AsyncTaskService { } public Map get(String authorization, String taskId) { - Map key = requireKey(authorization); + return getForKey(requireKey(authorization), taskId); + } + + public Map getForKey(Map key, String taskId) { UUID userId = catalogService.keyOwnerId(UUID.fromString(String.valueOf(key.get("id")))); try { return jdbc.queryForObject("SELECT * FROM model_tasks WHERE id = ? AND user_id = ?", this::mapTask, taskId, userId); diff --git a/control-plane-java/src/main/resources/db/migration/V16__model_manufacturers.sql b/control-plane-java/src/main/resources/db/migration/V16__model_manufacturers.sql new file mode 100644 index 0000000..db952bf --- /dev/null +++ b/control-plane-java/src/main/resources/db/migration/V16__model_manufacturers.sql @@ -0,0 +1,24 @@ +ALTER TABLE model_definitions + ADD COLUMN IF NOT EXISTS vendor_name varchar(120) NOT NULL DEFAULT '未标注'; + +-- Give the models imported by the relay catalog a useful initial manufacturer. +-- Administrators can correct the label from 模型与分组 at any time. +UPDATE model_definitions +SET vendor_name = CASE + WHEN lower(coalesce(model_key, '') || ' ' || coalesce(public_name, '')) ~ '(openai|gpt-|^gpt|o1|o3|o4)' THEN 'OpenAI' + WHEN lower(coalesce(model_key, '') || ' ' || coalesce(public_name, '')) ~ '(glm|chatglm|zhipu|智谱)' THEN '智谱 AI' + WHEN lower(coalesce(model_key, '') || ' ' || coalesce(public_name, '')) ~ '(kimi|moonshot|月之暗面)' THEN '月之暗面' + WHEN lower(coalesce(model_key, '') || ' ' || coalesce(public_name, '')) ~ '(doubao|seed|豆包)' THEN '字节跳动' + WHEN lower(coalesce(model_key, '') || ' ' || coalesce(public_name, '')) ~ 'deepseek' THEN 'DeepSeek' + WHEN lower(coalesce(model_key, '') || ' ' || coalesce(public_name, '')) ~ '(claude|anthropic)' THEN 'Anthropic' + WHEN lower(coalesce(model_key, '') || ' ' || coalesce(public_name, '')) ~ '(gemini|google)' THEN 'Google' + WHEN lower(coalesce(model_key, '') || ' ' || coalesce(public_name, '')) ~ '(qwen|tongyi|通义)' THEN '阿里云' + WHEN lower(coalesce(model_key, '') || ' ' || coalesce(public_name, '')) ~ '(llama|meta)' THEN 'Meta' + WHEN lower(coalesce(model_key, '') || ' ' || coalesce(public_name, '')) ~ 'mistral' THEN 'Mistral AI' + WHEN lower(coalesce(model_key, '') || ' ' || coalesce(public_name, '')) ~ '(grok|xai)' THEN 'xAI' + WHEN lower(coalesce(model_key, '') || ' ' || coalesce(public_name, '')) ~ 'minimax' THEN 'MiniMax' + WHEN lower(coalesce(model_key, '') || ' ' || coalesce(public_name, '')) ~ 'tripo' THEN 'Tripo' + WHEN lower(coalesce(model_key, '') || ' ' || coalesce(public_name, '')) ~ '(runway|midjourney)' THEN '其他图像/视频厂商' + ELSE '未标注' +END +WHERE vendor_name = '未标注'; diff --git a/control-plane-java/src/test/java/com/moyi/controlplane/PlatformAdminPostgresTest.java b/control-plane-java/src/test/java/com/moyi/controlplane/PlatformAdminPostgresTest.java index e9ecc14..4938f0b 100644 --- a/control-plane-java/src/test/java/com/moyi/controlplane/PlatformAdminPostgresTest.java +++ b/control-plane-java/src/test/java/com/moyi/controlplane/PlatformAdminPostgresTest.java @@ -106,8 +106,9 @@ class PlatformAdminPostgresTest { var channel = catalog.createProvider(Map.of("code","test-relay","name","Relay","protocol","openai-compatible","sourceType","relay","baseUrl","https://example.test/v1","credentialType","api-key","credentialSecret","only-a-test-secret"), ownerToken, auth); String channelId = channel.get("id").toString(); String cipher = jdbc.queryForObject("SELECT credential_ciphertext FROM model_providers WHERE id=?", String.class, channelId); - var model = catalog.saveDefinition(null,Map.of("publicName","Test Model","type","text","mode","sync"),ownerToken,auth); + var model = catalog.saveDefinition(null,Map.of("publicName","Test Model","vendorName","OpenAI","type","text","mode","sync"),ownerToken,auth); String modelId = model.get("id").toString(); + assertEquals("OpenAI", model.get("vendorName")); var first = catalog.createModel(Map.of("logicalModelId",modelId,"providerId",channelId,"sourceLabel","Primary","upstreamModel","upstream-a"),ownerToken,auth); String firstId = first.get("id").toString(); var second = catalog.createModel(Map.of("logicalModelId",modelId,"providerId",channelId,"sourceLabel","Backup","upstreamModel","upstream-b"),ownerToken,auth); diff --git a/prototype/src/components/AccountAdmin.vue b/prototype/src/components/AccountAdmin.vue index 73bcc12..7eccd42 100644 --- a/prototype/src/components/AccountAdmin.vue +++ b/prototype/src/components/AccountAdmin.vue @@ -134,10 +134,14 @@ async function copyText(value: string) { .account-search { max-width: 420px; } .account-secondary { display: block; margin-top: 5px; color: #687378; } .wallet-entry { border-bottom: 1px solid #dce3e5; padding: 16px 0; overflow-wrap: anywhere; } -.invitation-panel { margin-top: 24px; } +.invitation-panel { margin-top: 24px; padding: 24px 28px 28px; } +.invitation-panel .panel-header { margin: 0 0 18px; padding: 0; } +.invitation-panel .responsive-table { overflow-x: auto; } +.invitation-panel th, .invitation-panel td { padding-left: 14px; padding-right: 14px; } .invitation-panel code { overflow-wrap: anywhere; } .invitation-panel .icon-button { margin-left: 8px; vertical-align: middle; } .form-hint { color: #687378; font-size: 13px; } .credit-error { color: #b44837; } @media(max-width: 700px) { .heading-actions { flex-wrap: wrap; } } +@media(max-width: 700px) { .invitation-panel { padding: 18px 16px 20px; } .invitation-panel .panel-header { margin-bottom: 14px; } } diff --git a/prototype/src/components/CatalogAdmin.vue b/prototype/src/components/CatalogAdmin.vue index 9635a91..92cc646 100644 --- a/prototype/src/components/CatalogAdmin.vue +++ b/prototype/src/components/CatalogAdmin.vue @@ -28,9 +28,9 @@ async function remove() { finally { saving.value = false } } const channel = reactive({ code: '', name: '', protocol: 'openai-compatible' as CatalogProvider['protocol'], sourceType: 'relay' as CatalogProvider['sourceType'], baseUrl: '', credentialType: 'api-key' as NonNullable, credentialSecret: '', description: '', status: 'active' as CatalogProvider['status'] }) -const model = reactive({ publicName: '', modelKey: '', type: 'text' as LogicalModel['type'], mode: 'sync' as LogicalModel['mode'], description: '', inputTypes: 'text', outputTypes: 'text', status: 'active' as LogicalModel['status'] }) -const group = reactive({ logicalModelId: '', providerId: '', sourceLabel: '', upstreamModel: '', input: '', output: '', cachedInput: '', unit: 'CNY / 1M tokens', priority: '100', maxConcurrency: '1', status: 'active' as CatalogModel['status'] }) -const shownModels = computed(() => models.value.filter(item => `${item.publicName} ${item.modelKey || ''}`.toLowerCase().includes(query.value.toLowerCase()))) +const model = reactive({ publicName: '', modelKey: '', vendorName: '', type: 'text' as LogicalModel['type'], mode: 'sync' as LogicalModel['mode'], description: '', inputTypes: 'text', outputTypes: 'text', status: 'active' as LogicalModel['status'] }) +const group = reactive({ logicalModelId: '', providerId: '', sourceLabel: '', upstreamModel: '', input: '', output: '', cachedInput: '', unit: 'CNY / 1M tokens', priority: '100', maxConcurrency: '4', status: 'active' as CatalogModel['status'] }) +const shownModels = computed(() => models.value.filter(item => `${item.publicName} ${item.vendorName || ''} ${item.modelKey || ''}`.toLowerCase().includes(query.value.toLowerCase()))) const shownChannels = computed(() => channels.value.filter(item => `${item.name} ${item.code}`.toLowerCase().includes(query.value.toLowerCase()))) const { page: modelPage, pageSize: modelPageSize, pagedItems: pagedModels } = usePagination(shownModels) const { page: channelPage, pageSize: channelPageSize, pagedItems: pagedChannels } = usePagination(shownChannels) @@ -59,12 +59,12 @@ function editChannel(item?: CatalogProvider) { } function editModel(item?: LogicalModel) { editingId.value = item?.id - Object.assign(model, { publicName: '', modelKey: '', type: 'text', mode: 'sync', description: '', status: 'active' }, item || {}, { inputTypes: item?.inputTypes.join(', ') || 'text', outputTypes: item?.outputTypes.join(', ') || 'text' }) + Object.assign(model, { publicName: '', modelKey: '', vendorName: '', type: 'text', mode: 'sync', description: '', status: 'active' }, item || {}, { inputTypes: item?.inputTypes.join(', ') || 'text', outputTypes: item?.outputTypes.join(', ') || 'text' }) editor.value = 'model' } function editGroup(parent: LogicalModel, item?: CatalogModel) { editingId.value = item?.id - Object.assign(group, { logicalModelId: parent.id, providerId: item?.providerId || '', sourceLabel: item?.sourceLabel || '', upstreamModel: item?.upstreamModel || '', input: item?.pricing?.input?.toString() || '', output: item?.pricing?.output?.toString() || '', cachedInput: item?.pricing?.cachedInput?.toString() || '', unit: item?.pricing?.unit || 'CNY / 1M tokens', priority: String(item?.priority ?? 100), maxConcurrency: String(item?.maxConcurrency ?? 1), status: item?.status || 'active' }) + Object.assign(group, { logicalModelId: parent.id, providerId: item?.providerId || '', sourceLabel: item?.sourceLabel || '', upstreamModel: item?.upstreamModel || '', input: item?.pricing?.input?.toString() || '', output: item?.pricing?.output?.toString() || '', cachedInput: item?.pricing?.cachedInput?.toString() || '', unit: item?.pricing?.unit || 'CNY / 1M tokens', priority: String(item?.priority ?? 100), maxConcurrency: String(item?.maxConcurrency ?? 4), status: item?.status || 'active' }) editor.value = 'group' } async function save() { @@ -108,13 +108,13 @@ async function toggle(kind: 'channel' | 'model' | 'group', item: CatalogProvider

{{ props.section === 'channels' ? '渠道管理' : '模型与分组' }}

{{ error }}

-

启用模型后会显示在用户端模型广场。分组与所属渠道也启用后,用户才能为 API Key 选择该分组;调用前还需完成凭据和计费配置。

+

启用模型后会显示在用户端模型广场。模型厂商表示模型的实际研发方,渠道表示请求经过的中转站或官方接口;分组与所属渠道也启用后,用户才能为 API Key 选择该分组。并发上限按分组生效,填 1 才是串行,填 4 表示同一分组最多同时处理 4 个请求。

加载中…

渠道来源 / 协议Base URL凭据状态操作
{{ item.name }}{{ item.code }}{{ item.sourceType }}{{ item.protocol }}{{ item.baseUrl || '未配置' }}{{ item.credentialMasked || '未配置' }}
暂无渠道
diff --git a/prototype/src/components/ModelGroupPermissions.vue b/prototype/src/components/ModelGroupPermissions.vue index 72cee49..a80fb1d 100644 --- a/prototype/src/components/ModelGroupPermissions.vue +++ b/prototype/src/components/ModelGroupPermissions.vue @@ -11,14 +11,14 @@ const query = ref('') const onlySelected = ref(false) const expanded = ref([]) const models = computed(() => [...new Map(props.groups.map(group => [group.logicalModelId || group.id, group])).entries()].map(([id, model]) => ({ - id, name: model.name, modelKey: model.modelKey, + id, name: model.name, vendorName: model.vendorName, modelKey: model.modelKey, groups: props.groups.filter(group => (group.logicalModelId || group.id) === id), }))) const selectedGroups = computed(() => props.groups.filter(group => props.modelValue.includes(group.id))) const selectedCount = computed(() => models.value.filter(model => model.groups.some(group => props.modelValue.includes(group.id))).length) const unavailable = computed(() => props.modelValue.filter(id => !props.groups.some(group => group.id === id))) const filtered = computed(() => models.value.filter(model => { - const text = `${model.name} ${model.modelKey || ''} ${model.groups.map(group => `${group.provider} ${group.sourceLabel}`).join(' ')}`.toLowerCase() + const text = `${model.name} ${model.vendorName || ''} ${model.modelKey || ''} ${model.groups.map(group => `${group.provider} ${group.sourceLabel}`).join(' ')}`.toLowerCase() return text.includes(query.value.trim().toLowerCase()) && (!onlySelected.value || model.groups.some(group => props.modelValue.includes(group.id))) })) const { page, pageSize, pagedItems } = usePagination(filtered, 8) @@ -41,11 +41,11 @@ function clear() { expanded.value = []; emit('update:modelValue', []) } 已选 {{ selectedCount }} 个模型 · {{ selectedGroups.length }} 个可用分组 · {{ unavailable.length }} 个暂不可用授权
- +
- +
{{ model.name }} 的可调用分组

请选择至少一个分组以授权该模型。