Spaces:
Running
Running
File size: 2,132 Bytes
c2ea5ed |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
/**
* Context Documents Modal Component
*
* Modal for managing context documents, converted from the right panel
*/
import React, { useState } from "react";
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import { FileText } from "lucide-react";
import { ContextDocumentsSection } from "@/components/features/context/ContextDocumentsSection";
interface ContextDocumentsModalProps {
isOpen: boolean;
onClose: () => void;
traceId: string;
}
export function ContextDocumentsModal({
isOpen,
onClose,
traceId,
}: ContextDocumentsModalProps) {
const [triggerAddContext, setTriggerAddContext] = useState(0);
return (
<Dialog open={isOpen} onOpenChange={onClose}>
<DialogContent className="max-w-4xl max-h-[80vh] flex flex-col">
<DialogHeader className="flex-shrink-0">
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<FileText className="h-5 w-5 text-primary" />
<DialogTitle className="text-lg">Context Documents</DialogTitle>
</div>
<Button
variant="outline"
size="sm"
onClick={() => {
// Trigger the ContextDocumentsSection's add functionality
setTriggerAddContext((prev) => prev + 1);
}}
className="gap-1"
title="Add context document"
>
<FileText className="h-4 w-4" />
Add
</Button>
</div>
<p className="text-sm text-muted-foreground text-left">
Additional context for knowledge extraction
</p>
</DialogHeader>
<div className="flex-1 overflow-hidden">
<div className="h-full overflow-auto pr-1">
<ContextDocumentsSection
traceId={traceId}
showHeader={false}
triggerAdd={triggerAddContext}
/>
</div>
</div>
</DialogContent>
</Dialog>
);
}
|