This commit is contained in:
hailin 2025-04-19 17:00:27 +08:00
parent 3af6742daa
commit 2a4be6ea33
5 changed files with 56 additions and 16 deletions

View File

@ -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<CreateAssistantProps> = ({
isOpen,
onOpenChange
}) => {
const { t } = useTranslation()
const { profile, selectedWorkspace } = useContext(ChatbotUIContext)
const [name, setName] = useState("")
@ -136,10 +141,10 @@ export const CreateAssistant: FC<CreateAssistantProps> = ({
renderInputs={() => (
<>
<div className="space-y-1">
<Label>Name</Label>
<Label>{t("side.name")}</Label>
<Input
placeholder="Assistant name..."
placeholder={t("side.assistantNamePlaceholder")}
value={name}
onChange={e => setName(e.target.value)}
maxLength={ASSISTANT_NAME_MAX}
@ -147,10 +152,10 @@ export const CreateAssistant: FC<CreateAssistantProps> = ({
</div>
<div className="space-y-1 pt-2">
<Label>Description</Label>
<Label>{t("side.description")}</Label>
<Input
placeholder="Assistant description..."
placeholder={t("side.assistantDescriptionPlaceholder")}
value={description}
onChange={e => setDescription(e.target.value)}
maxLength={ASSISTANT_DESCRIPTION_MAX}
@ -159,9 +164,9 @@ export const CreateAssistant: FC<CreateAssistantProps> = ({
<div className="space-y-1 pt-2">
<Label className="flex space-x-1">
<div>Image</div>
<div>{t("side.image")}</div>
<div className="text-xs">(optional)</div>
<div className="text-xs">{t("side.optional")}</div>
</Label>
<ImagePicker
@ -181,7 +186,7 @@ export const CreateAssistant: FC<CreateAssistantProps> = ({
/>
<div className="space-y-1 pt-2">
<Label>Files & Collections</Label>
<Label>{t("side.filesAndCollections")}</Label>
<AssistantRetrievalSelect
selectedAssistantRetrievalItems={selectedAssistantRetrievalItems}
@ -191,7 +196,7 @@ export const CreateAssistant: FC<CreateAssistantProps> = ({
{checkIfModelIsToolCompatible() ? (
<div className="space-y-1">
<Label>Tools</Label>
<Label>{t("side.tools")}</Label>
<AssistantToolSelect
selectedAssistantTools={selectedAssistantToolItems}
@ -200,7 +205,7 @@ export const CreateAssistant: FC<CreateAssistantProps> = ({
</div>
) : (
<div className="pt-1 font-semibold">
Model is not compatible with tools.
{t("side.modelIncompatibleWithTools")}
</div>
)}
</>

View File

@ -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<UpdateChatProps> = ({ chat }) => {
const { t } = useTranslation()
const { setChats } = useContext(ChatbotUIContext)
const buttonRef = useRef<HTMLButtonElement>(null)
@ -52,22 +57,22 @@ export const UpdateChat: FC<UpdateChatProps> = ({ chat }) => {
<DialogContent onKeyDown={handleKeyDown}>
<DialogHeader>
<DialogTitle>Edit Chat</DialogTitle>
<DialogTitle>{t("side.editChat")}</DialogTitle>
</DialogHeader>
<div className="space-y-1">
<Label>Name</Label>
<Label>{t("side.name")}</Label>
<Input value={name} onChange={e => setName(e.target.value)} />
</div>
<DialogFooter>
<Button variant="ghost" onClick={() => setShowChatDialog(false)}>
Cancel
{t("side.cancel")}
</Button>
<Button ref={buttonRef} onClick={handleUpdateChat}>
Save
{t("side.save")}
</Button>
</DialogFooter>
</DialogContent>

View File

@ -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": {

View File

@ -152,7 +152,17 @@
"deleteChatConfirm": "このチャットを削除してもよろしいですか?",
"create": "作成",
"creating": "作成中...",
"delete": "削除"
"delete": "削除",
"name": "名前",
"assistantNamePlaceholder": "アシスタント名...",
"description": "説明",
"assistantDescriptionPlaceholder": "アシスタントの説明...",
"image": "画像",
"optional": "(任意)",
"filesAndCollections": "ファイルとコレクション",
"tools": "ツール",
"modelIncompatibleWithTools": "このモデルはツールと互換性がありません。",
"editChat": "チャットを編集"
},
"contentType": {

View File

@ -152,7 +152,17 @@
"deleteChatConfirm": "您确定要删除此聊天记录吗?",
"create": "创建",
"creating": "正在创建...",
"delete": "删除"
"delete": "删除",
"name": "名称",
"assistantNamePlaceholder": "助手名称...",
"description": "描述",
"assistantDescriptionPlaceholder": "助手描述...",
"image": "图片",
"optional": "(可选)",
"filesAndCollections": "文件与集合",
"tools": "工具",
"modelIncompatibleWithTools": "该模型不支持工具功能。",
"editChat": "编辑对话"
},
"contentType": {