fix CtrlK model selection

This commit is contained in:
Andrew Pareles 2025-03-13 21:29:45 -07:00
parent def78affb4
commit c222a801a8
3 changed files with 16 additions and 5 deletions

View file

@ -771,7 +771,7 @@ class EditCodeService extends Disposable implements IEditCodeService {
} }
weAreWriting = false weAreWriting = false
private async _writeURIText(uri: URI, text: string, range_: IRange | 'wholeFileRange', { shouldRealignDiffAreas, }: { shouldRealignDiffAreas: boolean, }) { private _writeURIText(uri: URI, text: string, range_: IRange | 'wholeFileRange', { shouldRealignDiffAreas, }: { shouldRealignDiffAreas: boolean, }) {
const model = this._getModel(uri) const model = this._getModel(uri)
if (model === null) return if (model === null) return
@ -1470,6 +1470,8 @@ class EditCodeService extends Disposable implements IEditCodeService {
resMessageDonePromise() resMessageDonePromise()
}, },
}) })
// should never happen, just for safety
if (streamRequestIdRef.current === null) { return }
await messageDonePromise await messageDonePromise
console.log('done waiting') console.log('done waiting')
@ -1799,6 +1801,9 @@ class EditCodeService extends Disposable implements IEditCodeService {
}) })
// should never happen, just for safety
if (streamRequestIdRef.current === null) { break }
await messageDonePromise await messageDonePromise
} // end while } // end while

View file

@ -86,6 +86,7 @@ export const QuickEditChat = ({
const chatAreaRef = useRef<HTMLDivElement | null>(null) const chatAreaRef = useRef<HTMLDivElement | null>(null)
return <div ref={sizerRef} style={{ maxWidth: 450 }} className={`py-2 w-full`}> return <div ref={sizerRef} style={{ maxWidth: 450 }} className={`py-2 w-full`}>
<VoidChatArea <VoidChatArea
featureName='Ctrl+K'
divRef={chatAreaRef} divRef={chatAreaRef}
onSubmit={onSubmit} onSubmit={onSubmit}
onAbort={onInterrupt} onAbort={onInterrupt}

View file

@ -204,13 +204,13 @@ const getChatBubbleId = (threadId: string, messageIdx: number) => `${threadId}-$
// SLIDER ONLY: // SLIDER ONLY:
const ReasoningOptionDropdown = () => { const ReasoningOptionDropdown = ({ featureName }: { featureName: FeatureName }) => {
const accessor = useAccessor() const accessor = useAccessor()
const voidSettingsService = accessor.get('IVoidSettingsService') const voidSettingsService = accessor.get('IVoidSettingsService')
const voidSettingsState = useSettingsState() const voidSettingsState = useSettingsState()
const modelSelection = voidSettingsState.modelSelectionOfFeature['Chat'] const modelSelection = voidSettingsState.modelSelectionOfFeature[featureName]
if (!modelSelection) return null if (!modelSelection) return null
const { modelName, providerName } = modelSelection const { modelName, providerName } = modelSelection
@ -289,6 +289,8 @@ interface VoidChatAreaProps {
onClickAnywhere?: () => void; onClickAnywhere?: () => void;
// Optional close button // Optional close button
onClose?: () => void; onClose?: () => void;
featureName: FeatureName;
} }
export const VoidChatArea: React.FC<VoidChatAreaProps> = ({ export const VoidChatArea: React.FC<VoidChatAreaProps> = ({
@ -306,6 +308,7 @@ export const VoidChatArea: React.FC<VoidChatAreaProps> = ({
showProspectiveSelections = true, showProspectiveSelections = true,
selections, selections,
setSelections, setSelections,
featureName,
}) => { }) => {
return ( return (
<div <div
@ -359,8 +362,8 @@ export const VoidChatArea: React.FC<VoidChatAreaProps> = ({
<div className='flex flex-row justify-between items-end gap-1'> <div className='flex flex-row justify-between items-end gap-1'>
{showModelDropdown && ( {showModelDropdown && (
<div className='max-w-[200px] flex-grow'> <div className='max-w-[200px] flex-grow'>
<ReasoningOptionDropdown /> <ReasoningOptionDropdown featureName={featureName} />
<ModelDropdown featureName={'Chat'} /> <ModelDropdown featureName={featureName} />
</div> </div>
)} )}
@ -852,6 +855,7 @@ const UserMessageComponent = ({ chatMessage, messageIdx, isLoading }: ChatBubble
} }
chatbubbleContents = <VoidChatArea chatbubbleContents = <VoidChatArea
featureName='Chat'
onSubmit={onSubmit} onSubmit={onSubmit}
onAbort={onAbort} onAbort={onAbort}
isStreaming={false} isStreaming={false}
@ -1709,6 +1713,7 @@ export const SidebarChat = () => {
}, [onSubmit, onAbort, isStreaming]) }, [onSubmit, onAbort, isStreaming])
const inputForm = <div className={`right-0 left-0 m-2 z-[999] overflow-hidden ${previousMessages.length > 0 ? 'absolute bottom-0' : ''}`}> const inputForm = <div className={`right-0 left-0 m-2 z-[999] overflow-hidden ${previousMessages.length > 0 ? 'absolute bottom-0' : ''}`}>
<VoidChatArea <VoidChatArea
featureName='Chat'
divRef={chatAreaRef} divRef={chatAreaRef}
onSubmit={onSubmit} onSubmit={onSubmit}
onAbort={onAbort} onAbort={onAbort}