mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-24 22:54:46 +08:00
feat: add file icons
This commit is contained in:
@@ -229,7 +229,7 @@ export default function ChatPage() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<main className="flex min-h-0 grow flex-col">
|
<main className="flex min-h-0 max-w-full grow flex-col">
|
||||||
<div className="flex size-full justify-center">
|
<div className="flex size-full justify-center">
|
||||||
<MessageList
|
<MessageList
|
||||||
className={cn("size-full", !isNewThread && "pt-10")}
|
className={cn("size-full", !isNewThread && "pt-10")}
|
||||||
|
|||||||
@@ -167,7 +167,10 @@ export type ChainOfThoughtSearchResultsProps = ComponentProps<"div">;
|
|||||||
export const ChainOfThoughtSearchResults = memo(
|
export const ChainOfThoughtSearchResults = memo(
|
||||||
({ className, ...props }: ChainOfThoughtSearchResultsProps) => (
|
({ className, ...props }: ChainOfThoughtSearchResultsProps) => (
|
||||||
<div
|
<div
|
||||||
className={cn("flex flex-wrap items-center gap-2", className)}
|
className={cn(
|
||||||
|
"flex flex-wrap items-center gap-2 overflow-x-hidden",
|
||||||
|
className,
|
||||||
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ export function ArtifactFileList({
|
|||||||
<CardTitle className="relative pl-8">
|
<CardTitle className="relative pl-8">
|
||||||
<div>{getFileName(file)}</div>
|
<div>{getFileName(file)}</div>
|
||||||
<div className="absolute top-2 -left-0.5">
|
<div className="absolute top-2 -left-0.5">
|
||||||
{getFileIcon(file)}
|
{getFileIcon(file, "size-6")}
|
||||||
</div>
|
</div>
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<CardDescription className="pl-8 text-xs">
|
<CardDescription className="pl-8 text-xs">
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ export function ArtifactsProvider({ children }: ArtifactsProviderProps) {
|
|||||||
|
|
||||||
const select = (artifact: string, autoSelect = false) => {
|
const select = (artifact: string, autoSelect = false) => {
|
||||||
setSelectedArtifact(artifact);
|
setSelectedArtifact(artifact);
|
||||||
setSidebarOpen(false);
|
if (env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY !== "true") {
|
||||||
|
setSidebarOpen(false);
|
||||||
|
}
|
||||||
if (!autoSelect) {
|
if (!autoSelect) {
|
||||||
setAutoSelect(false);
|
setAutoSelect(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
FileCogIcon,
|
FileCogIcon,
|
||||||
FilePlayIcon,
|
FilePlayIcon,
|
||||||
FileTextIcon,
|
FileTextIcon,
|
||||||
|
ImageIcon,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
|
|
||||||
const extensionMap: Record<string, string> = {
|
const extensionMap: Record<string, string> = {
|
||||||
@@ -191,17 +192,28 @@ export function getFileExtensionDisplayName(filepath: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getFileIcon(filepath: string) {
|
export function getFileIcon(filepath: string, className?: string) {
|
||||||
const extension = getFileExtension(filepath);
|
const extension = getFileExtension(filepath);
|
||||||
const { isCodeFile } = checkCodeFile(filepath);
|
const { isCodeFile } = checkCodeFile(filepath);
|
||||||
const className = "size-6";
|
|
||||||
switch (extension) {
|
switch (extension) {
|
||||||
case "skill":
|
case "skill":
|
||||||
return <FileCogIcon className={className} />;
|
return <FileCogIcon className={className} />;
|
||||||
case "html":
|
case "html":
|
||||||
return <CompassIcon className={className} />;
|
return <CompassIcon className={className} />;
|
||||||
|
case "txt":
|
||||||
case "md":
|
case "md":
|
||||||
return <BookOpenTextIcon className={className} />;
|
return <BookOpenTextIcon className={className} />;
|
||||||
|
case "jpg":
|
||||||
|
case "jpeg":
|
||||||
|
case "png":
|
||||||
|
case "gif":
|
||||||
|
case "bmp":
|
||||||
|
case "tiff":
|
||||||
|
case "ico":
|
||||||
|
case "webp":
|
||||||
|
case "svg":
|
||||||
|
case "heic":
|
||||||
|
return <ImageIcon className={className} />;
|
||||||
case "mp3":
|
case "mp3":
|
||||||
case "wav":
|
case "wav":
|
||||||
case "ogg":
|
case "ogg":
|
||||||
|
|||||||
Reference in New Issue
Block a user