| 1 | import { getMarkdownLanguageTagForFile } from "core/util"; |
| 2 | import StyledMarkdownPreview from "../../../components/StyledMarkdownPreview"; |
| 3 | |
| 4 | type EditToolCallProps = { |
| 5 | relativeFilePath: string; |
| 6 | changes: string; |
| 7 | historyIndex: number; |
| 8 | toolCallId?: string; |
| 9 | }; |
| 10 | |
| 11 | export function EditFile(props: EditToolCallProps) { |
| 12 | if (!props.relativeFilePath) { |
| 13 | return null; |
| 14 | } |
| 15 | |
| 16 | const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath)} ${props.relativeFilePath}\n${props.changes}\n\`\`\``; |
| 17 | |
| 18 | return ( |
| 19 | <StyledMarkdownPreview |
| 20 | expandCodeblocks={false} |
| 21 | isRenderingInStepContainer |
| 22 | disableManualApply |
| 23 | source={src} |
| 24 | toolCallId={props.toolCallId} |
| 25 | itemIndex={props.historyIndex} |
| 26 | collapsible={true} |
| 27 | /> |
| 28 | ); |
| 29 | } |