| ... | ... | @@ -524,7 +524,6 @@ export default function ChatView({ threadId }: ChatViewProps) { |
| 524 | 524 | const pendingUserScrollUpIntentRef = useRef(false); |
| 525 | 525 | const pendingAutoScrollFrameRef = useRef<number | null>(null); |
| 526 | 526 | const composerEditorRef = useRef<ComposerPromptEditorHandle>(null); |
| 527 | | const composerCommandInputRef = useRef<HTMLInputElement>(null); |
| 528 | 527 | const composerFormRef = useRef<HTMLFormElement>(null); |
| 529 | 528 | const composerFormHeightRef = useRef(0); |
| 530 | 529 | const composerImagesRef = useRef<ComposerImageAttachment[]>([]); |
| ... | ... | @@ -633,7 +632,8 @@ export default function ChatView({ threadId }: ChatViewProps) { |
| 633 | 632 | [selectedModel, settings.customCodexModels], |
| 634 | 633 | ); |
| 635 | 634 | const slashModelOptions = useMemo( |
| 636 | | () => getSlashModelOptions(settings.customCodexModels, composerTrigger?.query ?? "", selectedModel), |
| 635 | () => |
| 636 | getSlashModelOptions(settings.customCodexModels, composerTrigger?.query ?? "", selectedModel), |
| 637 | 637 | [composerTrigger?.query, selectedModel, settings.customCodexModels], |
| 638 | 638 | ); |
| 639 | 639 | const phase = derivePhase(activeThread?.session ?? null); |
| ... | ... | @@ -912,12 +912,12 @@ export default function ChatView({ threadId }: ChatViewProps) { |
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | return slashModelOptions.map(({ slug, name }) => ({ |
| 915 | | id: `model:${slug}`, |
| 916 | | type: "model" as const, |
| 917 | | model: slug, |
| 918 | | label: name, |
| 919 | | description: slug, |
| 920 | | })); |
| 915 | id: `model:${slug}`, |
| 916 | type: "model" as const, |
| 917 | model: slug, |
| 918 | label: name, |
| 919 | description: slug, |
| 920 | })); |
| 921 | 921 | }, [composerTrigger, slashModelOptions, workspaceEntries]); |
| 922 | 922 | const composerMenuOpen = Boolean(composerTrigger); |
| 923 | 923 | const activeComposerMenuItem = useMemo( |
| ... | ... | @@ -2312,12 +2312,9 @@ export default function ChatView({ threadId }: ChatViewProps) { |
| 2312 | 2312 | return; |
| 2313 | 2313 | } |
| 2314 | 2314 | if (item.type === "slash-command") { |
| 2315 | | const applied = applyPromptReplacement( |
| 2316 | | trigger.rangeStart, |
| 2317 | | trigger.rangeEnd, |
| 2318 | | "/model ", |
| 2319 | | { expectedText: expectedToken }, |
| 2320 | | ); |
| 2315 | const applied = applyPromptReplacement(trigger.rangeStart, trigger.rangeEnd, "/model ", { |
| 2316 | expectedText: expectedToken, |
| 2317 | }); |
| 2321 | 2318 | if (applied) { |
| 2322 | 2319 | setComposerHighlightedItemId(null); |
| 2323 | 2320 | } |
| ... | ... | @@ -2360,18 +2357,27 @@ export default function ChatView({ threadId }: ChatViewProps) { |
| 2360 | 2357 | workspaceEntriesQuery.isLoading || |
| 2361 | 2358 | workspaceEntriesQuery.isFetching); |
| 2362 | 2359 | |
| 2363 | | const onPromptChange = useCallback((nextPrompt: string, nextCursor: number, cursorAdjacentToMention: boolean) => { |
| 2364 | | promptRef.current = nextPrompt; |
| 2365 | | setPrompt(nextPrompt); |
| 2366 | | setComposerCursor(nextCursor); |
| 2367 | | setComposerTrigger( |
| 2368 | | cursorAdjacentToMention |
| 2369 | | ? null |
| 2370 | | : detectComposerTrigger(nextPrompt, expandCollapsedComposerCursor(nextPrompt, nextCursor)), |
| 2371 | | ); |
| 2372 | | }, [setPrompt]); |
| 2360 | const onPromptChange = useCallback( |
| 2361 | (nextPrompt: string, nextCursor: number, cursorAdjacentToMention: boolean) => { |
| 2362 | promptRef.current = nextPrompt; |
| 2363 | setPrompt(nextPrompt); |
| 2364 | setComposerCursor(nextCursor); |
| 2365 | setComposerTrigger( |
| 2366 | cursorAdjacentToMention |
| 2367 | ? null |
| 2368 | : detectComposerTrigger( |
| 2369 | nextPrompt, |
| 2370 | expandCollapsedComposerCursor(nextPrompt, nextCursor), |
| 2371 | ), |
| 2372 | ); |
| 2373 | }, |
| 2374 | [setPrompt], |
| 2375 | ); |
| 2373 | 2376 | |
| 2374 | | const onComposerCommandKey = (key: "ArrowDown" | "ArrowUp" | "Enter" | "Tab", event: KeyboardEvent) => { |
| 2377 | const onComposerCommandKey = ( |
| 2378 | key: "ArrowDown" | "ArrowUp" | "Enter" | "Tab", |
| 2379 | event: KeyboardEvent, |
| 2380 | ) => { |
| 2375 | 2381 | const { trigger } = resolveActiveComposerTrigger(); |
| 2376 | 2382 | const menuIsActive = composerMenuOpenRef.current || trigger !== null; |
| 2377 | 2383 | |
| ... | ... | @@ -2778,7 +2784,6 @@ export default function ChatView({ threadId }: ChatViewProps) { |
| 2778 | 2784 | {isGitRepo && ( |
| 2779 | 2785 | <BranchToolbar |
| 2780 | 2786 | threadId={activeThread.id} |
| 2781 | | envMode={envMode} |
| 2782 | 2787 | onEnvModeChange={onEnvModeChange} |
| 2783 | 2788 | envLocked={envLocked} |
| 2784 | 2789 | onComposerFocusRequest={scheduleComposerFocus} |