MCPcopy Create free account
hub / github.com/modelscope/ms-agent / getFileIcon

Function getFileIcon

webui/frontend/src/components/ConversationView.tsx:2181–2193  ·  view source on GitHub ↗
(fname: string)

Source from the content-addressed store, hash-verified

2179 const [fileLang, setFileLang] = useState('text');
2180
2181 const getFileIcon = (fname: string) => {
2182 const ext = fname.split('.').pop()?.toLowerCase();
2183 if (['js', 'ts', 'tsx', 'jsx', 'py', 'java', 'cpp', 'c', 'go', 'rs'].includes(ext || '')) {
2184 return <CodeIcon fontSize="small" />;
2185 }
2186 if (['md', 'txt', 'json', 'yaml', 'yml', 'xml', 'html', 'css'].includes(ext || '')) {
2187 return <DocIcon fontSize="small" />;
2188 }
2189 if (['png', 'jpg', 'jpeg', 'gif', 'svg', 'webp'].includes(ext || '')) {
2190 return <ImageIcon fontSize="small" />;
2191 }
2192 return <FileIcon fontSize="small" />;
2193 };
2194
2195 const handleViewFile = async () => {
2196 setDialogOpen(true);

Callers 1

FileOutputChipFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected