支持模型别名

This commit is contained in:
2026-07-04 15:01:24 +08:00
parent 03f9744dcb
commit aef01923b0
4 changed files with 13 additions and 5 deletions
+9 -1
View File
@@ -428,6 +428,10 @@ func (s *AdminReadService) Images(ctx context.Context, limit, offset int, kind s
if err != nil { if err != nil {
return nil, 0, nil, err return nil, 0, nil, err
} }
nameMap, err := s.models.NameMap(ctx)
if err != nil {
return nil, 0, nil, err
}
out := make([]map[string]any, 0, len(page)) out := make([]map[string]any, 0, len(page))
for _, item := range page { for _, item := range page {
row := map[string]any{ row := map[string]any{
@@ -443,7 +447,11 @@ func (s *AdminReadService) Images(ctx context.Context, limit, offset int, kind s
} }
if event, ok := index[item.Name]; ok { if event, ok := index[item.Name]; ok {
row["prompt"] = event.Prompt row["prompt"] = event.Prompt
row["model"] = event.Model if eff, ok := nameMap[event.Model]; ok && eff != "" {
row["model"] = eff
} else {
row["model"] = event.Model
}
row["resolution"] = event.Resolution row["resolution"] = event.Resolution
row["ratio"] = event.Ratio row["ratio"] = event.Ratio
row["duration"] = event.Duration row["duration"] = event.Duration
+2 -2
View File
@@ -230,7 +230,7 @@ const sourcePill = (s) => ({
<col class="w-32" /> <!-- time --> <col class="w-32" /> <!-- time -->
<col class="w-24" /> <!-- status --> <col class="w-24" /> <!-- status -->
<col class="w-28" /> <!-- user --> <col class="w-28" /> <!-- user -->
<col class="w-40" /> <!-- model --> <col class="w-56" /> <!-- model -->
<col /> <!-- prompt + error --> <col /> <!-- prompt + error -->
<col class="w-48" /> <!-- params --> <col class="w-48" /> <!-- params -->
<col class="w-16" /> <!-- credits --> <col class="w-16" /> <!-- credits -->
@@ -288,7 +288,7 @@ const sourcePill = (s) => ({
<div v-if="e.account" class="mt-0.5 text-[11px] text-white/45 truncate" :title="e.account">{{ e.account }}</div> <div v-if="e.account" class="mt-0.5 text-[11px] text-white/45 truncate" :title="e.account">{{ e.account }}</div>
</td> </td>
<td class="px-3 py-3.5 align-middle min-w-0"> <td class="px-3 py-3.5 align-middle min-w-0">
<div class="font-mono text-xs text-white/90 truncate" :title="e.model">{{ e.model }}</div> <div class="font-mono text-xs text-white/90 break-all" :title="e.model">{{ e.model }}</div>
<div class="mt-1 flex items-center gap-1.5 min-w-0"> <div class="mt-1 flex items-center gap-1.5 min-w-0">
<span class="text-[10px] uppercase tracking-wider font-medium truncate min-w-0" <span class="text-[10px] uppercase tracking-wider font-medium truncate min-w-0"
:class="e.kind === 'video' ? 'text-fuchsia-300/80' : 'text-indigo-300/80'"> :class="e.kind === 'video' ? 'text-fuchsia-300/80' : 'text-indigo-300/80'">
+1 -1
View File
@@ -165,7 +165,7 @@ onMounted(loadModels)
<td class="px-5 py-3.5 align-middle min-w-0"> <td class="px-5 py-3.5 align-middle min-w-0">
<div class="flex items-start gap-2 min-w-0"> <div class="flex items-start gap-2 min-w-0">
<div class="font-mono text-xs text-white/90 truncate" :title="m.id">{{ m.id }}</div> <div class="font-mono text-xs text-white/90 truncate" :title="m.id">{{ m.id }}</div>
<span v-if="m.alias" class="inline-flex items-center rounded-full px-2 py-0.5 text-[10px] bg-sky-500/10 text-sky-300 ring-1 ring-sky-400/20 shrink-0">别名: {{ m.alias }}</span> <span v-if="m.alias" class="inline-flex items-center rounded-full px-2 py-0.5 text-[10px] bg-sky-500/10 text-sky-300 ring-1 ring-sky-400/20 shrink-0">{{ m.alias }}</span>
</div> </div>
<div class="mt-1 text-[10px] text-white/45 capitalize truncate">{{ m.provider || '—' }}</div> <div class="mt-1 text-[10px] text-white/45 capitalize truncate">{{ m.provider || '—' }}</div>
</td> </td>
+1 -1
View File
@@ -212,7 +212,7 @@ onUnmounted(() => {
:title="e.prompt ? '点击复制提示词' : ''" :title="e.prompt ? '点击复制提示词' : ''"
@click.stop="copyPrompt(e)">{{ e.prompt }}</div> @click.stop="copyPrompt(e)">{{ e.prompt }}</div>
<div class="text-[10px] text-white/55 flex items-center justify-between gap-2 tabular-nums"> <div class="text-[10px] text-white/55 flex items-center justify-between gap-2 tabular-nums">
<span class="truncate" :title="e.model || ''">{{ e.model || '' }}</span> <span class="break-all" :title="e.model || ''">{{ e.model || '' }}</span>
<span class="shrink-0 flex items-center gap-1"> <span class="shrink-0 flex items-center gap-1">
<span v-if="e.resolution" class="text-emerald-300/90">{{ e.resolution }}</span> <span v-if="e.resolution" class="text-emerald-300/90">{{ e.resolution }}</span>
<span v-if="e.ratio" class="text-white/40">{{ e.ratio }}</span> <span v-if="e.ratio" class="text-white/40">{{ e.ratio }}</span>