+ {
+ isMobile &&
+ {!collapse && { setCollapse(true) }} className="">收起}
+ {collapse && { setCollapse(false) }} className="">展开}
-
- {words.map((str, i) =>
{str} onClose(i)}>x
)}
- {
- editCustomKey ?
{
- if (event.key === "Enter" && !event.shiftKey) {
- handleAddKeyword(inputRef.current.value);
- }
- }}
- onBlur={() => {
- handleAddKeyword(inputRef.current.value);
- }}>
:
-
{t('chat.addCustomLabel')}
- }
+ }
+ {
+ isMobile &&
+ 关闭
- {/* files */}
-
-
{t('chat.sourceDocumentsLabel')}
- {files.map(_file =>
- _file.right ?
setFile(_file)} className={`group rounded-xl bg-[#fff] dark:bg-[#303134] hover-bg-gray-200 flex items-center px-4 mb-2 relative min-h-16 cursor-pointer ${file?.id === _file.id && 'bg-gray-200'}`}>
-
{_file.fileName}
-
- {
- _file.fileUrl &&
- }
- {
- _file.originUrl &&
- }
-
-
{_file.score}
-
:
-
-
是真的马赛克.msk
+ }
+ {/* left */}
+ {
+ (!isMobile || !collapse) &&
+ {/* label */}
+ {/* 中英 */}
+
+
+
{t('chat.filterLabel')}
+
+
+
+
+
+
+ {t('chat.tooltipText')}
+
+
+
+
+
+
+ {words.map((str, i) =>
{str} onClose(i)}>x
)}
+ {
+ editCustomKey ?
{
+ if (event.key === "Enter" && !event.shiftKey) {
+ handleAddKeyword(inputRef.current.value);
+ }
+ }}
+ onBlur={() => {
+ handleAddKeyword(inputRef.current.value);
+ }}>
:
+
{t('chat.addCustomLabel')}
+ }
+
+ {/* files */}
+
+
{t('chat.sourceDocumentsLabel')}
+ {files.map(_file =>
+ _file.right ?
setFile(_file)} className={`group rounded-xl bg-[#fff] dark:bg-[#303134] hover-bg-gray-200 flex items-center px-4 mb-2 relative min-h-16 cursor-pointer ${file?.id === _file.id && 'bg-gray-200'}`}>
+
{_file.fileName}
+
+ {
+ _file.fileUrl &&
+ }
+ {
+ _file.originUrl &&
+ }
+
{_file.score}
-
- )}
- {!files.length &&
{t('chat.noMatchedFilesMessage')}
}
+
:
+
+
是真的马赛克.msk
+
{_file.score}
+
+ )}
+ {!files.length &&
{t('chat.noMatchedFilesMessage')}
}
+
-
+ }
{/* file pane */}
{file && children(file)}
@@ -190,7 +230,7 @@ const ResouceModal = forwardRef((props, ref) => {
*/}
{open &&
-
+ setOpen(false)}>
{
(file) => file.fileUrl ?
:
diff --git a/src/frontend/src/pages/SystemPage/components/Config.tsx b/src/frontend/src/pages/SystemPage/components/Config.tsx
index ff4c5e742..387230d23 100644
--- a/src/frontend/src/pages/SystemPage/components/Config.tsx
+++ b/src/frontend/src/pages/SystemPage/components/Config.tsx
@@ -2,12 +2,15 @@ import { useContext, useEffect, useRef, useState } from "react";
import AceEditor from "react-ace";
import { useTranslation } from "react-i18next";
import { Button } from "../../../components/bs-ui/button";
-import { alertContext } from "../../../contexts/alertContext";
import { getSysConfigApi, setSysConfigApi } from "../../../controllers/API/user";
import { captureAndAlertRequestErrorHoc } from "../../../controllers/request";
+import { locationContext } from "@/contexts/locationContext";
+import { useToast } from "@/components/bs-ui/toast/use-toast";
export default function Config() {
- const { setErrorData, setSuccessData } = useContext(alertContext);
+ const { toast, message } = useToast()
+ const { reloadConfig } = useContext(locationContext)
+
const [config, setConfig] = useState('')
const { t } = useTranslation()
@@ -21,15 +24,23 @@ export default function Config() {
const handleSave = () => {
if (validataRef.current.length) {
- return setErrorData({
+ return toast({
+ variant: 'error',
title: `yaml${t('formatError')}`,
- list: validataRef.current.map(el => el.text),
- });
+ description: validataRef.current.map(el => el.text)
+ })
}
captureAndAlertRequestErrorHoc(setSysConfigApi({ data: codeRef.current }).then(res => {
- setSuccessData({ title: t('success') })
+ message({
+ variant: 'success',
+ title: t('prompt'),
+ description: t('success')
+ })
setConfig(codeRef.current)
+
+ // 更新配置信息
+ reloadConfig()
}))
}