diff --git a/ui/litellm-dashboard/src/components/playground/compareUI/CompareUI.tsx b/ui/litellm-dashboard/src/components/playground/compareUI/CompareUI.tsx index ce738e4cd62..ea79d4ecdff 100644 --- a/ui/litellm-dashboard/src/components/playground/compareUI/CompareUI.tsx +++ b/ui/litellm-dashboard/src/components/playground/compareUI/CompareUI.tsx @@ -4,6 +4,7 @@ import NotificationsManager from "@/components/molecules/notifications_manager"; import { ClearOutlined, DeleteOutlined, FilePdfOutlined, PlusOutlined } from "@ant-design/icons"; import { Button, Input, Select, Tooltip } from "antd"; import { useEffect, useMemo, useState } from "react"; +import { useTranslation } from "react-i18next"; import { v4 as uuidv4 } from "uuid"; import ChatImageUpload from "../chat_ui/ChatImageUpload"; import { createChatDisplayMessage, createChatMultimodalMessage } from "../chat_ui/ChatImageUtils"; @@ -53,6 +54,7 @@ const GENERIC_FOLLOW_UPS = [ const SUGGESTED_PROMPTS = ["Write me a poem", "Explain quantum computing", "Draft a polite email requesting a meeting"]; const DEFAULT_ENDPOINT = EndpointId.CHAT_COMPLETIONS; export default function CompareUI({ accessToken, disabledPersonalKeyCreation }: CompareUIProps) { + const { t } = useTranslation(); const [comparisons, setComparisons] = useState([ { id: "1", @@ -483,7 +485,7 @@ export default function CompareUI({ accessToken, disabledPersonalKeyCreation }: return; } if (!effectiveApiKey) { - NotificationsManager.fromBackend("Please provide a Virtual Key or select Current UI Session"); + NotificationsManager.fromBackend(t("playground.compareUi.provideVirtualKey")); return; } const targetComparisons = comparisons; @@ -643,13 +645,13 @@ export default function CompareUI({ accessToken, disabledPersonalKeyCreation }: messages[messages.length - 1] = { ...last, content: assistantContent - ? `${assistantContent}\nError fetching response: ${errorMessage}` - : `Error fetching response: ${errorMessage}`, + ? `${assistantContent}\n${t("playground.compareUi.errorFetchingResponse", { errorMessage })}` + : t("playground.compareUi.errorFetchingResponse", { errorMessage }), }; } else { messages.push({ role: "assistant", - content: `Error fetching response: ${errorMessage}`, + content: t("playground.compareUi.errorFetchingResponse", { errorMessage }), }); } return { @@ -693,7 +695,9 @@ export default function CompareUI({ accessToken, disabledPersonalKeyCreation }:
- Virtual Key Source + + {t("playground.compareUi.virtualKeySourceLabel")} + {apiKeySource === "custom" && ( setCustomApiKey(event.target.value)} - placeholder="Enter Virtual Key" + placeholder={t("playground.compareUi.enterVirtualKeyPlaceholder")} className="w-56" /> )}
- Endpoint + {t("playground.compareUi.endpointLabel")} {isAddingCustom && ( { diff --git a/ui/litellm-dashboard/src/locales/en.json b/ui/litellm-dashboard/src/locales/en.json index c00b53351db..90ce3cf61a2 100644 --- a/ui/litellm-dashboard/src/locales/en.json +++ b/ui/litellm-dashboard/src/locales/en.json @@ -4061,5 +4061,50 @@ "uiSessionActiveDesc": "UI session active - context maintained client-side", "copyTooltipTitle": "Copy response ID to continue session:" } + }, + "playground": { + "compareUi": { + "virtualKeySourceLabel": "Virtual Key Source", + "currentUiSession": "Current UI Session", + "virtualKeyOption": "Virtual Key", + "enterVirtualKeyPlaceholder": "Enter Virtual Key", + "endpointLabel": "Endpoint", + "clearAllChats": "Clear All Chats", + "compareUpToThreeModels": "Compare up to 3 models at a time", + "addAnotherComparison": "Add another comparison", + "addComparison": "Add Comparison", + "attachmentReadyToSend": "Attachment ready to send", + "uploadPreviewAlt": "Upload preview", + "pdfLabel": "PDF", + "imageLabel": "Image", + "errorFetchingResponse": "Error fetching response: {{errorMessage}}", + "provideVirtualKey": "Please provide a Virtual Key or select Current UI Session" + }, + "comparisonPanel": { + "syncSettingsAcrossModels": "Sync Settings Across Models", + "generalSettings": "General Settings", + "tagsLabel": "Tags", + "vectorStoresLabel": "Vector Stores", + "guardrailsLabel": "Guardrails", + "advancedSettings": "Advanced Settings", + "useAdvancedParameters": "Use Advanced Parameters", + "temperatureLabel": "Temperature", + "maxTokensLabel": "Max Tokens" + }, + "messageDisplay": { + "youLabel": "You", + "generatingResponse": "Generating response...", + "waitingForResponse": "Waiting for a response...", + "assistantFallback": "Assistant" + }, + "messageInput": { + "placeholder": "Type your message... (Shift+Enter for new line)" + }, + "compareModelSelector": { + "loadingModels": "Loading models...", + "selectModel": "Select a model", + "addCustomModel": "+ Add custom model", + "customModelPlaceholder": "Custom Model Name (Enter to add)" + } } } diff --git a/ui/litellm-dashboard/src/locales/zh-CN.json b/ui/litellm-dashboard/src/locales/zh-CN.json index 40ae7c1a843..a49baf59860 100644 --- a/ui/litellm-dashboard/src/locales/zh-CN.json +++ b/ui/litellm-dashboard/src/locales/zh-CN.json @@ -4061,5 +4061,50 @@ "uiSessionActiveDesc": "UI 会话活跃 - 上下文在客户端维护", "copyTooltipTitle": "复制响应 ID 以继续会话:" } + }, + "playground": { + "compareUi": { + "virtualKeySourceLabel": "虚拟密钥来源", + "currentUiSession": "当前 UI 会话", + "virtualKeyOption": "虚拟密钥", + "enterVirtualKeyPlaceholder": "输入虚拟密钥", + "endpointLabel": "端点", + "clearAllChats": "清空所有对话", + "compareUpToThreeModels": "最多同时对比 3 个模型", + "addAnotherComparison": "添加新对比项", + "addComparison": "添加对比", + "attachmentReadyToSend": "附件已准备好发送", + "uploadPreviewAlt": "上传预览", + "pdfLabel": "PDF", + "imageLabel": "图片", + "errorFetchingResponse": "获取响应失败:{{errorMessage}}", + "provideVirtualKey": "请提供虚拟密钥或选择当前 UI 会话" + }, + "comparisonPanel": { + "syncSettingsAcrossModels": "跨模型同步设置", + "generalSettings": "常规设置", + "tagsLabel": "标签", + "vectorStoresLabel": "向量存储", + "guardrailsLabel": "护栏", + "advancedSettings": "高级设置", + "useAdvancedParameters": "使用高级参数", + "temperatureLabel": "Temperature", + "maxTokensLabel": "最大 Token 数" + }, + "messageDisplay": { + "youLabel": "你", + "generatingResponse": "正在生成响应...", + "waitingForResponse": "等待响应...", + "assistantFallback": "Assistant" + }, + "messageInput": { + "placeholder": "输入消息...(Shift+Enter 换行)" + }, + "compareModelSelector": { + "loadingModels": "加载模型中...", + "selectModel": "选择模型", + "addCustomModel": "+ 添加自定义模型", + "customModelPlaceholder": "自定义模型名称(回车确认)" + } } }