This commit is contained in:
parent
3af6742daa
commit
2a4be6ea33
|
|
@ -10,6 +10,8 @@ import { FC, useContext, useEffect, useState } from "react"
|
||||||
import { AssistantRetrievalSelect } from "./assistant-retrieval-select"
|
import { AssistantRetrievalSelect } from "./assistant-retrieval-select"
|
||||||
import { AssistantToolSelect } from "./assistant-tool-select"
|
import { AssistantToolSelect } from "./assistant-tool-select"
|
||||||
|
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
interface CreateAssistantProps {
|
interface CreateAssistantProps {
|
||||||
isOpen: boolean
|
isOpen: boolean
|
||||||
onOpenChange: (isOpen: boolean) => void
|
onOpenChange: (isOpen: boolean) => void
|
||||||
|
|
@ -19,6 +21,9 @@ export const CreateAssistant: FC<CreateAssistantProps> = ({
|
||||||
isOpen,
|
isOpen,
|
||||||
onOpenChange
|
onOpenChange
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
|
const { t } = useTranslation()
|
||||||
|
|
||||||
const { profile, selectedWorkspace } = useContext(ChatbotUIContext)
|
const { profile, selectedWorkspace } = useContext(ChatbotUIContext)
|
||||||
|
|
||||||
const [name, setName] = useState("")
|
const [name, setName] = useState("")
|
||||||
|
|
@ -136,10 +141,10 @@ export const CreateAssistant: FC<CreateAssistantProps> = ({
|
||||||
renderInputs={() => (
|
renderInputs={() => (
|
||||||
<>
|
<>
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<Label>Name</Label>
|
<Label>{t("side.name")}</Label>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
placeholder="Assistant name..."
|
placeholder={t("side.assistantNamePlaceholder")}
|
||||||
value={name}
|
value={name}
|
||||||
onChange={e => setName(e.target.value)}
|
onChange={e => setName(e.target.value)}
|
||||||
maxLength={ASSISTANT_NAME_MAX}
|
maxLength={ASSISTANT_NAME_MAX}
|
||||||
|
|
@ -147,10 +152,10 @@ export const CreateAssistant: FC<CreateAssistantProps> = ({
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-1 pt-2">
|
<div className="space-y-1 pt-2">
|
||||||
<Label>Description</Label>
|
<Label>{t("side.description")}</Label>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
placeholder="Assistant description..."
|
placeholder={t("side.assistantDescriptionPlaceholder")}
|
||||||
value={description}
|
value={description}
|
||||||
onChange={e => setDescription(e.target.value)}
|
onChange={e => setDescription(e.target.value)}
|
||||||
maxLength={ASSISTANT_DESCRIPTION_MAX}
|
maxLength={ASSISTANT_DESCRIPTION_MAX}
|
||||||
|
|
@ -159,9 +164,9 @@ export const CreateAssistant: FC<CreateAssistantProps> = ({
|
||||||
|
|
||||||
<div className="space-y-1 pt-2">
|
<div className="space-y-1 pt-2">
|
||||||
<Label className="flex space-x-1">
|
<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>
|
</Label>
|
||||||
|
|
||||||
<ImagePicker
|
<ImagePicker
|
||||||
|
|
@ -181,7 +186,7 @@ export const CreateAssistant: FC<CreateAssistantProps> = ({
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="space-y-1 pt-2">
|
<div className="space-y-1 pt-2">
|
||||||
<Label>Files & Collections</Label>
|
<Label>{t("side.filesAndCollections")}</Label>
|
||||||
|
|
||||||
<AssistantRetrievalSelect
|
<AssistantRetrievalSelect
|
||||||
selectedAssistantRetrievalItems={selectedAssistantRetrievalItems}
|
selectedAssistantRetrievalItems={selectedAssistantRetrievalItems}
|
||||||
|
|
@ -191,7 +196,7 @@ export const CreateAssistant: FC<CreateAssistantProps> = ({
|
||||||
|
|
||||||
{checkIfModelIsToolCompatible() ? (
|
{checkIfModelIsToolCompatible() ? (
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<Label>Tools</Label>
|
<Label>{t("side.tools")}</Label>
|
||||||
|
|
||||||
<AssistantToolSelect
|
<AssistantToolSelect
|
||||||
selectedAssistantTools={selectedAssistantToolItems}
|
selectedAssistantTools={selectedAssistantToolItems}
|
||||||
|
|
@ -200,7 +205,7 @@ export const CreateAssistant: FC<CreateAssistantProps> = ({
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="pt-1 font-semibold">
|
<div className="pt-1 font-semibold">
|
||||||
Model is not compatible with tools.
|
{t("side.modelIncompatibleWithTools")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,16 @@ import { Tables } from "@/supabase/types"
|
||||||
import { IconEdit } from "@tabler/icons-react"
|
import { IconEdit } from "@tabler/icons-react"
|
||||||
import { FC, useContext, useRef, useState } from "react"
|
import { FC, useContext, useRef, useState } from "react"
|
||||||
|
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
interface UpdateChatProps {
|
interface UpdateChatProps {
|
||||||
chat: Tables<"chats">
|
chat: Tables<"chats">
|
||||||
}
|
}
|
||||||
|
|
||||||
export const UpdateChat: FC<UpdateChatProps> = ({ chat }) => {
|
export const UpdateChat: FC<UpdateChatProps> = ({ chat }) => {
|
||||||
|
|
||||||
|
const { t } = useTranslation()
|
||||||
|
|
||||||
const { setChats } = useContext(ChatbotUIContext)
|
const { setChats } = useContext(ChatbotUIContext)
|
||||||
|
|
||||||
const buttonRef = useRef<HTMLButtonElement>(null)
|
const buttonRef = useRef<HTMLButtonElement>(null)
|
||||||
|
|
@ -52,22 +57,22 @@ export const UpdateChat: FC<UpdateChatProps> = ({ chat }) => {
|
||||||
|
|
||||||
<DialogContent onKeyDown={handleKeyDown}>
|
<DialogContent onKeyDown={handleKeyDown}>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Edit Chat</DialogTitle>
|
<DialogTitle>{t("side.editChat")}</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<Label>Name</Label>
|
<Label>{t("side.name")}</Label>
|
||||||
|
|
||||||
<Input value={name} onChange={e => setName(e.target.value)} />
|
<Input value={name} onChange={e => setName(e.target.value)} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button variant="ghost" onClick={() => setShowChatDialog(false)}>
|
<Button variant="ghost" onClick={() => setShowChatDialog(false)}>
|
||||||
Cancel
|
{t("side.cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button ref={buttonRef} onClick={handleUpdateChat}>
|
<Button ref={buttonRef} onClick={handleUpdateChat}>
|
||||||
Save
|
{t("side.save")}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,17 @@
|
||||||
"deleteChatConfirm": "Are you sure you want to delete this chat?",
|
"deleteChatConfirm": "Are you sure you want to delete this chat?",
|
||||||
"create": "Create",
|
"create": "Create",
|
||||||
"creating": "Creating...",
|
"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": {
|
"contentType": {
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,17 @@
|
||||||
"deleteChatConfirm": "このチャットを削除してもよろしいですか?",
|
"deleteChatConfirm": "このチャットを削除してもよろしいですか?",
|
||||||
"create": "作成",
|
"create": "作成",
|
||||||
"creating": "作成中...",
|
"creating": "作成中...",
|
||||||
"delete": "削除"
|
"delete": "削除",
|
||||||
|
"name": "名前",
|
||||||
|
"assistantNamePlaceholder": "アシスタント名...",
|
||||||
|
"description": "説明",
|
||||||
|
"assistantDescriptionPlaceholder": "アシスタントの説明...",
|
||||||
|
"image": "画像",
|
||||||
|
"optional": "(任意)",
|
||||||
|
"filesAndCollections": "ファイルとコレクション",
|
||||||
|
"tools": "ツール",
|
||||||
|
"modelIncompatibleWithTools": "このモデルはツールと互換性がありません。",
|
||||||
|
"editChat": "チャットを編集"
|
||||||
},
|
},
|
||||||
|
|
||||||
"contentType": {
|
"contentType": {
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,17 @@
|
||||||
"deleteChatConfirm": "您确定要删除此聊天记录吗?",
|
"deleteChatConfirm": "您确定要删除此聊天记录吗?",
|
||||||
"create": "创建",
|
"create": "创建",
|
||||||
"creating": "正在创建...",
|
"creating": "正在创建...",
|
||||||
"delete": "删除"
|
"delete": "删除",
|
||||||
|
"name": "名称",
|
||||||
|
"assistantNamePlaceholder": "助手名称...",
|
||||||
|
"description": "描述",
|
||||||
|
"assistantDescriptionPlaceholder": "助手描述...",
|
||||||
|
"image": "图片",
|
||||||
|
"optional": "(可选)",
|
||||||
|
"filesAndCollections": "文件与集合",
|
||||||
|
"tools": "工具",
|
||||||
|
"modelIncompatibleWithTools": "该模型不支持工具功能。",
|
||||||
|
"editChat": "编辑对话"
|
||||||
},
|
},
|
||||||
|
|
||||||
"contentType": {
|
"contentType": {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue