mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-28 19:05:31 +02:00
fix new chat
This commit is contained in:
parent
bea8a904eb
commit
df27bc1898
1 changed files with 8 additions and 3 deletions
|
|
@ -1740,9 +1740,14 @@ function App() {
|
||||||
}, [activeFileTabId])
|
}, [activeFileTabId])
|
||||||
|
|
||||||
const handleNewChatTab = useCallback(() => {
|
const handleNewChatTab = useCallback(() => {
|
||||||
// If current chat tab already has a run, open a new tab
|
// If there's already an empty "New chat" tab, switch to it
|
||||||
const activeTab = chatTabs.find(t => t.id === activeChatTabId)
|
const emptyTab = chatTabs.find(t => !t.runId)
|
||||||
if (activeTab?.runId) {
|
if (emptyTab) {
|
||||||
|
if (emptyTab.id !== activeChatTabId) {
|
||||||
|
setActiveChatTabId(emptyTab.id)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Create a new tab
|
||||||
const id = newChatTabId()
|
const id = newChatTabId()
|
||||||
setChatTabs(prev => [...prev, { id, runId: null }])
|
setChatTabs(prev => [...prev, { id, runId: null }])
|
||||||
setActiveChatTabId(id)
|
setActiveChatTabId(id)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue