From 52d5258b10c02b0a7e14988423640a745598099c Mon Sep 17 00:00:00 2001 From: Rhonin Wang <33801807+RhoninSeiei@users.noreply.github.com> Date: Sat, 14 Mar 2026 20:50:40 +0800 Subject: [PATCH] feat: display latency when testing model connection (#6258) Co-authored-by: RhoninSeiei --- dashboard/src/composables/useProviderSources.ts | 4 +++- dashboard/src/i18n/locales/en-US/features/provider.json | 1 + dashboard/src/i18n/locales/zh-CN/features/provider.json | 1 + dashboard/src/views/ProviderPage.vue | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dashboard/src/composables/useProviderSources.ts b/dashboard/src/composables/useProviderSources.ts index 8c1256284..53959ca3e 100644 --- a/dashboard/src/composables/useProviderSources.ts +++ b/dashboard/src/composables/useProviderSources.ts @@ -590,9 +590,11 @@ export function useProviderSources(options: UseProviderSourcesOptions) { async function testProvider(provider: any) { testingProviders.value.push(provider.id) try { + const startTime = performance.now() const response = await axios.get('/api/config/provider/check_one', { params: { id: provider.id } }) if (response.data.status === 'ok' && response.data.data.error === null) { - showMessage(tm('models.testSuccess', { id: provider.id })) + const latency = Math.max(0, Math.round(performance.now() - startTime)) + showMessage(tm('models.testSuccessWithLatency', { id: provider.id, latency })) } else { throw new Error(response.data.data.error || tm('models.testError')) } diff --git a/dashboard/src/i18n/locales/en-US/features/provider.json b/dashboard/src/i18n/locales/en-US/features/provider.json index f36053f72..87e26e225 100644 --- a/dashboard/src/i18n/locales/en-US/features/provider.json +++ b/dashboard/src/i18n/locales/en-US/features/provider.json @@ -132,6 +132,7 @@ "deleteSuccess": "Model deleted successfully", "deleteError": "Failed to delete model", "testSuccess": "Model {id} test passed", + "testSuccessWithLatency": "Model {id} test passed, latency {latency} ms", "testError": "Model test failed", "searchPlaceholder": "Search models or ID", "manualAddButton": "Custom Model", diff --git a/dashboard/src/i18n/locales/zh-CN/features/provider.json b/dashboard/src/i18n/locales/zh-CN/features/provider.json index cf3cdba0c..d3f5d95b1 100644 --- a/dashboard/src/i18n/locales/zh-CN/features/provider.json +++ b/dashboard/src/i18n/locales/zh-CN/features/provider.json @@ -133,6 +133,7 @@ "deleteSuccess": "模型删除成功", "deleteError": "模型删除失败", "testSuccess": "模型 {id} 测试通过", + "testSuccessWithLatency": "模型 {id} 测试通过,延迟 {latency} ms", "testError": "模型测试失败", "searchPlaceholder": "搜索模型或 ID", "manualAddButton": "自定义模型", diff --git a/dashboard/src/views/ProviderPage.vue b/dashboard/src/views/ProviderPage.vue index e9b6edd78..1203bbc9c 100644 --- a/dashboard/src/views/ProviderPage.vue +++ b/dashboard/src/views/ProviderPage.vue @@ -602,12 +602,15 @@ async function testSingleProvider(provider) { return } + const startTime = performance.now() const res = await axios.get(`/api/config/provider/check_one?id=${provider.id}`) if (res.data && res.data.status === 'ok') { const index = providerStatuses.value.findIndex(s => s.id === provider.id) if (index !== -1) { providerStatuses.value.splice(index, 1, res.data.data) } + const latency = Math.max(0, Math.round(performance.now() - startTime)) + showMessage(tm('models.testSuccessWithLatency', { id: provider.id, latency })) } else { throw new Error(res.data?.message || `Failed to check status for ${provider.id}`) }