From 6a996272da3d1cc3af48ddf93c077f8b97af3f12 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Wed, 13 Sep 2023 18:15:22 +0800 Subject: [PATCH] fix: share link quote (#296) --- client/public/docs/versionIntro.md | 9 +-- client/src/components/ChatBox/QuoteModal.tsx | 12 +++- client/src/pages/api/system/getInitData.ts | 23 +++++++- client/src/pages/chat/share.tsx | 1 + .../src/pages/login/components/LoginForm.tsx | 55 ++++++++++++------- client/src/types/index.d.ts | 1 + 6 files changed, 73 insertions(+), 28 deletions(-) diff --git a/client/public/docs/versionIntro.md b/client/public/docs/versionIntro.md index 72e65ccb1..31296aa02 100644 --- a/client/public/docs/versionIntro.md +++ b/client/public/docs/versionIntro.md @@ -1,6 +1,7 @@ -### Fast GPT V4.4 +### Fast GPT V4.4.1 1. 新增 - 知识库目录结构 -2. 优化 - [使用文档](https://doc.fastgpt.run/docs/intro/) -3. [点击查看高级编排介绍文档](https://doc.fastgpt.run/docs/workflow) -4. [点击查看商业版](https://fael3z0zfze.feishu.cn/docx/F155dbirfo8vDDx2WgWc6extnwf) +2. 新增 - 分享链接支持配置 IP 限流、过期时间、最大额度等 +3. 优化 - [使用文档](https://doc.fastgpt.run/docs/intro/) +4. [点击查看高级编排介绍文档](https://doc.fastgpt.run/docs/workflow) +5. [点击查看商业版](https://fael3z0zfze.feishu.cn/docx/F155dbirfo8vDDx2WgWc6extnwf) diff --git a/client/src/components/ChatBox/QuoteModal.tsx b/client/src/components/ChatBox/QuoteModal.tsx index 4e75016c6..45ae73bbb 100644 --- a/client/src/components/ChatBox/QuoteModal.tsx +++ b/client/src/components/ChatBox/QuoteModal.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useState } from 'react'; +import React, { useCallback, useMemo, useState } from 'react'; import { ModalBody, Box, useTheme } from '@chakra-ui/react'; import { getKbDataItemById } from '@/api/plugins/kb'; import { useLoading } from '@/hooks/useLoading'; @@ -9,6 +9,7 @@ import MyIcon from '@/components/Icon'; import InputDataModal, { RawFileText } from '@/pages/kb/detail/components/InputDataModal'; import MyModal from '../MyModal'; import { KbDataItemType } from '@/types/plugin'; +import { useRouter } from 'next/router'; type SearchType = KbDataItemType & { kb_id?: string; @@ -24,10 +25,13 @@ const QuoteModal = ({ onClose: () => void; }) => { const theme = useTheme(); + const router = useRouter(); const { toast } = useToast(); const { setIsLoading, Loading } = useLoading(); const [editDataItem, setEditDataItem] = useState(); + const isShare = useMemo(() => router.pathname === '/chat/share', [router.pathname]); + /** * click edit, get new kbDataItem */ @@ -91,10 +95,12 @@ const QuoteModal = ({ _hover={{ '& .edit': { display: 'flex' } }} overflow={'hidden'} > - {item.source && } + {item.source && !isShare && ( + + )} {item.q} {item.a} - {item.id && ( + {item.id && !isShare && ( { status: 'finish' })); result[1].value = responseText; + result[1].responseData = responseData; /* save chat */ saveChatResponse({ diff --git a/client/src/pages/login/components/LoginForm.tsx b/client/src/pages/login/components/LoginForm.tsx index 913e21908..71e2cd5ee 100644 --- a/client/src/pages/login/components/LoginForm.tsx +++ b/client/src/pages/login/components/LoginForm.tsx @@ -1,5 +1,5 @@ import React, { useState, Dispatch, useCallback, useRef } from 'react'; -import { FormControl, Flex, Input, Button, FormErrorMessage, Box } from '@chakra-ui/react'; +import { FormControl, Flex, Input, Button, FormErrorMessage, Box, Link } from '@chakra-ui/react'; import { useForm } from 'react-hook-form'; import { useRouter } from 'next/router'; import { OAuthEnum, PageTypeEnum } from '@/constants/user'; @@ -120,28 +120,43 @@ const LoginForm = ({ setPageType, loginSuccess }: Props) => { {feConfigs?.show_register && ( - - setPageType('forgetPassword')} - fontSize="sm" - > - 忘记密码? - - setPageType('register')} - fontSize="sm" - > - 注册账号 - - + <> + + setPageType('forgetPassword')} + fontSize="sm" + > + 忘记密码? + + setPageType('register')} + fontSize="sm" + > + 注册账号 + + + {feConfigs?.show_doc && ( + + 使用即代表你同意我们的{' '} + + 免责声明 + + + )} + )} +