SarahXia0405 commited on
Commit
682a815
·
verified ·
1 Parent(s): bbc0c6c

Update web/src/components/ChatArea.tsx

Browse files
Files changed (1) hide show
  1. web/src/components/ChatArea.tsx +25 -4
web/src/components/ChatArea.tsx CHANGED
@@ -920,13 +920,34 @@ export function ChatArea({
920
  {/* Composer */}
921
  <div ref={composerRef} className="flex-shrink-0 bg-background/95 backdrop-blur-sm z-20 border-t border-border">
922
  <div className="max-w-4xl mx-auto px-4 py-4">
923
- {/*Uploaded Files Preview (chip UI) */}
924
  {(uploadedFiles.length > 0 || pendingFiles.length > 0) && (
925
  <div className="mb-2 flex flex-wrap gap-2 max-h-32 overflow-y-auto">
926
  {/* uploaded */}
927
- {uploadedFiles.map((u, idx) => (
928
- <FileChip key={`u-${u.file.name}-${u.file.size}-${u.file.lastModified}`} file={u.file} index={idx} source="uploaded" />
929
- ))}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
930
 
931
  {/* pending (type dialog 之前也能显示的话) */}
932
  {pendingFiles.map((p, idx) => (
 
920
  {/* Composer */}
921
  <div ref={composerRef} className="flex-shrink-0 bg-background/95 backdrop-blur-sm z-20 border-t border-border">
922
  <div className="max-w-4xl mx-auto px-4 py-4">
923
+ {/* Uploaded Files Preview (chip UI) */}
924
  {(uploadedFiles.length > 0 || pendingFiles.length > 0) && (
925
  <div className="mb-2 flex flex-wrap gap-2 max-h-32 overflow-y-auto">
926
  {/* uploaded */}
927
+ {uploadedFiles.map((uf, i) => {
928
+ const key = `${uf.file.name}::${uf.file.size}::${uf.file.lastModified}`;
929
+
930
+ return (
931
+ <div key={key} className="flex items-center justify-between gap-2 rounded-md border px-3 py-2">
932
+ <div className="min-w-0">
933
+ <div className="truncate text-sm font-medium">{uf.file.name}</div>
934
+ <div className="text-xs text-muted-foreground">
935
+ {uf.type}
936
+ </div>
937
+ </div>
938
+
939
+ {/* 垃圾桶:直接删 props(UI + state 同步删) */}
940
+ <Button
941
+ variant="ghost"
942
+ size="icon"
943
+ onClick={() => onRemoveFile(i)} // 或者 onRemoveFile(uf) 也行(因为 App 现在兼容了)
944
+ title="Remove"
945
+ >
946
+ <Trash2 className="h-4 w-4" />
947
+ </Button>
948
+ </div>
949
+ );
950
+ })}
951
 
952
  {/* pending (type dialog 之前也能显示的话) */}
953
  {pendingFiles.map((p, idx) => (