diff --git a/src/vs/workbench/contrib/void/browser/react/src/markdown/ApplyBlockHoverButtons.tsx b/src/vs/workbench/contrib/void/browser/react/src/markdown/ApplyBlockHoverButtons.tsx index 3c19866a..485a0937 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/markdown/ApplyBlockHoverButtons.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/markdown/ApplyBlockHoverButtons.tsx @@ -280,7 +280,7 @@ export const BlockCodeApplyWrapper = ({ const { statusIndicatorHTML, buttonsHTML } = useApplyButtonHTML({ codeStr: initValue, applyBoxId, uri }) return
{/* header */} diff --git a/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx b/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx index f21bef23..b09b163f 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx @@ -278,13 +278,13 @@ const RenderToken = ({ token, inPTag, codeURI, chatMessageLocation, tokenIdx, .. token={token} tokenIdx={`${tokenIdx ? `${tokenIdx}-` : ''}${index}`} // assign a unique tokenId to inPTag components chatMessageLocation={chatMessageLocation} - inPTag={true} // TODO!!! check this + inPTag={true} {...options} /> ))} - if (inPTag) return contents + if (inPTag) return {contents} return

{contents} diff --git a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx index ff0c2f41..433378ea 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx @@ -149,62 +149,6 @@ const getChatBubbleId = (threadId: string, messageIdx: number) => `${threadId}-$ - -// const ReasoningOptionDropdown = () => { -// const accessor = useAccessor() - -// const voidSettingsService = accessor.get('IVoidSettingsService') -// const voidSettingsState = useSettingsState() - -// const modelSelection = voidSettingsState.modelSelectionOfFeature['Chat'] -// if (!modelSelection) return null - -// const { modelName, providerName } = modelSelection -// const { canToggleReasoning, reasoningBudgetSlider } = getModelCapabilities(providerName, modelName).supportsReasoningOutput || {} - -// const defaultEnabledVal = canToggleReasoning ? true : false -// const isEnabled = voidSettingsState.optionsOfModelSelection[modelSelection.providerName]?.[modelSelection.modelName]?.reasoningEnabled ?? defaultEnabledVal - -// let toggleButton: React.ReactNode = null -// if (canToggleReasoning) { -// toggleButton =

-// {isEnabled ? 'Thinking' : 'Thinking'} -// { voidSettingsService.setOptionsOfModelSelection(modelSelection.providerName, modelSelection.modelName, { reasoningEnabled: newVal }) }} -// /> -//
-// } - -// let slider: React.ReactNode = null -// if (isEnabled && reasoningBudgetSlider?.type === 'slider') { -// const { min, max, default: defaultVal } = reasoningBudgetSlider -// const value = voidSettingsState.optionsOfModelSelection[modelSelection.providerName]?.[modelSelection.modelName]?.reasoningBudget ?? defaultVal -// slider =
-// Budget -// { voidSettingsService.setOptionsOfModelSelection(modelSelection.providerName, modelSelection.modelName, { reasoningBudget: newVal }) }} -// /> -// {`${value} tokens`} -//
- -// } - -// return <> -// {toggleButton} -// {slider} -// -// } - - - // SLIDER ONLY: const ReasoningOptionSlider = ({ featureName }: { featureName: FeatureName }) => { const accessor = useAccessor() @@ -705,24 +649,17 @@ export const SelectedFiles = ( -const ReasoningComponent = ({ children }: { children: React.ReactNode }) => { - - const [isOpen, setIsOpen] = useState(false) - return children - -} - - type ToolHeaderParams = { icon?: React.ReactNode; title: string; - desc1: string; + desc1: React.ReactNode; desc2?: React.ReactNode; isError?: boolean; numResults?: number; children?: React.ReactNode; onClick?: () => void; + isOpen?: boolean, } const ToolHeaderWrapper = ({ @@ -734,9 +671,11 @@ const ToolHeaderWrapper = ({ children, isError, onClick, + isOpen, }: ToolHeaderParams) => { - const [isExpanded, setIsExpanded] = useState(false); + const [isExpanded_, setIsExpanded] = useState(false); + const isExpanded = isOpen ? isOpen : isExpanded_ const isDropdown = children !== undefined // null ALLOWS dropdown const isClickable = !!(isDropdown || onClick) @@ -780,7 +719,8 @@ const ToolHeaderWrapper = ({ {/* children */} {
{children} @@ -994,6 +934,7 @@ const AssistantMessageComponent = ({ chatMessage, isLoading, messageIdx, isLast const reasoningStr = chatMessage.reasoning?.trim() || null const hasReasoning = !!reasoningStr + const isDoneReasoning = !!chatMessage.content const thread = chatThreadsService.getCurrentThread() @@ -1035,14 +976,15 @@ const AssistantMessageComponent = ({ chatMessage, isLoading, messageIdx, isLast > {/* reasoning token */} - {hasReasoning && + {hasReasoning && - } + } {/* assistant message */} { return
-
+
{children}
@@ -1203,7 +1145,7 @@ const EditToolChildren = ({ uri, changeDescription }: { uri: URI, changeDescript { commandService.executeCommand('vscode.open', uri, { preview: true }) }} />
@@ -1227,7 +1169,7 @@ const TerminalToolChildren = ({ command, terminalId, result, resolveReason }: { terminalToolsService.openTerminal(terminalId)} />
@@ -1241,6 +1183,23 @@ const TerminalToolChildren = ({ command, terminalId, result, resolveReason }: { } + +const ReasoningWrapper = ({ isDoneReasoning, isStreaming, children }: { isDoneReasoning: boolean, isStreaming: boolean, children: React.ReactNode }) => { + const isDone = isDoneReasoning || !isStreaming + const isWriting = !isDone + const [isOpen, setIsOpen] = useState(isWriting) + useEffect(() => { + if (!isWriting) setIsOpen(isWriting) // if just finished reasoning, close + }, [isWriting]) + return : ''} isOpen={isOpen}> + +
+ {children} +
+
+
+} + const toolNameToComponent: { [T in ToolName]: { requestWrapper: T extends ToolNameWithApproval ? ((props: { toolRequest: ToolRequestApproval }) => React.ReactNode) : null, resultWrapper: (props: { toolMessage: ToolMessage, messageIdx: number }) => React.ReactNode, @@ -1296,14 +1255,14 @@ const toolNameToComponent: { [T in ToolName]: { : {value.children.map((child, i) => ( { commandService.executeCommand('workbench.view.explorer'); explorerService.select(child.uri, true); }} />))} {value.hasNextPage && - + } } @@ -1337,11 +1296,11 @@ const toolNameToComponent: { [T in ToolName]: { : {value.uris.map((uri, i) => ( { commandService.executeCommand('vscode.open', uri, { preview: true }) }} />))} {value.hasNextPage && - + } @@ -1376,11 +1335,11 @@ const toolNameToComponent: { [T in ToolName]: { : {value.uris.map((uri, i) => ( { commandService.executeCommand('vscode.open', uri, { preview: true }) }} />))} {value.hasNextPage && - + } @@ -1611,7 +1570,7 @@ const toolNameToComponent: { [T in ToolName]: { type ChatBubbleMode = 'display' | 'edit' -type ChatBubbleProps = { chatMessage: ChatMessage, messageIdx: number, isLoading?: boolean, isLast: boolean } +type ChatBubbleProps = { chatMessage: ChatMessage, messageIdx: number, isLoading: boolean, isLast: boolean } const ChatBubble = ({ chatMessage, isLoading, messageIdx, isLast }: ChatBubbleProps) => { @@ -1753,7 +1712,7 @@ export const SidebarChat = () => { const previousMessagesHTML = useMemo(() => { return previousMessages.map((message, i) => - + ) }, [previousMessages, currentThread, numMessages])