mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-25 08:00:55 +00:00
Move shared components and helpers to their actual owners, standardize component directory names, and use concise names for common utilities. Remove redundant wrappers, copied API models, and duplicate state. Separate API key editing from key usage, isolate settings drafts, reuse paged queries, and tie debounced queries and requests to their scopes. Validated with frontend lint, type checking and production build, local import checks, and 15 temporary behavioral regression groups. Co-authored-by: Codex <noreply@openai.com>
77 lines
2.8 KiB
Vue
77 lines
2.8 KiB
Vue
<script setup lang="ts">
|
||
import type { UsageListRecord } from '@/api'
|
||
|
||
import { computed } from 'vue'
|
||
import UsageDetailPopover from '@/components/usage/UsageDetailPopover.vue'
|
||
import { usageLatencyDetails } from './shared/presenter'
|
||
|
||
const props = defineProps<{
|
||
record: Pick<UsageListRecord, 'latencyDetails' | 'firstTokenLatencyMs' | 'latencyMs'>
|
||
}>()
|
||
|
||
const latencyDetails = computed(() => usageLatencyDetails(props.record))
|
||
</script>
|
||
|
||
<template>
|
||
<div class="flex items-center justify-end gap-1.5">
|
||
<div
|
||
class="grid grid-cols-[auto_auto] items-center justify-end gap-x-2 gap-y-1.5 whitespace-nowrap font-mono text-cp-sm leading-none font-heavy tabular-nums"
|
||
>
|
||
<span class="text-cp-xs text-cp-text-quaternary">{{ latencyDetails.firstOutputLabel }}</span>
|
||
<span class="text-cp-text-secondary">{{ latencyDetails.firstOutputDisplay }}</span>
|
||
<span class="text-cp-xs text-cp-text-quaternary">总耗时</span>
|
||
<span class="text-cp-text">{{ latencyDetails.totalDisplay }}</span>
|
||
</div>
|
||
|
||
<UsageDetailPopover title="延迟明细" trigger-label="查看延迟明细">
|
||
<div
|
||
v-if="latencyDetails.breakdownItems.length"
|
||
class="grid gap-1.5 text-cp-text-secondary"
|
||
>
|
||
<div
|
||
v-for="item in latencyDetails.breakdownItems"
|
||
:key="item.label"
|
||
class="flex justify-between gap-4"
|
||
>
|
||
<span class="whitespace-nowrap">{{ item.label }}</span>
|
||
<span class="whitespace-nowrap font-mono font-heavy text-cp-text">
|
||
{{ item.value }}
|
||
</span>
|
||
</div>
|
||
</div>
|
||
<p v-else class="m-0 text-cp-text-quaternary">
|
||
此记录未采集完整的阶段耗时
|
||
</p>
|
||
|
||
<div class="flex justify-between border-t border-cp-split pt-2">
|
||
<span class="whitespace-nowrap text-cp-text-secondary">总耗时</span>
|
||
<span class="whitespace-nowrap font-mono font-heavy text-cp-info-text">
|
||
{{ latencyDetails.totalDisplay }}
|
||
</span>
|
||
</div>
|
||
|
||
<div
|
||
v-if="latencyDetails.transportItems.length"
|
||
class="grid gap-1.5 border-t border-cp-split pt-2 text-cp-text-secondary"
|
||
>
|
||
<p class="m-0 font-heavy text-cp-text">
|
||
传输观测
|
||
</p>
|
||
<div
|
||
v-for="item in latencyDetails.transportItems"
|
||
:key="item.label"
|
||
class="flex justify-between gap-4"
|
||
>
|
||
<span class="whitespace-nowrap">{{ item.label }}</span>
|
||
<span class="whitespace-nowrap font-mono font-heavy text-cp-text">
|
||
{{ item.value }}
|
||
</span>
|
||
</div>
|
||
<p class="m-0 text-cp-xs leading-snug text-cp-text-quaternary">
|
||
与阶段耗时可能重叠,不参与总耗时相加
|
||
</p>
|
||
</div>
|
||
</UsageDetailPopover>
|
||
</div>
|
||
</template>
|