fix: route escape abort through busy stub
This commit is contained in:
13
src/App.tsx
13
src/App.tsx
@@ -52,6 +52,7 @@ import {
|
|||||||
updateSessionAgent,
|
updateSessionAgent,
|
||||||
updateSessionModel,
|
updateSessionModel,
|
||||||
agents,
|
agents,
|
||||||
|
isSessionBusy,
|
||||||
} from "./stores/sessions"
|
} from "./stores/sessions"
|
||||||
import { setupTabKeyboardShortcuts } from "./lib/keyboard"
|
import { setupTabKeyboardShortcuts } from "./lib/keyboard"
|
||||||
import { isOpen as isCommandPaletteOpen, showCommandPalette, hideCommandPalette } from "./stores/command-palette"
|
import { isOpen as isCommandPaletteOpen, showCommandPalette, hideCommandPalette } from "./stores/command-palette"
|
||||||
@@ -725,17 +726,9 @@ const App: Component = () => {
|
|||||||
|
|
||||||
const sessions = getSessions(instance.id)
|
const sessions = getSessions(instance.id)
|
||||||
const session = sessions.find((s) => s.id === sessionId)
|
const session = sessions.find((s) => s.id === sessionId)
|
||||||
if (!session || session.messages.length === 0) return false
|
if (!session) return false
|
||||||
|
|
||||||
const lastMessage = session.messages[session.messages.length - 1]
|
return isSessionBusy(instance.id, sessionId)
|
||||||
const messageInfo = session.messagesInfo.get(lastMessage.id)
|
|
||||||
|
|
||||||
const timeCompleted = messageInfo?.time?.completed
|
|
||||||
return (
|
|
||||||
lastMessage.type === "assistant" &&
|
|
||||||
messageInfo !== undefined &&
|
|
||||||
(timeCompleted === undefined || timeCompleted === 0)
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
async () => {
|
async () => {
|
||||||
if (showFolderSelection()) {
|
if (showFolderSelection()) {
|
||||||
|
|||||||
@@ -43,7 +43,11 @@ class KeyboardRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private matches(event: KeyboardEvent, shortcut: KeyboardShortcut): boolean {
|
private matches(event: KeyboardEvent, shortcut: KeyboardShortcut): boolean {
|
||||||
const keyMatch = event.key.toLowerCase() === shortcut.key.toLowerCase()
|
const shortcutKey = shortcut.key.toLowerCase()
|
||||||
|
const eventKey = event.key ? event.key.toLowerCase() : ""
|
||||||
|
const eventCode = event.code ? event.code.toLowerCase() : ""
|
||||||
|
|
||||||
|
const keyMatch = eventKey === shortcutKey || eventCode === shortcutKey
|
||||||
const ctrlMatch = event.ctrlKey === (shortcut.modifiers.ctrl ?? false)
|
const ctrlMatch = event.ctrlKey === (shortcut.modifiers.ctrl ?? false)
|
||||||
const metaMatch = event.metaKey === (shortcut.modifiers.meta ?? false)
|
const metaMatch = event.metaKey === (shortcut.modifiers.meta ?? false)
|
||||||
const shiftMatch = event.shiftKey === (shortcut.modifiers.shift ?? false)
|
const shiftMatch = event.shiftKey === (shortcut.modifiers.shift ?? false)
|
||||||
|
|||||||
@@ -649,6 +649,14 @@ function getSessionFamily(instanceId: string, parentId: string): Session[] {
|
|||||||
return [parent, ...children]
|
return [parent, ...children]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isSessionBusy(instanceId: string, sessionId: string): boolean {
|
||||||
|
const instanceSessions = sessions().get(instanceId)
|
||||||
|
if (!instanceSessions) return false
|
||||||
|
if (!instanceSessions.has(sessionId)) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
async function loadMessages(instanceId: string, sessionId: string, force = false): Promise<void> {
|
async function loadMessages(instanceId: string, sessionId: string, force = false): Promise<void> {
|
||||||
// If force reload, clear the loaded cache
|
// If force reload, clear the loaded cache
|
||||||
if (force) {
|
if (force) {
|
||||||
@@ -1416,6 +1424,7 @@ export {
|
|||||||
getParentSessions,
|
getParentSessions,
|
||||||
getChildSessions,
|
getChildSessions,
|
||||||
getSessionFamily,
|
getSessionFamily,
|
||||||
|
isSessionBusy,
|
||||||
updateSessionAgent,
|
updateSessionAgent,
|
||||||
updateSessionModel,
|
updateSessionModel,
|
||||||
getDefaultModel,
|
getDefaultModel,
|
||||||
|
|||||||
Reference in New Issue
Block a user