* 从数据库加载会话列表
()
| 164 | * 从数据库加载会话列表 |
| 165 | */ |
| 166 | async function loadSessions() { |
| 167 | try { |
| 168 | const list = await useDataService().getSessions() |
| 169 | sessions.value = list |
| 170 | // 如果当前选中的会话不存在了,清除选中状态 |
| 171 | if (currentSessionId.value && !list.find((s) => s.id === currentSessionId.value)) { |
| 172 | currentSessionId.value = null |
| 173 | } |
| 174 | isInitialized.value = true |
| 175 | } catch (error) { |
| 176 | console.error('加载会话列表失败:', error) |
| 177 | isInitialized.value = true |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * 选择文件并导入 |
no test coverage detected