polish usage output rate and installer progress

This commit is contained in:
fawney19
2026-05-07 13:39:25 +08:00
parent 0c03c188f1
commit 96f9be26da
3 changed files with 44 additions and 11 deletions

View File

@@ -289,10 +289,9 @@
:title="getRecordPerformanceTitle(record)"
>
<span class="whitespace-nowrap">{{ formatRecordLatencyPair(record) }}</span>
<span
v-if="getRecordDisplayOutputRate(record) != null"
class="text-muted-foreground tabular-nums whitespace-nowrap"
>{{ formatOutputRate(getRecordDisplayOutputRate(record)) }}</span>
<span class="text-muted-foreground tabular-nums whitespace-nowrap">
{{ formatOutputRate(getRecordDisplayOutputRate(record)) }}
</span>
</span>
<span
v-else
@@ -751,10 +750,9 @@
:title="getRecordPerformanceTitle(record)"
>
<span class="tabular-nums whitespace-nowrap">{{ formatRecordLatencyPair(record) }}</span>
<span
v-if="getRecordDisplayOutputRate(record) != null"
class="text-muted-foreground tabular-nums whitespace-nowrap"
>{{ formatOutputRate(getRecordDisplayOutputRate(record)) }}</span>
<span class="text-muted-foreground tabular-nums whitespace-nowrap">
{{ formatOutputRate(getRecordDisplayOutputRate(record)) }}
</span>
</div>
<span
v-else

View File

@@ -172,6 +172,27 @@ describe('UsageRecordsTable', () => {
expect(titles.join('\n')).not.toContain('首字后生成耗时')
})
it('shows an output speed placeholder when the rate is unavailable', () => {
const root = mountUsageRecordsTable([buildRecord({
output_tokens: 0,
response_time_ms: 1000,
first_byte_time_ms: 500,
})])
const performanceCell = root.querySelector('table tbody tr td:last-child') as HTMLElement
expect(performanceCell.textContent).toContain('0.50s / 1.00s')
expect([...performanceCell.querySelectorAll<HTMLElement>('.text-muted-foreground')]
.some((element) => element.textContent?.trim() === '-')).toBe(true)
const titles = [...root.querySelectorAll<HTMLElement>('[title]')].map((element) => element.title)
expect(titles).toContain([
'首字: 0.50s',
'总耗时: 1.00s',
'生成耗时: 0.50s',
'输出速度: -',
].join('\n'))
})
it('keeps active request latency in one first-byte / live-total line without TPS', () => {
const root = mountUsageRecordsTable([buildRecord({
status: 'streaming',

View File

@@ -308,10 +308,24 @@ detect_arch() {
download_to() {
local url="$1"
local output="$2"
local mode="${3:-quiet}"
local show_progress="false"
if [[ "${mode}" == "progress" && -t 2 ]]; then
show_progress="true"
fi
if command -v curl >/dev/null 2>&1; then
curl -fsSL "${url}" -o "${output}"
if [[ "${show_progress}" == "true" ]]; then
curl -fL --progress-bar "${url}" -o "${output}"
else
curl -fsSL "${url}" -o "${output}"
fi
elif command -v wget >/dev/null 2>&1; then
wget -qO "${output}" "${url}"
if [[ "${show_progress}" == "true" ]]; then
wget -O "${output}" "${url}"
else
wget -qO "${output}" "${url}"
fi
else
die "curl or wget is required to download release assets"
fi
@@ -431,7 +445,7 @@ download_or_unpack_bundle() {
sums_file="${TMP_ROOT}/SHA256SUMS"
info "downloading ${asset} from ${REPO}"
download_to "${base_url}/${asset}" "${archive_file}"
download_to "${base_url}/${asset}" "${archive_file}" progress
download_to "${base_url}/SHA256SUMS" "${sums_file}"
verify_checksum "${sums_file}" "${archive_file}"
tar -xzf "${archive_file}" -C "${TMP_ROOT}"