From b9cccc7bee310b2d4879b69975c26ed34b883876 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Sat, 11 Jul 2026 07:14:35 +0800 Subject: [PATCH] feat(system): expose model concurrency stats on runtime queues dashboard Surface per-model active/waiting/limit from the background task limiter so admins can distinguish task scheduling from model-service throttling, with full i18n coverage. --- frontend/src/api/system/index.ts | 10 +++ frontend/src/i18n/locales/en-US.ts | 10 +++ frontend/src/i18n/locales/ko-KR.ts | 10 +++ frontend/src/i18n/locales/ru-RU.ts | 10 +++ frontend/src/i18n/locales/zh-CN.ts | 10 +++ frontend/src/views/system/RuntimeQueues.vue | 82 ++++++++++++++++++- internal/handler/system.go | 23 ++++-- internal/models/chat/concurrency_wrapper.go | 4 +- .../models/embedding/concurrency_wrapper.go | 4 +- internal/models/limiter/governor.go | 68 ++++++++++++++- internal/models/limiter/limiter.go | 75 +++++++++++++++-- internal/models/vlm/concurrency_wrapper.go | 2 +- 12 files changed, 286 insertions(+), 22 deletions(-) diff --git a/frontend/src/api/system/index.ts b/frontend/src/api/system/index.ts index bd05e581..1c7b5762 100644 --- a/frontend/src/api/system/index.ts +++ b/frontend/src/api/system/index.ts @@ -509,6 +509,14 @@ export interface RuntimeWorkerPool { queue_count: number } +export interface ModelRuntimeStat { + model_id: string + name: string + active: number + waiting: number + limit: number +} + /** * Runtime queue dashboard payload. `available` is false in Lite mode * (no Redis/asynq) — render an "unavailable in this deployment" state @@ -523,6 +531,8 @@ export interface RuntimeQueuesResponse { wiki_concurrency: number pools: RuntimeWorkerPool[] queues: QueueStat[] + model_limiter_available: boolean + models: ModelRuntimeStat[] timestamp: number } diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts index 91d3b798..0aa2e348 100755 --- a/frontend/src/i18n/locales/en-US.ts +++ b/frontend/src/i18n/locales/en-US.ts @@ -3506,6 +3506,16 @@ export default { attention: "Attention", paused: "Paused", }, + models: { + title: "Model concurrency", + description: "Actual model-service concurrency from background tasks. The section above schedules tasks; this section shows the separate model-service throttle stage.", + scope: "Active is cluster-wide · waiting is local", + disabled: "Background model concurrency governance is disabled. Configure the default model concurrency limit in Global settings.", + empty: "No model activity yet. A model appears after its first background call.", + backgroundOnly: "Background tasks only; interactive chat is excluded", + columns: { model: "Model ID", active: "In flight", waiting: "Throttled", usage: "Concurrency" }, + status: { queued: "Throttling", full: "At limit" }, + }, pools: { core: "Core parsing", enrichment: "Enrichment", diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts index 2ad91da9..7d644ba5 100755 --- a/frontend/src/i18n/locales/ko-KR.ts +++ b/frontend/src/i18n/locales/ko-KR.ts @@ -2511,6 +2511,16 @@ export default { attention: "확인 필요", paused: "일시중지됨", }, + models: { + title: "모델 동시성", + description: "백그라운드 작업이 실제로 모델 서비스에 진입할 때의 동시성입니다. 위 섹션은 작업 스케줄링이고, 이 섹션은 별도의 모델 서비스 스로틀 단계입니다.", + scope: "실행 중은 클러스터 전체 · 대기는 로컬", + disabled: "백그라운드 모델 동시성 제어가 비활성화되어 있습니다. 전역 설정에서 모델 기본 동시성 상한을 구성하세요.", + empty: "아직 모델 활동이 없습니다. 첫 백그라운드 호출 후 모델이 표시됩니다.", + backgroundOnly: "백그라운드 작업만; 대화형 채팅은 제외", + columns: { model: "모델 ID", active: "실행 중", waiting: "스로틀 대기", usage: "동시성" }, + status: { queued: "스로틀 중", full: "한도 도달" }, + }, pools: { core: "핵심 파싱", enrichment: "콘텐츠 보강", diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts index bd6858fe..2ebf5e12 100755 --- a/frontend/src/i18n/locales/ru-RU.ts +++ b/frontend/src/i18n/locales/ru-RU.ts @@ -2209,6 +2209,16 @@ export default { attention: "Требует внимания", paused: "Приостановлено", }, + models: { + title: "Параллелизм моделей", + description: "Фактический параллелизм вызовов модели из фоновых задач. Раздел выше планирует задачи; этот раздел показывает отдельный этап ограничения на стороне модели.", + scope: "Активные — по всему кластеру · ожидающие — локально", + disabled: "Управление фоновым параллелизмом моделей отключено. Настройте лимит по умолчанию в глобальных настройках.", + empty: "Пока нет данных о вызовах моделей. Модель появится после первого фонового вызова.", + backgroundOnly: "Только фоновые задачи; интерактивный чат не учитывается", + columns: { model: "ID модели", active: "В работе", waiting: "Ожидание ограничения", usage: "Параллелизм" }, + status: { queued: "Ограничение", full: "На лимите" }, + }, pools: { core: "Основной разбор", enrichment: "Обогащение", diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index 4eb19214..a86b2f86 100755 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -2514,6 +2514,16 @@ export default { attention: "需关注", paused: "已暂停", }, + models: { + title: "模型并发占用", + description: "观察后台任务实际进入模型服务时的并发占用;上方是任务调度,这里是模型服务限流,两者处于不同处理阶段。", + scope: "占用为集群全局 · 等待为当前实例", + disabled: "模型后台并发治理未启用。可在全局设置中配置模型默认并发上限。", + empty: "暂无模型调用数据;模型首次执行后台任务后会出现在这里。", + backgroundOnly: "仅统计后台任务,不包含交互式对话", + columns: { model: "模型 ID", active: "调用中", waiting: "限流等待", usage: "并发用量" }, + status: { queued: "限流中", full: "已满载" }, + }, pools: { core: "核心解析", enrichment: "内容富化", diff --git a/frontend/src/views/system/RuntimeQueues.vue b/frontend/src/views/system/RuntimeQueues.vue index 32398dbb..9dfbf7e7 100644 --- a/frontend/src/views/system/RuntimeQueues.vue +++ b/frontend/src/views/system/RuntimeQueues.vue @@ -59,7 +59,7 @@ -
+
{{ t('system.globalSettings.runtime.unavailableTitle') }} @@ -68,6 +68,7 @@
@@ -190,7 +231,7 @@