mirror of
https://github.com/EKKOLearnAI/hermes-web-ui.git
synced 2026-05-29 23:40:16 +00:00
7e777fd661
问题描述:\n- 刷新页面、切后台或手机锁屏后,进行中的对话容易丢失,SSE 断开时前端还会插入假的错误气泡\n- 移动端首屏会话列表会短暂遮住聊天区\n- 桌面端侧栏无法折叠,在窄窗口和缩放场景占用过多横向空间\n\n复现路径:\n- 发起一轮对话,在模型仍在输出时刷新页面或锁屏后再回到页面\n- 在窄屏设备首次打开聊天页,观察会话列表首帧覆盖聊天内容\n- 在桌面端缩窄浏览器窗口,观察侧栏始终保持完整宽度\n\n修复思路:\n- 为 chat store 增加本地缓存、水合、in-flight 标记和轮询恢复,SSE 断开后静默从服务端回补真实结果\n- 将运行中指示统一到 isRunActive,让实时流式与恢复轮询共享同一状态\n- 在 ChatPanel 首帧同步读取媒体查询,避免移动端会话列表闪烁覆盖\n- 为侧栏增加可持久化的桌面折叠状态,并补充对应文案与回归测试
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
// @vitest-environment jsdom
|
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
import { createPinia, setActivePinia } from 'pinia'
|
|
|
|
const mockSystemApi = vi.hoisted(() => ({
|
|
checkHealth: vi.fn(),
|
|
fetchAvailableModels: vi.fn(),
|
|
updateDefaultModel: vi.fn(),
|
|
triggerUpdate: vi.fn(),
|
|
}))
|
|
|
|
vi.mock('@/api/hermes/system', () => mockSystemApi)
|
|
|
|
import { useAppStore } from '@/stores/hermes/app'
|
|
|
|
describe('App Store', () => {
|
|
beforeEach(() => {
|
|
setActivePinia(createPinia())
|
|
vi.clearAllMocks()
|
|
window.localStorage.clear()
|
|
})
|
|
|
|
it('persists desktop sidebar collapsed state to localStorage', () => {
|
|
const store = useAppStore()
|
|
|
|
expect(store.sidebarCollapsed).toBe(false)
|
|
|
|
store.toggleSidebarCollapsed()
|
|
expect(store.sidebarCollapsed).toBe(true)
|
|
expect(window.localStorage.getItem('hermes_sidebar_collapsed')).toBe('1')
|
|
|
|
store.toggleSidebarCollapsed()
|
|
expect(store.sidebarCollapsed).toBe(false)
|
|
expect(window.localStorage.getItem('hermes_sidebar_collapsed')).toBe('0')
|
|
})
|
|
})
|