diff --git a/core/index.d.ts b/core/index.d.ts
index 03c32a8b5..3a94202a2 100644
--- a/core/index.d.ts
+++ b/core/index.d.ts
@@ -425,6 +425,11 @@ interface ToolCallState {
output?: ContextItem[];
}
+interface Reasoning {
+ active: boolean;
+ text: string;
+}
+
export interface ChatHistoryItem {
message: ChatMessage;
contextItems: ContextItemWithId[];
@@ -435,6 +440,7 @@ export interface ChatHistoryItem {
isGatheringContext?: boolean;
checkpoint?: Checkpoint;
isBeforeCheckpoint?: boolean;
+ reasoning?: Reasoning;
}
export interface LLMFullCompletionOptions extends BaseCompletionOptions {
diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json
index 38d0db7c8..c9d9e1741 100644
--- a/extensions/vscode/package-lock.json
+++ b/extensions/vscode/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "continue",
- "version": "0.9.254",
+ "version": "0.9.255",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
- "version": "0.9.254",
+ "version": "0.9.255",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/fetch": "^1.0.3",
diff --git a/gui/src/components/StepContainer/Reasoning.tsx b/gui/src/components/StepContainer/Reasoning.tsx
new file mode 100644
index 000000000..23da63cc5
--- /dev/null
+++ b/gui/src/components/StepContainer/Reasoning.tsx
@@ -0,0 +1,64 @@
+import { ChatHistoryItem } from "core";
+import { stripImages } from "core/util/messageContent";
+import { useState } from "react";
+import styled from "styled-components";
+import { defaultBorderRadius, lightGray, vscBackground, vscQuickInputBackground, } from "..";
+import { getFontSize } from "../../util";
+import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview";
+
+interface ReasoningProps {
+ item: ChatHistoryItem;
+ index: number;
+ isLast: boolean;
+}
+
+const SpoilerButton = styled.div`
+ background-color: ${vscBackground};
+ width: fit-content;
+ font-size: ${getFontSize() - 2}px;
+ border: 0.5px solid ${lightGray};
+ border-radius: ${defaultBorderRadius};
+ padding: 4px 8px;
+ color: ${lightGray};
+ cursor: pointer;
+ box-shadow:
+ 0 4px 6px rgba(0, 0, 0, 0.1),
+ 0 1px 3px rgba(0, 0, 0, 0.08);
+ transition: box-shadow 0.3s ease;
+
+ &:hover {
+ box-shadow:
+ 0 6px 8px rgba(0, 0, 0, 0.15),
+ 0 3px 6px rgba(0, 0, 0, 0.1);
+ }
+`;
+
+const ContentDiv = styled.div<{ fontSize?: number }>`
+ margin: 4px;
+ padding: 4px;
+ font-size: ${getFontSize()}px;
+ overflow: hidden;
+ border-left: 4px solid ${lightGray};
+ border-radius: ${defaultBorderRadius};
+ background-color: ${vscQuickInputBackground};
+`;
+
+export default function Reasoning(props: ReasoningProps) {
+ const [open, setOpen] = useState(false);
+
+ if (!props.item.reasoning?.text) {
+ return null;
+ }
+
+ return <>
+ setOpen(!open)}> {open ? "Hide reasoning" : "Show reasoning"}
+ {open && (
+
+ )}
+ >
+}
diff --git a/gui/src/components/StepContainer/StepContainer.tsx b/gui/src/components/StepContainer/StepContainer.tsx
index 5709f7f60..b395db076 100644
--- a/gui/src/components/StepContainer/StepContainer.tsx
+++ b/gui/src/components/StepContainer/StepContainer.tsx
@@ -11,6 +11,7 @@ import { getFontSize } from "../../util";
import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview";
import ResponseActions from "./ResponseActions";
import ThinkingIndicator from "./ThinkingIndicator";
+import Reasoning from "./Reasoning";
interface StepContainerProps {
item: ChatHistoryItem;
@@ -90,11 +91,15 @@ export default function StepContainer(props: StepContainerProps) {
{renderChatMessage(props.item.message)}
) : (
-
+ <>
+
+
+
+ >
)}
{props.isLast && }
diff --git a/gui/src/components/markdown/StyledMarkdownPreview.tsx b/gui/src/components/markdown/StyledMarkdownPreview.tsx
index 52d343fe4..931c8c045 100644
--- a/gui/src/components/markdown/StyledMarkdownPreview.tsx
+++ b/gui/src/components/markdown/StyledMarkdownPreview.tsx
@@ -34,6 +34,7 @@ import { remarkTables } from "./utils/remarkTables";
const StyledMarkdown = styled.div<{
fontSize?: number;
whiteSpace: string;
+ bgColor: string;
}>`
pre {
white-space: ${(props) => props.whiteSpace};
@@ -63,7 +64,7 @@ const StyledMarkdown = styled.div<{
color: #f78383;
}
- background-color: ${vscBackground};
+ background-color: ${(props) => props.bgColor};
font-family:
var(--vscode-font-family),
system-ui,
@@ -104,6 +105,7 @@ interface StyledMarkdownPreviewProps {
isRenderingInStepContainer?: boolean; // Currently only used to control the rendering of codeblocks
scrollLocked?: boolean;
itemIndex?: number;
+ useParentBackgroundColor?: boolean;
}
const HLJS_LANGUAGE_CLASSNAME_PREFIX = "language-";
@@ -332,7 +334,11 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
const uiConfig = useAppSelector(selectUIConfig);
const codeWrapState = uiConfig?.codeWrap ? "pre-wrap" : "pre";
return (
-
+
{reactContent}
);
diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts
index 33ba33f59..1aa66b438 100644
--- a/gui/src/redux/slices/sessionSlice.ts
+++ b/gui/src/redux/slices/sessionSlice.ts
@@ -362,9 +362,24 @@ export const sessionSlice = createSlice({
} else {
// Add to the existing message
if (message.content) {
- // Note this only works because new message above
- // was already rendered from parts to string
- lastMessage.content += renderChatMessage(message);
+ const messageContent = renderChatMessage(message);
+ if (messageContent.includes("")) {
+ lastItem.reasoning = {
+ active: true,
+ text: messageContent.replace("", "").trim(),
+ }
+ } else if (lastItem.reasoning?.active && messageContent.includes("")) {
+ const [reasoningEnd, answerStart] = messageContent.split("");
+ lastItem.reasoning.text += reasoningEnd.trimEnd();
+ lastItem.reasoning.active = false;
+ lastMessage.content += answerStart.trimStart();
+ } else if (lastItem.reasoning?.active) {
+ lastItem.reasoning.text += messageContent;
+ } else {
+ // Note this only works because new message above
+ // was already rendered from parts to string
+ lastMessage.content += messageContent;
+ }
} else if (
message.role === "assistant" &&
message.toolCalls?.[0] &&