feat: 添加模型上下文管理并统一主题组件与用量交互

This commit is contained in:
2026-09-05 21:58:37 +08:00
parent 031ab135d2
commit 7551716e13
33 changed files with 738 additions and 38 deletions
@@ -91,3 +91,21 @@ it.each(['providers', 'skills'])('ignores initialization after unmount while %s
expect(returned.get('button.button-primary').attributes('disabled')).toBeUndefined()
returned.unmount()
})
it('sends on Enter but preserves Shift+Enter and IME confirmation', async () => {
const chat = useChatStore()
const send = vi.spyOn(chat, 'sendMessage').mockResolvedValue(undefined)
const wrapper = mount(ChatView)
await flushPromises()
const input = wrapper.get('textarea')
await input.setValue('问题')
await input.trigger('keydown', { key: 'Enter', isComposing: true })
await input.trigger('keydown', { key: 'Enter', shiftKey: true })
expect(send).not.toHaveBeenCalled()
await input.trigger('keydown', { key: 'Enter' })
expect(send).toHaveBeenCalledWith('问题')
await input.trigger('keydown', { key: 'Enter', repeat: true })
expect(send).toHaveBeenCalledTimes(1)
wrapper.unmount()
})