* 删除会话
(id: string)
| 624 | * 删除会话 |
| 625 | */ |
| 626 | async function deleteSession(id: string): Promise<boolean> { |
| 627 | try { |
| 628 | const success = await useDataService().deleteSession(id) |
| 629 | if (success) { |
| 630 | const index = sessions.value.findIndex((s) => s.id === id) |
| 631 | if (index !== -1) { |
| 632 | sessions.value.splice(index, 1) |
| 633 | } |
| 634 | if (currentSessionId.value === id) { |
| 635 | currentSessionId.value = null |
| 636 | } |
| 637 | await loadSessions() |
| 638 | } |
| 639 | return success |
| 640 | } catch (error) { |
| 641 | console.error('删除会话失败:', error) |
| 642 | return false |
| 643 | } |
| 644 | } |
| 645 | |
| 646 | /** |
| 647 | * 重命名会话 |
nothing calls this directly
no test coverage detected