Elffuss BraidHub

kikocis/continue public

c33d3f5d8d05 · 724 BRawPermalink
1import { getMarkdownLanguageTagForFile } from "core/util";
2import StyledMarkdownPreview from "../../../components/StyledMarkdownPreview";
3
4interface CreateFileToolCallProps {
5 relativeFilepath: string;
6 fileContents: string;
7 historyIndex: number;
8}
9
10export function CreateFile(props: CreateFileToolCallProps) {
11 if (!props.fileContents) {
12 return null;
13 }
14
15 const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilepath ?? "output.txt")} ${props.relativeFilepath}\n${props.fileContents ?? ""}\n\`\`\``;
16
17 return props.relativeFilepath ? (
18 <StyledMarkdownPreview
19 isRenderingInStepContainer
20 disableManualApply
21 source={src}
22 itemIndex={props.historyIndex}
23 />
24 ) : null;
25}