diff --git a/frontend/src/components/thread/file-attachment.tsx b/frontend/src/components/thread/file-attachment.tsx
index f773ed5c..7dcfdf06 100644
--- a/frontend/src/components/thread/file-attachment.tsx
+++ b/frontend/src/components/thread/file-attachment.tsx
@@ -254,7 +254,7 @@ export function FileAttachment({
const handleDownload = async (e: React.MouseEvent) => {
e.stopPropagation(); // Prevent triggering the main click handler
-
+
try {
if (!sandboxId || !session?.access_token) {
// Fallback: open file URL in new tab
@@ -451,8 +451,9 @@ export function FileAttachment({
className={cn(
"group relative w-full",
"rounded-xl border bg-card overflow-hidden pt-10", // Consistent card styling with header space
- isPdf ? "!min-h-[200px] sm:min-h-0 sm:h-[400px] max-h-[500px] sm:!min-w-[300px]" :
- standalone ? "min-h-[300px] h-auto" : "h-[300px]", // Better height handling for standalone
+ isPdf ? "!min-h-[200px] sm:min-h-0 sm:h-[400px] max-h-[500px] sm:!min-w-[300px]" :
+ isHtmlOrMd ? "!min-h-[200px] sm:min-h-0 sm:h-[400px] max-h-[600px] sm:!min-w-[300px]" :
+ standalone ? "min-h-[300px] h-auto" : "h-[300px]", // Better height handling for standalone
className
)}
style={{
@@ -469,8 +470,8 @@ export function FileAttachment({
style={{
minWidth: 0,
width: '100%',
- containIntrinsicSize: isPdf ? '100% 500px' : undefined,
- contain: isPdf ? 'layout size' : undefined
+ containIntrinsicSize: (isPdf || isHtmlOrMd) ? '100% 500px' : undefined,
+ contain: (isPdf || isHtmlOrMd) ? 'layout size' : undefined
}}
>
{/* Render PDF or text-based previews */}
diff --git a/frontend/src/components/thread/tool-views/file-operation/FileEditToolView.tsx b/frontend/src/components/thread/tool-views/file-operation/FileEditToolView.tsx
index fea802f5..9cca435f 100644
--- a/frontend/src/components/thread/tool-views/file-operation/FileEditToolView.tsx
+++ b/frontend/src/components/thread/tool-views/file-operation/FileEditToolView.tsx
@@ -3,29 +3,68 @@ import {
FileDiff,
CheckCircle,
AlertTriangle,
+ ExternalLink,
Loader2,
+ Code,
+ Eye,
File,
- ChevronDown,
- ChevronUp,
+ Copy,
+ Check,
Minus,
Plus,
} from 'lucide-react';
+import {
+ extractFilePath,
+ extractFileContent,
+ extractStreamingFileContent,
+ formatTimestamp,
+ getToolTitle,
+ normalizeContentToString,
+ extractToolData,
+} from '../utils';
+import {
+ MarkdownRenderer,
+ processUnicodeContent,
+} from '@/components/file-renderers/markdown-renderer';
+import { CsvRenderer } from '@/components/file-renderers/csv-renderer';
+import { XlsxRenderer } from '@/components/file-renderers/xlsx-renderer';
import { cn } from '@/lib/utils';
-import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
+import { useTheme } from 'next-themes';
+import { CodeBlockCode } from '@/components/ui/code-block';
+import { constructHtmlPreviewUrl } from '@/lib/utils/url';
+import {
+ Card,
+ CardContent,
+ CardHeader,
+ CardTitle,
+} from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
-import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { Button } from '@/components/ui/button';
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import { ScrollArea } from "@/components/ui/scroll-area";
import {
extractFileEditData,
generateLineDiff,
calculateDiffStats,
LineDiff,
- DiffStats
+ DiffStats,
+ getLanguageFromFileName,
+ getOperationType,
+ getOperationConfigs,
+ getFileIcon,
+ processFilePath,
+ getFileName,
+ getFileExtension,
+ isFileType,
+ hasLanguageHighlighting,
+ splitContentIntoLines,
+ type FileOperation,
+ type OperationConfig,
} from './_utils';
-import { formatTimestamp, getToolTitle } from '../utils';
import { ToolViewProps } from '../types';
+import { GenericToolView } from '../GenericToolView';
import { LoadingState } from '../shared/LoadingState';
+import { toast } from 'sonner';
import ReactDiffViewer from 'react-diff-viewer-continued';
const UnifiedDiffView: React.FC<{ oldCode: string; newCode: string }> = ({ oldCode, newCode }) => (
@@ -60,40 +99,6 @@ const UnifiedDiffView: React.FC<{ oldCode: string; newCode: string }> = ({ oldCo
/>
);
-const SplitDiffView: React.FC<{ oldCode: string; newCode: string }> = ({ oldCode, newCode }) => (
-
No content to preview
+
- {filePath || 'Unknown file'}
-
- + {processUnicodeContent(updatedContent)} ++
No diff to display
+
+ Source
+