Compare commits

..

1 Commits

Author SHA1 Message Date
waleed
43d02953a2 fix(model): validate default model against available options 2026-02-13 11:30:02 -08:00

View File

@@ -23,7 +23,7 @@ import { ParallelTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/compo
import { getDisplayValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block' import { getDisplayValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block'
import { getBlock } from '@/blocks/registry' import { getBlock } from '@/blocks/registry'
import type { CopilotToolCall } from '@/stores/panel' import type { CopilotToolCall } from '@/stores/panel'
import { useCopilotStore, usePanelStore } from '@/stores/panel' import { useCopilotStore } from '@/stores/panel'
import type { SubAgentContentBlock } from '@/stores/panel/copilot/types' import type { SubAgentContentBlock } from '@/stores/panel/copilot/types'
import { useWorkflowStore } from '@/stores/workflows/workflow/store' import { useWorkflowStore } from '@/stores/workflows/workflow/store'
@@ -341,20 +341,16 @@ export function OptionsSelector({
const [hoveredIndex, setHoveredIndex] = useState(-1) const [hoveredIndex, setHoveredIndex] = useState(-1)
const [chosenKey, setChosenKey] = useState<string | null>(selectedOptionKey) const [chosenKey, setChosenKey] = useState<string | null>(selectedOptionKey)
const containerRef = useRef<HTMLDivElement>(null) const containerRef = useRef<HTMLDivElement>(null)
const activeTab = usePanelStore((s) => s.activeTab)
const isLocked = chosenKey !== null const isLocked = chosenKey !== null
// Handle keyboard navigation - only for the active options selector when copilot is active // Handle keyboard navigation - only for the active options selector
useEffect(() => { useEffect(() => {
if (isInteractionDisabled || !enableKeyboardNav || isLocked) return if (isInteractionDisabled || !enableKeyboardNav || isLocked) return
const handleKeyDown = (e: KeyboardEvent) => { const handleKeyDown = (e: KeyboardEvent) => {
if (e.defaultPrevented) return if (e.defaultPrevented) return
// Only handle keyboard shortcuts when the copilot panel is active
if (activeTab !== 'copilot') return
const activeElement = document.activeElement const activeElement = document.activeElement
const isInputFocused = const isInputFocused =
activeElement?.tagName === 'INPUT' || activeElement?.tagName === 'INPUT' ||
@@ -391,7 +387,7 @@ export function OptionsSelector({
document.addEventListener('keydown', handleKeyDown) document.addEventListener('keydown', handleKeyDown)
return () => document.removeEventListener('keydown', handleKeyDown) return () => document.removeEventListener('keydown', handleKeyDown)
}, [isInteractionDisabled, enableKeyboardNav, isLocked, sortedOptions, hoveredIndex, onSelect, activeTab]) }, [isInteractionDisabled, enableKeyboardNav, isLocked, sortedOptions, hoveredIndex, onSelect])
if (sortedOptions.length === 0) return null if (sortedOptions.length === 0) return null