feat: 添加全局人设与头像设置并优化对话及弹窗交互

This commit is contained in:
2026-09-05 22:26:12 +08:00
parent 644beaf599
commit 57f507598a
17 changed files with 443 additions and 22 deletions
@@ -21,7 +21,7 @@ it('distinguishes unreported tokens from zero and switches to request counts', a
})
it('stacks models inside the source column and keeps their shades distinct', () => {
it('shades by consumed metric and gives equal usage equal shades', async () => {
const models = [100, 200].map((count, index) => ({ key: `m${index}`, provider_id: 'p', model: `model-${index}`, requests: 1, totals: { input_tokens: count }, coverage: { input_tokens: 1 } }))
const wrapper = mount(UsageChart, { props: { buckets: [{ date: '2026-09-05', end_date: '2026-09-05', local: { requests: 0, totals: {}, coverage: {} }, api: { requests: 2, totals: { input_tokens: 300 }, coverage: { input_tokens: 2 }, models } }] } })
const segments = wrapper.findAll('.model-segment')
@@ -29,5 +29,11 @@ it('stacks models inside the source column and keeps their shades distinct', ()
expect(segments[0]!.attributes('style')).not.toBe(segments[1]!.attributes('style'))
expect(wrapper.get('.model-legend').text()).toContain('model-1')
expect(segments[0]!.attributes('title')).toContain('100')
// happy-dom drops color-mix declarations; inspect the bound color values.
const colors = wrapper.vm as unknown as {modelColor:(key:string,source:'api') => string}
expect(colors.modelColor('m0','api')).toContain('67.5%')
expect(colors.modelColor('m1','api')).toContain('95%')
await wrapper.get('select').setValue('requests')
expect(colors.modelColor('m0','api')).toBe(colors.modelColor('m1','api'))
wrapper.unmount()
})