mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-07 09:57:47 +08:00
Merge origin/main into main
This commit is contained in:
@@ -635,6 +635,53 @@ describe('RequestDetailDrawer settlement pricing', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('shows the Gemini thinkingConfig reasoning effort in the model header', async () => {
|
||||
apiMocks.getRequestDetail.mockResolvedValue({
|
||||
...buildEmbeddingDetail(),
|
||||
id: 'usage-gemini-thinking',
|
||||
request_id: 'usage-gemini-thinking',
|
||||
model: 'gemini-3.8-flash',
|
||||
request_type: 'chat',
|
||||
requested_reasoning_effort: 'xhigh',
|
||||
reasoning_effort: 'high',
|
||||
request_body: {
|
||||
generationConfig: {
|
||||
thinkingConfig: { includeThoughts: true, thinkingLevel: 'HIGH' },
|
||||
},
|
||||
},
|
||||
provider_request_body: {
|
||||
generationConfig: { thinkingConfig: { thinkingBudget: 8192 } },
|
||||
},
|
||||
})
|
||||
|
||||
let isOpen!: Ref<boolean>
|
||||
const Host = defineComponent({
|
||||
setup() {
|
||||
isOpen = ref(false)
|
||||
return () => h(RequestDetailDrawer, {
|
||||
isOpen: isOpen.value,
|
||||
requestId: 'usage-gemini-thinking',
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
const root = document.createElement('div')
|
||||
document.body.appendChild(root)
|
||||
const app = createApp(Host)
|
||||
app.mount(root)
|
||||
mountedApps.push({ app, root })
|
||||
|
||||
isOpen.value = true
|
||||
await nextTick()
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(document.body.querySelector('[data-request-detail-model-display]')?.textContent)
|
||||
.toContain('gemini-3.8-flash')
|
||||
expect(document.body.querySelector('[data-request-detail-model-badge="reasoning"]')?.textContent?.trim())
|
||||
.toBe('xhigh -> high')
|
||||
})
|
||||
})
|
||||
|
||||
it('lets a newer final-provider summary clear facts cached from an earlier candidate', async () => {
|
||||
apiMocks.getRequestDetail.mockResolvedValue({
|
||||
...buildEmbeddingDetail(),
|
||||
|
||||
@@ -440,6 +440,42 @@ describe('UsageRecordsTable', () => {
|
||||
.toBe('Fast')
|
||||
})
|
||||
|
||||
it('shows the Gemini thinkingLevel reasoning effort next to the model name', () => {
|
||||
const root = mountUsageRecordsTable([buildRecord({
|
||||
model: 'gemini-3.8-flash',
|
||||
requested_reasoning_effort: 'high',
|
||||
reasoning_effort: 'high',
|
||||
})])
|
||||
|
||||
expect(root.textContent).toContain('gemini-3.8-flash')
|
||||
const badge = root.querySelector('[data-usage-model-badge="reasoning"]')
|
||||
expect(badge?.textContent?.trim()).toBe('high')
|
||||
expect(badge?.getAttribute('title')).toBe('Reasoning: high')
|
||||
})
|
||||
|
||||
it('shows the Gemini thinkingLevel mapping when request and provider disagree', () => {
|
||||
const root = mountUsageRecordsTable([buildRecord({
|
||||
model: 'gemini-3.8-flash',
|
||||
requested_reasoning_effort: 'xhigh',
|
||||
reasoning_effort: 'high',
|
||||
})])
|
||||
|
||||
expect(root.textContent).toContain('xhigh -> high')
|
||||
expect(root.querySelector('[data-usage-model-badge="reasoning"]')?.textContent?.trim())
|
||||
.toBe('xhigh -> high')
|
||||
})
|
||||
|
||||
it('shows a disabled Gemini thinkingBudget as none', () => {
|
||||
const root = mountUsageRecordsTable([buildRecord({
|
||||
model: 'gemini-3.8-flash',
|
||||
requested_reasoning_effort: null,
|
||||
reasoning_effort: 'none',
|
||||
})])
|
||||
|
||||
expect(root.querySelector('[data-usage-model-badge="reasoning"]')?.textContent?.trim())
|
||||
.toBe('none')
|
||||
})
|
||||
|
||||
it('shows request reasoning effort while the record is pending', () => {
|
||||
const root = mountUsageRecordsTable([buildRecord({
|
||||
status: 'pending',
|
||||
|
||||
@@ -2063,17 +2063,23 @@ const quotaProgressMap = computed<Record<string, QuotaProgressItem[]>>(() => {
|
||||
const quotaProgressDisplayMap = computed<Record<string, QuotaProgressDisplayItem[]>>(() => {
|
||||
const map: Record<string, QuotaProgressDisplayItem[]> = {}
|
||||
for (const key of keyPage.value.keys) {
|
||||
map[key.key_id] = (quotaProgressMap.value[key.key_id] || []).map(item => ({
|
||||
label: getQuotaProgressLabel(item.label),
|
||||
remainingPercent: item.remainingPercent,
|
||||
resetText: getQuotaProgressResetDisplayText(item),
|
||||
meterText: item.numericOnly
|
||||
? item.detail || formatQuotaValue(item.remainingPercent)
|
||||
: getQuotaProgressMeterDisplayText(item),
|
||||
barClass: getQuotaRemainingBarColorByRemaining(item.remainingPercent),
|
||||
meterClass: getQuotaRemainingClassByRemaining(item.remainingPercent),
|
||||
numericOnly: item.numericOnly,
|
||||
}))
|
||||
map[key.key_id] = (quotaProgressMap.value[key.key_id] || []).map(item => {
|
||||
// 倒计时归零表示窗口已越过重置时间点:按“已重置”展示 100%,
|
||||
// 不再显示重置前的旧用量文本,与后端读取口径、调度口径保持一致。
|
||||
const expired = !item.numericOnly && getQuotaProgressCountdown(item)?.isExpired === true
|
||||
const remainingPercent = expired ? 100 : item.remainingPercent
|
||||
return {
|
||||
label: getQuotaProgressLabel(item.label),
|
||||
remainingPercent,
|
||||
resetText: getQuotaProgressResetDisplayText(item),
|
||||
meterText: item.numericOnly
|
||||
? item.detail || formatQuotaValue(remainingPercent)
|
||||
: getQuotaProgressMeterDisplayText(item, remainingPercent, expired),
|
||||
barClass: getQuotaRemainingBarColorByRemaining(remainingPercent),
|
||||
meterClass: getQuotaRemainingClassByRemaining(remainingPercent),
|
||||
numericOnly: item.numericOnly,
|
||||
}
|
||||
})
|
||||
}
|
||||
return map
|
||||
})
|
||||
@@ -3563,10 +3569,15 @@ function getQuotaProgressResetDisplayText(item: QuotaProgressItem): string {
|
||||
return ''
|
||||
}
|
||||
|
||||
function getQuotaProgressMeterDisplayText(item: QuotaProgressItem): string {
|
||||
const detail = item.detail?.trim() || ''
|
||||
function getQuotaProgressMeterDisplayText(
|
||||
item: QuotaProgressItem,
|
||||
remainingPercent = item.remainingPercent,
|
||||
suppressDetail = false,
|
||||
): string {
|
||||
// 窗口已重置时忽略重置前的旧用量文本,直接显示归一化后的剩余百分比。
|
||||
const detail = suppressDetail ? '' : (item.detail?.trim() || '')
|
||||
if (!shouldHideQuotaProgressDetailText(detail) && detail) return detail
|
||||
return `${item.remainingPercent.toFixed(1)}%`
|
||||
return `${remainingPercent.toFixed(1)}%`
|
||||
}
|
||||
|
||||
function getQuotaFallbackText(key: PoolKeyDetail): string | null {
|
||||
|
||||
@@ -35,6 +35,10 @@ const routeMocks = vi.hoisted(() => ({
|
||||
}),
|
||||
}))
|
||||
|
||||
const countdownMocks = vi.hoisted(() => ({
|
||||
isExpired: false,
|
||||
}))
|
||||
|
||||
const proxyStoreMocks = vi.hoisted(() => ({
|
||||
ensureLoaded: vi.fn(),
|
||||
}))
|
||||
@@ -106,7 +110,7 @@ vi.mock('@/composables/useCountdownTimer', async () => {
|
||||
start: vi.fn(),
|
||||
}),
|
||||
getCodexResetCountdown: () => ({
|
||||
isExpired: false,
|
||||
isExpired: countdownMocks.isExpired,
|
||||
text: '1h',
|
||||
}),
|
||||
}
|
||||
@@ -604,6 +608,7 @@ beforeEach(() => {
|
||||
window.sessionStorage.clear()
|
||||
routeMocks.patchQuery.mockClear()
|
||||
proxyStoreMocks.ensureLoaded.mockClear()
|
||||
countdownMocks.isExpired = false
|
||||
|
||||
endpointMocks.getPoolOverview.mockReset()
|
||||
endpointMocks.getPoolSchedulingPresets.mockReset()
|
||||
@@ -736,6 +741,44 @@ describe('PoolManagement Codex cycle stats mode', () => {
|
||||
expect(root.textContent).toContain('生图')
|
||||
})
|
||||
|
||||
it('shows expired Codex quota windows as fully restored', async () => {
|
||||
countdownMocks.isExpired = true
|
||||
const expiredKey = createPoolKey('codex', {
|
||||
status_snapshot: {
|
||||
oauth: { code: 'valid' },
|
||||
account: { code: 'ok', blocked: false },
|
||||
quota: {
|
||||
code: 'ok',
|
||||
exhausted: false,
|
||||
provider_type: 'codex',
|
||||
windows: [
|
||||
{
|
||||
code: '5h',
|
||||
label: '5H',
|
||||
scope: 'account',
|
||||
remaining_ratio: 0.12,
|
||||
reset_at: 1_700_000_000,
|
||||
window_minutes: 300,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
endpointMocks.getPoolOverview.mockResolvedValue({ items: [createOverview('codex')] })
|
||||
endpointMocks.listPoolKeys.mockResolvedValue(createKeyPage(expiredKey))
|
||||
endpointMocks.getProvider.mockResolvedValue(createProvider('codex'))
|
||||
|
||||
const root = mountPoolManagement()
|
||||
await settle()
|
||||
|
||||
// 倒计时归零后进度条与文本按“已重置”显示 100%,不再显示旧百分比。
|
||||
expect(root.querySelector('[data-testid="pool-quota-meter-text"]')?.textContent?.trim()).toBe('100.0%')
|
||||
const track = root.querySelector('[data-testid="pool-quota-progress-track"]')
|
||||
const bar = track?.firstElementChild as HTMLElement | null
|
||||
expect(bar?.style.width).toBe('100%')
|
||||
expect(root.querySelector('[data-testid="pool-quota-reset-text"]')).toBeNull()
|
||||
})
|
||||
|
||||
it('labels Codex quota by the actual refresh window duration', async () => {
|
||||
const monthlyCodexKey = createPoolKey('codex', {
|
||||
status_snapshot: {
|
||||
|
||||
Reference in New Issue
Block a user