From 2a4be6ea33dfc384e41cbde31c7607e373fea2c6 Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 19 Apr 2025 17:00:27 +0800 Subject: [PATCH] . --- .../items/assistants/create-assistant.tsx | 23 +++++++++++-------- components/sidebar/items/chat/update-chat.tsx | 13 +++++++---- public/locales/en/translation.json | 12 +++++++++- public/locales/ja/translation.json | 12 +++++++++- public/locales/zh/translation.json | 12 +++++++++- 5 files changed, 56 insertions(+), 16 deletions(-) diff --git a/components/sidebar/items/assistants/create-assistant.tsx b/components/sidebar/items/assistants/create-assistant.tsx index 7547366..6efe75e 100644 --- a/components/sidebar/items/assistants/create-assistant.tsx +++ b/components/sidebar/items/assistants/create-assistant.tsx @@ -10,6 +10,8 @@ import { FC, useContext, useEffect, useState } from "react" import { AssistantRetrievalSelect } from "./assistant-retrieval-select" import { AssistantToolSelect } from "./assistant-tool-select" +import { useTranslation } from 'react-i18next' + interface CreateAssistantProps { isOpen: boolean onOpenChange: (isOpen: boolean) => void @@ -19,6 +21,9 @@ export const CreateAssistant: FC = ({ isOpen, onOpenChange }) => { + + const { t } = useTranslation() + const { profile, selectedWorkspace } = useContext(ChatbotUIContext) const [name, setName] = useState("") @@ -136,10 +141,10 @@ export const CreateAssistant: FC = ({ renderInputs={() => ( <>
- + setName(e.target.value)} maxLength={ASSISTANT_NAME_MAX} @@ -147,10 +152,10 @@ export const CreateAssistant: FC = ({
- + setDescription(e.target.value)} maxLength={ASSISTANT_DESCRIPTION_MAX} @@ -159,9 +164,9 @@ export const CreateAssistant: FC = ({
= ({ />
- + = ({ {checkIfModelIsToolCompatible() ? (
- + = ({
) : (
- Model is not compatible with tools. + {t("side.modelIncompatibleWithTools")}
)} diff --git a/components/sidebar/items/chat/update-chat.tsx b/components/sidebar/items/chat/update-chat.tsx index e589300..0ef2687 100644 --- a/components/sidebar/items/chat/update-chat.tsx +++ b/components/sidebar/items/chat/update-chat.tsx @@ -15,11 +15,16 @@ import { Tables } from "@/supabase/types" import { IconEdit } from "@tabler/icons-react" import { FC, useContext, useRef, useState } from "react" +import { useTranslation } from 'react-i18next' + interface UpdateChatProps { chat: Tables<"chats"> } export const UpdateChat: FC = ({ chat }) => { + + const { t } = useTranslation() + const { setChats } = useContext(ChatbotUIContext) const buttonRef = useRef(null) @@ -52,22 +57,22 @@ export const UpdateChat: FC = ({ chat }) => { - Edit Chat + {t("side.editChat")}
- + setName(e.target.value)} />
diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index b5e661d..cf3bae1 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -153,7 +153,17 @@ "deleteChatConfirm": "Are you sure you want to delete this chat?", "create": "Create", "creating": "Creating...", - "delete": "Delete" + "delete": "Delete", + "name": "Name", + "assistantNamePlaceholder": "Assistant name...", + "description": "Description", + "assistantDescriptionPlaceholder": "Assistant description...", + "image": "Image", + "optional": "(optional)", + "filesAndCollections": "Files & Collections", + "tools": "Tools", + "modelIncompatibleWithTools": "Model is not compatible with tools.", + "editChat": "Edit Chat" }, "contentType": { diff --git a/public/locales/ja/translation.json b/public/locales/ja/translation.json index 7740f49..fbe741f 100644 --- a/public/locales/ja/translation.json +++ b/public/locales/ja/translation.json @@ -152,7 +152,17 @@ "deleteChatConfirm": "このチャットを削除してもよろしいですか?", "create": "作成", "creating": "作成中...", - "delete": "削除" + "delete": "削除", + "name": "名前", + "assistantNamePlaceholder": "アシスタント名...", + "description": "説明", + "assistantDescriptionPlaceholder": "アシスタントの説明...", + "image": "画像", + "optional": "(任意)", + "filesAndCollections": "ファイルとコレクション", + "tools": "ツール", + "modelIncompatibleWithTools": "このモデルはツールと互換性がありません。", + "editChat": "チャットを編集" }, "contentType": { diff --git a/public/locales/zh/translation.json b/public/locales/zh/translation.json index 5cc74a9..616240a 100644 --- a/public/locales/zh/translation.json +++ b/public/locales/zh/translation.json @@ -152,7 +152,17 @@ "deleteChatConfirm": "您确定要删除此聊天记录吗?", "create": "创建", "creating": "正在创建...", - "delete": "删除" + "delete": "删除", + "name": "名称", + "assistantNamePlaceholder": "助手名称...", + "description": "描述", + "assistantDescriptionPlaceholder": "助手描述...", + "image": "图片", + "optional": "(可选)", + "filesAndCollections": "文件与集合", + "tools": "工具", + "modelIncompatibleWithTools": "该模型不支持工具功能。", + "editChat": "编辑对话" }, "contentType": {