From a58db6c2bf4c4b594f31401647bb2489060f9e6e Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Sun, 6 Apr 2025 14:22:15 -0700 Subject: [PATCH] Optima: parent the AIX Debugger Modal --- src/apps/chat/components/layout-pane/ChatPane.tsx | 15 ++------------- src/common/layout/optima/Modals.tsx | 8 ++++++-- src/common/layout/optima/OptimaLayout.tsx | 1 + src/common/layout/optima/store-layout-optima.ts | 8 ++++++++ src/common/layout/optima/useOptima.tsx | 1 + 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/apps/chat/components/layout-pane/ChatPane.tsx b/src/apps/chat/components/layout-pane/ChatPane.tsx index 842e7d0f3..03a0bc915 100644 --- a/src/apps/chat/components/layout-pane/ChatPane.tsx +++ b/src/apps/chat/components/layout-pane/ChatPane.tsx @@ -19,6 +19,7 @@ import { CodiconSplitVertical } from '~/common/components/icons/CodiconSplitVert import { CodiconSplitVerticalRemove } from '~/common/components/icons/CodiconSplitVerticalRemove'; import { FormLabelStart } from '~/common/components/forms/FormLabelStart'; import { OptimaPanelGroupedList, OptimaPanelGroupGutter } from '~/common/layout/optima/panel/OptimaPanelGroupedList'; +import { optimaActions } from '~/common/layout/optima/useOptima'; import { useLabsDevMode } from '~/common/stores/store-ux-labs'; import { useChatShowSystemMessages } from '../../store-app-chat'; @@ -100,15 +101,6 @@ export function ChatPane(props: { const handleToggleSystemMessages = () => setShowSystemMessages(!showSystemMessages); - // [DEV MODE] - - const [aixLastDispatchDialog, setAixLastDispatchDialog] = React.useState(null); - - const handleAixShowLastRequest = React.useCallback(() => { - setAixLastDispatchDialog( setAixLastDispatchDialog(null)} />); - }, []); - - return <> {/* Window group */} @@ -190,15 +182,12 @@ export function ChatPane(props: { {/* [DEV] Development */} {labsDevMode && ( - + AIX: Show Last Request... )} - {/* [DEV MODE] Show any dialog, if present */} - {aixLastDispatchDialog} - ; } \ No newline at end of file diff --git a/src/common/layout/optima/Modals.tsx b/src/common/layout/optima/Modals.tsx index 28b7c508c..bd74e9b28 100644 --- a/src/common/layout/optima/Modals.tsx +++ b/src/common/layout/optima/Modals.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; +import { AixDebuggerDialog } from '~/modules/aix/client/debugger/AixDebuggerDialog'; import { ModelsModal } from '~/modules/llms/models-modal/ModelsModal'; import { SettingsModal } from '../../../apps/settings-modal/SettingsModal'; import { ShortcutsModal } from '../../../apps/settings-modal/ShortcutsModal'; @@ -12,10 +13,10 @@ import { optimaActions, optimaOpenPreferences, useOptimaModals } from './useOpti export function Modals(props: { suspendAutoModelsSetup?: boolean }) { // external state - const { preferencesTab, showKeyboardShortcuts, showLogger, showPreferences } = useOptimaModals(); + const { preferencesTab, showAIXDebugger, showKeyboardShortcuts, showLogger, showPreferences } = useOptimaModals(); // derived state - const { closeKeyboardShortcuts, closeLogger, closePreferences, openKeyboardShortcuts } = optimaActions(); + const { closeAIXDebugger, closeKeyboardShortcuts, closeLogger, closePreferences, openKeyboardShortcuts } = optimaActions(); return <> @@ -34,6 +35,9 @@ export function Modals(props: { suspendAutoModelsSetup?: boolean }) { {/* Logger */} {showLogger && } + {/* AIX Debugger Dialog */} + {showAIXDebugger && } + {/* Overlay Shortcuts */} {showKeyboardShortcuts && ( diff --git a/src/common/layout/optima/OptimaLayout.tsx b/src/common/layout/optima/OptimaLayout.tsx index b22f36595..1413239d8 100644 --- a/src/common/layout/optima/OptimaLayout.tsx +++ b/src/common/layout/optima/OptimaLayout.tsx @@ -59,6 +59,7 @@ export function OptimaLayout(props: { suspendAutoModelsSetup?: boolean, children { key: ',', ctrl: true, action: optimaOpenPreferences }, { key: 'm', ctrl: true, shift: true, action: optimaOpenModels }, { key: 'g', ctrl: true, shift: true, action: optimaActions().openLogger }, + { key: 'a', ctrl: true, shift: true, action: optimaActions().openAIXDebugger }, // Font Scale { key: '+', ctrl: true, shift: true, action: useUIPreferencesStore.getState().increaseContentScaling }, { key: '-', ctrl: true, shift: true, action: useUIPreferencesStore.getState().decreaseContentScaling }, diff --git a/src/common/layout/optima/store-layout-optima.ts b/src/common/layout/optima/store-layout-optima.ts index fdb85e6cd..6931097ff 100644 --- a/src/common/layout/optima/store-layout-optima.ts +++ b/src/common/layout/optima/store-layout-optima.ts @@ -19,6 +19,7 @@ interface OptimaState { panelIsOpen: boolean; // modals + showAIXDebugger: boolean; showKeyboardShortcuts: boolean; showLogger: boolean; showModelOptions: DLLMId | false; @@ -51,6 +52,7 @@ const initialState: OptimaState = { panelIsOpen: false, // modals that can overlay anything + showAIXDebugger: false, showKeyboardShortcuts: false, showLogger: false, showModelOptions: false, @@ -75,6 +77,9 @@ export interface OptimaActions { openPanel: () => void; togglePanel: () => void; + closeAIXDebugger: () => void; + openAIXDebugger: () => void; + closeKeyboardShortcuts: () => void; openKeyboardShortcuts: () => void; @@ -116,6 +121,9 @@ export const useLayoutOptimaStore = create((_set, _ openPanel: () => _set({ panelIsOpen: true, lastPanelOpenTime: Date.now() }), togglePanel: () => _get().panelIsOpen ? _get().closePanel() : _get().openPanel(), + closeAIXDebugger: () => _set({ showAIXDebugger: false }), + openAIXDebugger: () => _set({ showAIXDebugger: true }), + closeKeyboardShortcuts: () => _set({ showKeyboardShortcuts: false }), openKeyboardShortcuts: () => _set({ showKeyboardShortcuts: true }), diff --git a/src/common/layout/optima/useOptima.tsx b/src/common/layout/optima/useOptima.tsx index 41bb721ef..98180a7f3 100644 --- a/src/common/layout/optima/useOptima.tsx +++ b/src/common/layout/optima/useOptima.tsx @@ -79,6 +79,7 @@ export function optimaOpenPreferences(changeTab?: PreferencesTabId) { export function useOptimaModals() { return useLayoutOptimaStore(useShallow(state => ({ + showAIXDebugger: state.showAIXDebugger, showKeyboardShortcuts: state.showKeyboardShortcuts, showLogger: state.showLogger, showModelOptions: state.showModelOptions,