mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
thread switching
This commit is contained in:
parent
63c6b6bec5
commit
edf9dc9279
1 changed files with 10 additions and 3 deletions
|
|
@ -85,13 +85,20 @@ export const SidebarChat = () => {
|
|||
const abortFnRef = useRef<(() => void) | null>(null)
|
||||
|
||||
// higher level state
|
||||
const { allThreads, currentThread, addMessageToHistory, startNewThread, } = useThreads()
|
||||
const { allThreads, currentThread, addMessageToHistory, startNewThread, switchToThread } = useThreads()
|
||||
const { voidConfig } = useVoidConfig()
|
||||
|
||||
// if they pressed the + to add a new chat
|
||||
useOnVSCodeMessage('startNewThread', (m) => {
|
||||
if (currentThread?.messages.length !== 0)
|
||||
startNewThread()
|
||||
// find a thread with 0 messages and switch to it
|
||||
for (let threadId in allThreads) {
|
||||
if (allThreads[threadId].messages.length === 0) {
|
||||
switchToThread(threadId)
|
||||
return
|
||||
}
|
||||
}
|
||||
// start a new thread
|
||||
startNewThread()
|
||||
})
|
||||
|
||||
// if user pressed ctrl+l, add their selection to the sidebar
|
||||
|
|
|
|||
Loading…
Reference in a new issue