(threadId)
| 45 | } |
| 46 | |
| 47 | const cleanupThreadState = (threadId) => { |
| 48 | if (!threadId) return |
| 49 | const threadState = chatState.threadStates[threadId] |
| 50 | if (!threadState) return |
| 51 | |
| 52 | if (typeof onBeforeCleanupThread === 'function') { |
| 53 | onBeforeCleanupThread(threadId) |
| 54 | } |
| 55 | |
| 56 | if (threadState.runStreamAbortController) { |
| 57 | threadState.runStreamAbortController.abort() |
| 58 | } |
| 59 | delete chatState.threadStates[threadId] |
| 60 | } |
| 61 | |
| 62 | const resetOnGoingConv = (threadId = null) => { |
| 63 | const targetThreadId = |