From 4ef662d264c06430e0378b1d2383619e3b418924 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 13 May 2025 14:21:30 -0700 Subject: [PATCH 1/3] fix ugly apply state in codeblock toolbar --- .../StyledMarkdownPreview/StepContainerPreToolbar/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx index 82684ddf9..0fa31b585 100644 --- a/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx +++ b/gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx @@ -243,7 +243,7 @@ export function StepContainerPreToolbar({ const plural = numLines === 1 ? "" : "s"; if (isGeneratingCodeBlock) { return ( - + {!isExpanded ? `${numLines} line${plural}` : "Generating"}{" "}
@@ -252,7 +252,7 @@ export function StepContainerPreToolbar({ ); } else { return ( - + {`${numLines} line${plural} pending`} ); From 931e07fc07cd8e166a4a4437a498968c402b444c Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 13 May 2025 15:02:04 -0700 Subject: [PATCH 2/3] don't show markdown preview till args are there for edit tool --- gui/src/pages/gui/ToolCallDiv/EditFile.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx index 0c27ecee8..a4a487d42 100644 --- a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx +++ b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx @@ -16,13 +16,12 @@ type EditToolCallProps = { }; export function EditFile(props: EditToolCallProps) { - const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath ?? "test.txt")} ${props.relativeFilePath}\n${props.changes ?? ""}\n\`\`\``; - const dispatch = useAppDispatch(); - const isStreaming = useAppSelector((state) => state.session.isStreaming); + const applyState = useAppSelector((state) => selectApplyStateByToolCallId(state, props.toolCallId), ); + useEffect(() => { if (!applyState) { dispatch( @@ -35,10 +34,12 @@ export function EditFile(props: EditToolCallProps) { } }, [applyState, props.toolCallId]); - if (!props.relativeFilePath) { + if (!props.relativeFilePath || !props.changes) { return null; } + const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath ?? "test.txt")} ${props.relativeFilePath}\n${props.changes}\n\`\`\``; + return ( Date: Tue, 13 May 2025 15:04:51 -0700 Subject: [PATCH 3/3] don't show markdown preview till args are there for create tool --- gui/src/pages/gui/ToolCallDiv/CreateFile.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gui/src/pages/gui/ToolCallDiv/CreateFile.tsx b/gui/src/pages/gui/ToolCallDiv/CreateFile.tsx index a3e81355b..d0a843104 100644 --- a/gui/src/pages/gui/ToolCallDiv/CreateFile.tsx +++ b/gui/src/pages/gui/ToolCallDiv/CreateFile.tsx @@ -8,6 +8,10 @@ interface CreateFileToolCallProps { } export function CreateFile(props: CreateFileToolCallProps) { + if (!props.fileContents) { + return null; + } + const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilepath ?? "output.txt")} ${props.relativeFilepath}\n${props.fileContents ?? ""}\n\`\`\``; return props.relativeFilepath ? (