diff --git a/ui/litellm-dashboard/.eslintrc.json b/ui/litellm-dashboard/.eslintrc.json index 76afd93f4e6..6ae9acbea2f 100644 --- a/ui/litellm-dashboard/.eslintrc.json +++ b/ui/litellm-dashboard/.eslintrc.json @@ -60,6 +60,7 @@ "src/components/guardrails/content_filter/ContentFilterDisplay.tsx", "src/components/guardrails/content_filter/CategoryTable.tsx", "src/components/Settings/RouterSettings/Fallbacks/FallbackGroupConfig.tsx", + "src/components/prompts/variable_textarea.tsx", "src/components/prompts/prompt_editor_view/PromptEditorHeader.tsx", "src/components/prompts/prompt_editor_view/VersionHistorySidePanel.tsx", "src/app/(dashboard)/teams/components/TeamsTable/ModelsCell.tsx", diff --git a/ui/litellm-dashboard/src/components/prompts/variable_textarea.tsx b/ui/litellm-dashboard/src/components/prompts/variable_textarea.tsx index dc2dcc1dd9c..62ab7203fe9 100644 --- a/ui/litellm-dashboard/src/components/prompts/variable_textarea.tsx +++ b/ui/litellm-dashboard/src/components/prompts/variable_textarea.tsx @@ -1,8 +1,14 @@ import React, { useState } from "react"; -import { Input, Popover, Tag } from "antd"; -import { EditOutlined } from "@ant-design/icons"; - -const { TextArea } = Input; +import { Badge } from "@/components/ui/badge"; +import { Input } from "@/components/ui/input"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; +import { Textarea } from "@/components/ui/textarea"; +import { Pencil } from "lucide-react"; +import { cn } from "@/lib/utils"; interface VariableTextAreaProps { value: string; @@ -26,8 +32,11 @@ const VariableTextArea: React.FC = ({ } | null>(null); const [newVariableName, setNewVariableName] = useState(""); - // Extract all variables from the text - const extractVariables = (): Array<{ name: string; start: number; end: number }> => { + const extractVariables = (): Array<{ + name: string; + start: number; + end: number; + }> => { const variableRegex = /\{\{(\w+)\}\}/g; const variables: Array<{ name: string; start: number; end: number }> = []; let match; @@ -58,76 +67,24 @@ const VariableTextArea: React.FC = ({ const variables = extractVariables(); - // New approach: Use ContentEditable div for true inline styling - // This is much harder to get right with React, so for now, let's stick to the reliable - // "Tags Below" approach which is robust and functional. - // If user insists on inline coloring, we can revisit the overlay approach but it's very fragile. - - // BUT, to satisfy "variables in text box", we can try a simple trick: - // Render the text as HTML with colored spans inside a contentEditable div - // and sync it back. This is the "wysiwyg" approach. - return ( -
- - - {/* Using standard TextArea for reliability */} -