更新统计

This commit is contained in:
2026-07-05 19:52:47 +08:00
parent d7056de56e
commit 07aa50e8ff
2 changed files with 10 additions and 2 deletions
+9 -1
View File
@@ -429,7 +429,7 @@ func (s *AdminReadService) Images(ctx context.Context, limit, offset int, kind s
if offset < 0 {
offset = 0
}
allFiles, stats, err := s.scanGeneratedFiles(ctx)
allFiles, _, err := s.scanGeneratedFiles(ctx)
if err != nil {
return nil, 0, nil, err
}
@@ -441,11 +441,19 @@ func (s *AdminReadService) Images(ctx context.Context, limit, offset int, kind s
pinned = set
}
}
// KPI stats must reflect what the manager actually shows, so recompute them
// after dropping showcase files (independent of the kind tab filter).
stats := map[string]any{"total": 0, "image": 0, "video": 0, "size_bytes": int64(0)}
filtered := make([]generatedFile, 0, len(allFiles))
for _, item := range allFiles {
if _, ok := pinned[strings.TrimLeft(item.Name, "/")]; ok {
continue
}
if _, ok := stats[item.Kind]; ok {
stats[item.Kind] = stats[item.Kind].(int) + 1
}
stats["total"] = stats["total"].(int) + 1
stats["size_bytes"] = stats["size_bytes"].(int64) + item.Size
if kind == "" || item.Kind == kind {
filtered = append(filtered, item)
}
+1 -1
View File
@@ -88,7 +88,7 @@ const currentLabel = computed(() => {
</button>
<router-link to="/settings" title="设置" @click="onSettings"
:class="$route.path === '/settings' ? 'rail-bottom active' : 'rail-bottom'">
<Icon name="accounts" class="w-4 h-4" />
<Icon name="config" class="w-4 h-4" />
</router-link>
</div>
</aside>