()
| 4440 | } |
| 4441 | |
| 4442 | async function clearChatHistory() { |
| 4443 | const count = state.chatHistory.length; |
| 4444 | if (!count) { |
| 4445 | showFeedbackToast("warning", ui().chat.noHistoryTitle, ui().chat.noHistoryDetail); |
| 4446 | return; |
| 4447 | } |
| 4448 | const confirmed = window.confirm(ui().chat.clearConfirm(count)); |
| 4449 | if (!confirmed) return; |
| 4450 | const data = await api("/api/chat/sessions/clear", { |
| 4451 | method: "POST", |
| 4452 | body: JSON.stringify({ user_id: currentUser() }) |
| 4453 | }); |
| 4454 | state.chatSessionId = ""; |
| 4455 | state.chatHistory = []; |
| 4456 | state.chatHistoryGroups = []; |
| 4457 | resetChatThread(); |
| 4458 | renderChatSources([]); |
| 4459 | renderChatHistory({ sessions: [], groups: [] }); |
| 4460 | showFeedbackToast("success", ui().chat.clearedTitle, ui().chat.clearedDetail(data.deleted || count)); |
| 4461 | } |
| 4462 | |
| 4463 | function startNewChat(options = {}) { |
| 4464 | state.chatSessionId = ""; |
nothing calls this directly
no test coverage detected