File tree Expand file tree Collapse file tree
multimodal/tarko/agent-ui/src/standalone/workspace Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,13 +2,12 @@ import React from 'react';
22import { motion } from 'framer-motion' ;
33import { MarkdownRenderer } from '@tarko/ui' ;
44import { wrapMarkdown } from '@/common/utils/markdown' ;
5-
6- type DisplayMode = 'source' | 'rendered' ;
5+ import { FileDisplayMode } from '../../types' ;
76
87interface MessageContentProps {
98 message : string ;
109 isMarkdown ?: boolean ;
11- displayMode ?: DisplayMode ;
10+ displayMode ?: FileDisplayMode ;
1211 isShortMessage ?: boolean ;
1312}
1413
Original file line number Diff line number Diff line change @@ -3,8 +3,6 @@ import { MonacoCodeEditor } from '@tarko/ui';
33import { FileDisplayMode } from '../types' ;
44import { StandardPanelContent } from '../types/panelContent' ;
55import { MessageContent } from '../components/shared' ;
6-
7- type DisplayMode = 'source' | 'rendered' ;
86import { useStableCodeContent } from '@/common/hooks/useStableValue' ;
97import { ThrottledHtmlRenderer } from '../components/ThrottledHtmlRenderer' ;
108import { formatBytes } from '../utils/codeUtils' ;
@@ -89,7 +87,7 @@ export const FileResultRenderer: React.FC<FileResultRendererProps> = ({
8987 < MessageContent
9088 message = { stableContent }
9189 isMarkdown = { true }
92- displayMode = { displayMode as DisplayMode }
90+ displayMode = { displayMode }
9391 isShortMessage = { false }
9492 />
9593 </ div >
Original file line number Diff line number Diff line change 22 * Utility functions for file type detection and handling
33 */
44
5+ import { FileDisplayMode } from '../types' ;
6+
57export interface FileTypeInfo {
68 isHtml : boolean ;
79 isMarkdown : boolean ;
@@ -16,7 +18,7 @@ export interface FileTypeInfo {
1618export function getFileTypeInfo ( filePath : string ) : FileTypeInfo {
1719 const fileName = filePath . split ( '/' ) . pop ( ) || filePath ;
1820 const extension = fileName . toLowerCase ( ) . split ( '.' ) . pop ( ) || '' ;
19-
21+
2022 const isHtml = extension === 'html' || extension === 'htm' ;
2123 const isMarkdown = extension === 'md' || extension === 'markdown' ;
2224 const isRenderableFile = isHtml || isMarkdown ;
@@ -54,13 +56,13 @@ export function isMarkdownFile(filePath: string): boolean {
5456/**
5557 * Get the appropriate default display mode for a file during streaming
5658 */
57- export function getDefaultDisplayMode ( filePath : string , isStreaming : boolean ) : 'source' | 'rendered' {
59+ export function getDefaultDisplayMode ( filePath : string , isStreaming : boolean ) : FileDisplayMode {
5860 const { isHtml } = getFileTypeInfo ( filePath ) ;
59-
61+
6062 // For HTML files during streaming, default to source mode
6163 if ( isHtml && isStreaming ) {
6264 return 'source' ;
6365 }
64-
66+
6567 return 'rendered' ;
6668}
You can’t perform that action at this time.
0 commit comments