mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 20:37:48 +00:00
fix: share link quote (#296)
This commit is contained in:
@@ -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)
|
||||
|
@@ -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<QuoteItemType>();
|
||||
|
||||
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 && <RawFileText filename={item.source} fileId={item.file_id} />}
|
||||
{item.source && !isShare && (
|
||||
<RawFileText filename={item.source} fileId={item.file_id} />
|
||||
)}
|
||||
<Box>{item.q}</Box>
|
||||
<Box>{item.a}</Box>
|
||||
{item.id && (
|
||||
{item.id && !isShare && (
|
||||
<Box
|
||||
className="edit"
|
||||
display={'none'}
|
||||
|
@@ -26,7 +26,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
chatModels: global.chatModels,
|
||||
qaModel: global.qaModel,
|
||||
vectorModels: global.vectorModels,
|
||||
systemVersion: process.env.npm_package_version || '0.0.0'
|
||||
systemVersion: global.systemVersion || '0.0.0'
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -98,9 +98,14 @@ export async function getInitConfig() {
|
||||
try {
|
||||
if (global.feConfigs) return;
|
||||
|
||||
getSystemVersion();
|
||||
|
||||
const filename =
|
||||
process.env.NODE_ENV === 'development' ? 'data/config.local.json' : '/app/data/config.json';
|
||||
const res = JSON.parse(readFileSync(filename, 'utf-8'));
|
||||
|
||||
console.log(`System Version: ${global.systemVersion}`);
|
||||
|
||||
console.log(res);
|
||||
|
||||
global.systemEnv = res.SystemParams
|
||||
@@ -123,3 +128,19 @@ export function setDefaultData() {
|
||||
global.qaModel = defaultQAModel;
|
||||
global.vectorModels = defaultVectorModels;
|
||||
}
|
||||
|
||||
export function getSystemVersion() {
|
||||
try {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
global.systemVersion = process.env.npm_package_version || '0.0.0';
|
||||
return;
|
||||
}
|
||||
const packageJson = JSON.parse(readFileSync('/app/package.json', 'utf-8'));
|
||||
|
||||
global.systemVersion = packageJson?.version;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
global.systemVersion = '0.0.0';
|
||||
}
|
||||
}
|
||||
|
@@ -64,6 +64,7 @@ const OutLink = ({ shareId, chatId }: { shareId: string; chatId: string }) => {
|
||||
status: 'finish'
|
||||
}));
|
||||
result[1].value = responseText;
|
||||
result[1].responseData = responseData;
|
||||
|
||||
/* save chat */
|
||||
saveChatResponse({
|
||||
|
@@ -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) => {
|
||||
</FormErrorMessage>
|
||||
</FormControl>
|
||||
{feConfigs?.show_register && (
|
||||
<Flex align={'center'} justifyContent={'space-between'} mt={3} color={'myBlue.600'}>
|
||||
<Box
|
||||
cursor={'pointer'}
|
||||
_hover={{ textDecoration: 'underline' }}
|
||||
onClick={() => setPageType('forgetPassword')}
|
||||
fontSize="sm"
|
||||
>
|
||||
忘记密码?
|
||||
</Box>
|
||||
<Box
|
||||
cursor={'pointer'}
|
||||
_hover={{ textDecoration: 'underline' }}
|
||||
onClick={() => setPageType('register')}
|
||||
fontSize="sm"
|
||||
>
|
||||
注册账号
|
||||
</Box>
|
||||
</Flex>
|
||||
<>
|
||||
<Flex align={'center'} justifyContent={'space-between'} mt={3} color={'myBlue.600'}>
|
||||
<Box
|
||||
cursor={'pointer'}
|
||||
_hover={{ textDecoration: 'underline' }}
|
||||
onClick={() => setPageType('forgetPassword')}
|
||||
fontSize="sm"
|
||||
>
|
||||
忘记密码?
|
||||
</Box>
|
||||
<Box
|
||||
cursor={'pointer'}
|
||||
_hover={{ textDecoration: 'underline' }}
|
||||
onClick={() => setPageType('register')}
|
||||
fontSize="sm"
|
||||
>
|
||||
注册账号
|
||||
</Box>
|
||||
</Flex>
|
||||
{feConfigs?.show_doc && (
|
||||
<Box textAlign={'center'} mt={2} fontSize={'sm'}>
|
||||
使用即代表你同意我们的{' '}
|
||||
<Link
|
||||
href="https://doc.fastgpt.run/docs/intro/#%e5%85%8d%e8%b4%a3%e5%a3%b0%e6%98%8e"
|
||||
target={'_blank'}
|
||||
color={'myBlue.600'}
|
||||
>
|
||||
免责声明
|
||||
</Link>
|
||||
</Box>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
mt={6}
|
||||
mt={5}
|
||||
w={'100%'}
|
||||
size={['md', 'lg']}
|
||||
colorScheme="blue"
|
||||
|
1
client/src/types/index.d.ts
vendored
1
client/src/types/index.d.ts
vendored
@@ -61,6 +61,7 @@ declare global {
|
||||
var chatModels: ChatModelItemType[];
|
||||
var qaModel: QAModelItemType;
|
||||
var vectorModels: VectorModelItemType[];
|
||||
var systemVersion: string;
|
||||
|
||||
interface Window {
|
||||
['pdfjs-dist/build/pdf']: any;
|
||||
|
Reference in New Issue
Block a user