feat: 前端离线部署适配与在线模型测试延迟展示

- 移除 index.html 中 Google Fonts 外链,适配离线部署环境
- 侧边栏用户头像改为显示姓名首字母,去掉 picsum 占位图外链
- 在线模型测试补充 latency_ms 延迟字段展示
- api_key 为空时传空字符串避免校验报错

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
wuyongtao
2026-08-11 16:34:06 +08:00
parent b5d2cd7935
commit ae39c45a73
4 changed files with 16 additions and 7 deletions

View File

@@ -107,7 +107,13 @@ export const testOnlineModel = (data: {
api_key: string
online_model_name: string
}) =>
post<{ success: boolean; error?: string; model?: string; usage?: object }>(
post<{
success: boolean
error?: string
model?: string
usage?: object
latency_ms?: number
}>(
'/model-manage/test-online',
data,
)

View File

@@ -180,7 +180,7 @@ async function handleLogout() {
<!-- 底部信息 -->
<div class="sidebar-footer">
<div class="footer-user" v-if="auth.username">
<el-avatar :size="36" src="https://picsum.photos/id/1005/36/36" class="user-avatar" />
<el-avatar :size="36" class="user-avatar">{{ auth.displayName?.slice(0, 1) || '?' }}</el-avatar>
<div class="user-info">
<span class="user-name">{{ auth.displayName }}</span>
<span class="user-role">{{ auth.roleLabel }}</span>

View File

@@ -38,7 +38,13 @@ const form = reactive<ModelForm>({
// 在线模型测试
const testLoading = ref(false)
const testResult = ref<{ success: boolean; error?: string; model?: string; usage?: object } | null>(null)
const testResult = ref<{
success: boolean
error?: string
model?: string
usage?: object
latency_ms?: number
} | null>(null)
const rules: FormRules = {
name: [
@@ -149,7 +155,7 @@ async function handleTestOnline() {
const start = Date.now()
const res = await testOnlineModel({
api_url: form.api_url,
api_key: form.api_key,
api_key: form.api_key || '',
online_model_name: form.online_model_name,
})
const data = res as any