"use client" import { useState, useCallback } from "react" import { Card, CardHeader, CardTitle, CardDescription, CardContent, } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Textarea } from "@/components/ui/textarea" import { Badge } from "@/components/ui/badge" import { Separator } from "@/components/ui/separator" import { Tooltip, TooltipTrigger, TooltipContent, } from "@/components/ui/tooltip" import { BookText, Plus, Trash2, ArrowRight, Info, Save, RotateCcw, } from "lucide-react" interface GlossaryEntry { id: string source: string target: string } const defaultSystemPrompt = "Translate using formal medical terminology. Maintain the original document structure and formatting. Use British English spelling conventions." const defaultGlossary: GlossaryEntry[] = [ { id: "1", source: "Bilan", target: "Balance Sheet" }, { id: "2", source: "Chiffre d'affaires", target: "Revenue" }, { id: "3", source: "Compte de resultat", target: "Income Statement" }, ] export function GlossaryContextCard() { const [systemPrompt, setSystemPrompt] = useState(defaultSystemPrompt) const [glossary, setGlossary] = useState(defaultGlossary) const [saved, setSaved] = useState(false) const addTerm = useCallback(() => { setGlossary((prev) => [ ...prev, { id: String(Date.now()), source: "", target: "" }, ]) }, []) const removeTerm = useCallback((id: string) => { setGlossary((prev) => prev.filter((entry) => entry.id !== id)) }, []) const updateTerm = useCallback( (id: string, field: "source" | "target", value: string) => { setGlossary((prev) => prev.map((entry) => entry.id === id ? { ...entry, [field]: value } : entry ) ) }, [] ) const handleSave = useCallback(() => { setSaved(true) setTimeout(() => setSaved(false), 2000) }, []) const handleReset = useCallback(() => { setSystemPrompt(defaultSystemPrompt) setGlossary(defaultGlossary) }, []) return (
LLM Context & Glossaries Pro
Fine-tune translations with custom instructions and terminology
{/* System Prompt */}
Instructions given to the LLM engine before every translation. Affects tone, terminology, and style.