Merge origin/main into main

This commit is contained in:
elky
2026-10-05 12:10:23 +08:00
22 changed files with 2050 additions and 50 deletions
@@ -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',