Fix/usage transfer filter (#307)

* fix(usage): 恢复 usage 列表中的 fallback 路由信号

* fix(admin): 支持 usage 记录展示和筛选 fallback 转移

* fix(usage): 在用户 usage 记录中暴露 fallback 标记

* fix(usage): 共享 usage 页面支持 fallback 筛选

* fix(usage): 对齐 fallback 筛选相关前端类型

* fix(usage): propagate has_fallback through active polling

---------

Co-authored-by: fawney19 <[email protected]>
This commit is contained in:
RWDai
2026-04-17 13:38:23 +08:00
committed by GitHub
co-authored by fawney19
parent 654a41c3b0
commit ff4e853fd3
15 changed files with 298 additions and 49 deletions
@@ -401,6 +401,7 @@ export function useUsageData(options: UseUsageDataOptions) {
api_format: existing.api_format || record.api_format,
endpoint_api_format: existing.endpoint_api_format || record.endpoint_api_format,
has_format_conversion: existing.has_format_conversion ?? record.has_format_conversion,
has_fallback: existing.has_fallback === true || record.has_fallback === true,
api_key_name: existing.api_key_name || record.api_key_name,
provider_key_name: existing.provider_key_name || record.provider_key_name,
rate_multiplier: existing.rate_multiplier ?? record.rate_multiplier,
@@ -1,6 +1,6 @@
import { ref, computed, type Ref } from 'vue'
import type { UsageRecord, FilterStatusValue } from '../types'
import { isUsageRecordFailed } from '../utils/status'
import { hasUsageFallback, isUsageRecordFailed } from '../utils/status'
export interface UseUsageFiltersOptions {
/** 所有记录的响应式引用 */
@@ -79,6 +79,8 @@ export function useUsageFilters(options: UseUsageFiltersOptions) {
records = records.filter(record => isUsageRecordFailed(record))
} else if (filterStatus.value === 'cancelled') {
records = records.filter(record => record.status === 'cancelled')
} else if (filterStatus.value === 'has_fallback') {
records = records.filter(record => hasUsageFallback(record))
}
}