Merge pull request #5656 from continuedev/dallin/apply-1-line

Fix: codeblocks hanging on one line for tool calls
This commit is contained in:
Patrick Erichsen 2025-05-14 13:33:30 -07:00 • committed by GitHub
commit c720e9a1e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 6 deletions

View file

@ -243,7 +243,7 @@ export function StepContainerPreToolbar({
const plural = numLines === 1 ? "" : "s";
if (isGeneratingCodeBlock) {
return (
<span className="text-lightgray inline-flex w-min items-center gap-2">
<span className="text-lightgray inline-flex items-center gap-2 text-right">
{!isExpanded ? `${numLines} line${plural}` : "Generating"}{" "}
<div>
<Spinner />
@ -252,7 +252,7 @@ export function StepContainerPreToolbar({
);
} else {
return (
<span className="text-lightgray inline-flex w-min items-center gap-2">
<span className="text-lightgray inline-flex items-center gap-2 text-right">
{`${numLines} line${plural} pending`}
</span>
);

View file

@ -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 ? (

View file

@ -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 (
<StyledMarkdownPreview
isRenderingInStepContainer