mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +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. 新增 - 知识库目录结构
|
1. 新增 - 知识库目录结构
|
||||||
2. 优化 - [使用文档](https://doc.fastgpt.run/docs/intro/)
|
2. 新增 - 分享链接支持配置 IP 限流、过期时间、最大额度等
|
||||||
3. [点击查看高级编排介绍文档](https://doc.fastgpt.run/docs/workflow)
|
3. 优化 - [使用文档](https://doc.fastgpt.run/docs/intro/)
|
||||||
4. [点击查看商业版](https://fael3z0zfze.feishu.cn/docx/F155dbirfo8vDDx2WgWc6extnwf)
|
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 { ModalBody, Box, useTheme } from '@chakra-ui/react';
|
||||||
import { getKbDataItemById } from '@/api/plugins/kb';
|
import { getKbDataItemById } from '@/api/plugins/kb';
|
||||||
import { useLoading } from '@/hooks/useLoading';
|
import { useLoading } from '@/hooks/useLoading';
|
||||||
@@ -9,6 +9,7 @@ import MyIcon from '@/components/Icon';
|
|||||||
import InputDataModal, { RawFileText } from '@/pages/kb/detail/components/InputDataModal';
|
import InputDataModal, { RawFileText } from '@/pages/kb/detail/components/InputDataModal';
|
||||||
import MyModal from '../MyModal';
|
import MyModal from '../MyModal';
|
||||||
import { KbDataItemType } from '@/types/plugin';
|
import { KbDataItemType } from '@/types/plugin';
|
||||||
|
import { useRouter } from 'next/router';
|
||||||
|
|
||||||
type SearchType = KbDataItemType & {
|
type SearchType = KbDataItemType & {
|
||||||
kb_id?: string;
|
kb_id?: string;
|
||||||
@@ -24,10 +25,13 @@ const QuoteModal = ({
|
|||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const router = useRouter();
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
const { setIsLoading, Loading } = useLoading();
|
const { setIsLoading, Loading } = useLoading();
|
||||||
const [editDataItem, setEditDataItem] = useState<QuoteItemType>();
|
const [editDataItem, setEditDataItem] = useState<QuoteItemType>();
|
||||||
|
|
||||||
|
const isShare = useMemo(() => router.pathname === '/chat/share', [router.pathname]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* click edit, get new kbDataItem
|
* click edit, get new kbDataItem
|
||||||
*/
|
*/
|
||||||
@@ -91,10 +95,12 @@ const QuoteModal = ({
|
|||||||
_hover={{ '& .edit': { display: 'flex' } }}
|
_hover={{ '& .edit': { display: 'flex' } }}
|
||||||
overflow={'hidden'}
|
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.q}</Box>
|
||||||
<Box>{item.a}</Box>
|
<Box>{item.a}</Box>
|
||||||
{item.id && (
|
{item.id && !isShare && (
|
||||||
<Box
|
<Box
|
||||||
className="edit"
|
className="edit"
|
||||||
display={'none'}
|
display={'none'}
|
||||||
|
@@ -26,7 +26,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
chatModels: global.chatModels,
|
chatModels: global.chatModels,
|
||||||
qaModel: global.qaModel,
|
qaModel: global.qaModel,
|
||||||
vectorModels: global.vectorModels,
|
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 {
|
try {
|
||||||
if (global.feConfigs) return;
|
if (global.feConfigs) return;
|
||||||
|
|
||||||
|
getSystemVersion();
|
||||||
|
|
||||||
const filename =
|
const filename =
|
||||||
process.env.NODE_ENV === 'development' ? 'data/config.local.json' : '/app/data/config.json';
|
process.env.NODE_ENV === 'development' ? 'data/config.local.json' : '/app/data/config.json';
|
||||||
const res = JSON.parse(readFileSync(filename, 'utf-8'));
|
const res = JSON.parse(readFileSync(filename, 'utf-8'));
|
||||||
|
|
||||||
|
console.log(`System Version: ${global.systemVersion}`);
|
||||||
|
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
|
||||||
global.systemEnv = res.SystemParams
|
global.systemEnv = res.SystemParams
|
||||||
@@ -123,3 +128,19 @@ export function setDefaultData() {
|
|||||||
global.qaModel = defaultQAModel;
|
global.qaModel = defaultQAModel;
|
||||||
global.vectorModels = defaultVectorModels;
|
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'
|
status: 'finish'
|
||||||
}));
|
}));
|
||||||
result[1].value = responseText;
|
result[1].value = responseText;
|
||||||
|
result[1].responseData = responseData;
|
||||||
|
|
||||||
/* save chat */
|
/* save chat */
|
||||||
saveChatResponse({
|
saveChatResponse({
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState, Dispatch, useCallback, useRef } from 'react';
|
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 { useForm } from 'react-hook-form';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { OAuthEnum, PageTypeEnum } from '@/constants/user';
|
import { OAuthEnum, PageTypeEnum } from '@/constants/user';
|
||||||
@@ -120,28 +120,43 @@ const LoginForm = ({ setPageType, loginSuccess }: Props) => {
|
|||||||
</FormErrorMessage>
|
</FormErrorMessage>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
{feConfigs?.show_register && (
|
{feConfigs?.show_register && (
|
||||||
<Flex align={'center'} justifyContent={'space-between'} mt={3} color={'myBlue.600'}>
|
<>
|
||||||
<Box
|
<Flex align={'center'} justifyContent={'space-between'} mt={3} color={'myBlue.600'}>
|
||||||
cursor={'pointer'}
|
<Box
|
||||||
_hover={{ textDecoration: 'underline' }}
|
cursor={'pointer'}
|
||||||
onClick={() => setPageType('forgetPassword')}
|
_hover={{ textDecoration: 'underline' }}
|
||||||
fontSize="sm"
|
onClick={() => setPageType('forgetPassword')}
|
||||||
>
|
fontSize="sm"
|
||||||
忘记密码?
|
>
|
||||||
</Box>
|
忘记密码?
|
||||||
<Box
|
</Box>
|
||||||
cursor={'pointer'}
|
<Box
|
||||||
_hover={{ textDecoration: 'underline' }}
|
cursor={'pointer'}
|
||||||
onClick={() => setPageType('register')}
|
_hover={{ textDecoration: 'underline' }}
|
||||||
fontSize="sm"
|
onClick={() => setPageType('register')}
|
||||||
>
|
fontSize="sm"
|
||||||
注册账号
|
>
|
||||||
</Box>
|
注册账号
|
||||||
</Flex>
|
</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
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
mt={6}
|
mt={5}
|
||||||
w={'100%'}
|
w={'100%'}
|
||||||
size={['md', 'lg']}
|
size={['md', 'lg']}
|
||||||
colorScheme="blue"
|
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 chatModels: ChatModelItemType[];
|
||||||
var qaModel: QAModelItemType;
|
var qaModel: QAModelItemType;
|
||||||
var vectorModels: VectorModelItemType[];
|
var vectorModels: VectorModelItemType[];
|
||||||
|
var systemVersion: string;
|
||||||
|
|
||||||
interface Window {
|
interface Window {
|
||||||
['pdfjs-dist/build/pdf']: any;
|
['pdfjs-dist/build/pdf']: any;
|
||||||
|
Reference in New Issue
Block a user