fix rendering of code blocks

This commit is contained in:
Nate 2024-11-21 09:20:15 -08:00
parent b8992b3560
commit 2daef34b8a
3 changed files with 12 additions and 35 deletions

View file

@ -1,5 +1,5 @@
import StepContainerPreToolbar from "../../../components/markdown/StepContainerPreToolbar";
import { SyntaxHighlightedPre } from "../../../components/markdown/SyntaxHighlightedPre";
import { getMarkdownLanguageTagForFile } from "core/util";
import StyledMarkdownPreview from "../../../components/markdown/StyledMarkdownPreview";
import { ToolState } from "./types";
interface CreateFileToolCallProps {
@ -11,20 +11,10 @@ interface CreateFileToolCallProps {
export function CreateFile(props: CreateFileToolCallProps) {
return (
<>
<StepContainerPreToolbar
codeBlockContent={props.fileContents ?? "New File"}
codeBlockIndex={0}
language={"javascript"}
filepath={props.filepath ?? "Loading"}
isGeneratingCodeBlock={false}
expanded={false}
hideApply={true}
>
<SyntaxHighlightedPre>
<span></span>
{props.fileContents}
</SyntaxHighlightedPre>
</StepContainerPreToolbar>
<StyledMarkdownPreview
isRenderingInStepContainer={true}
source={`\`\`\`${getMarkdownLanguageTagForFile(props.filepath ?? ".txt")} ${props.filepath}\n${props.fileContents ?? ""}\n\`\`\``}
/>
</>
);
}

View file

@ -14,7 +14,7 @@ export function FunctionSpecificHeader(props: FunctionSpecificHeaderProps) {
case "create_new_file":
return "Continue wants to create a new file";
case "run_terminal_command":
return "Continue wantsto run a terminal command.";
return "Continue wants to run a terminal command.";
case "exact_search":
return "Continue wants to search your codebase";
case "search_web":

View file

@ -1,5 +1,4 @@
import StepContainerPreToolbar from "../../../components/markdown/StepContainerPreToolbar";
import { SyntaxHighlightedPre } from "../../../components/markdown/SyntaxHighlightedPre";
import StyledMarkdownPreview from "../../../components/markdown/StyledMarkdownPreview";
import { ToolState } from "./types";
interface RunTerminalCommandToolCallProps {
@ -10,22 +9,10 @@ interface RunTerminalCommandToolCallProps {
export function RunTerminalCommand(props: RunTerminalCommandToolCallProps) {
return (
<>
<p>Continue wants to run a terminal command:</p>
<StepContainerPreToolbar
codeBlockContent={props.command ?? ""}
codeBlockIndex={0}
language={"bash"}
filepath={"bash"}
isGeneratingCodeBlock={false}
expanded={false}
hideApply={true}
>
<SyntaxHighlightedPre>
<span></span>
{props.command}
</SyntaxHighlightedPre>
</StepContainerPreToolbar>
<StyledMarkdownPreview
isRenderingInStepContainer={true}
source={`\`\`\bash terminal\n${props.command}\n\`\`\``}
/>
</>
);
}