Add OpenAPI docs;Correct the glm document (#346)

This commit is contained in:
Archer
2023-09-25 14:28:44 +08:00
committed by GitHub
parent c9db9f33ea
commit 9136c9306a
19 changed files with 543 additions and 154 deletions

View File

@@ -2,10 +2,10 @@
- [**Git 地址**,点击查看项目地址](https://github.com/labring/FastGPT)
- [本地部署 FastGPT](https://doc.fastgpt.run/docs/installation)
- [API 文档](https://kjqvjse66l.feishu.cn/docx/DmLedTWtUoNGX8xui9ocdUEjnNh?pre_pathname=%2Fdrive%2Fhome%2F)
- [API 文档](https://doc.fastgpt.run/docs/development/openapi?pre_pathname=%2Fdrive%2Fhome%2F)
- **反馈问卷**: 如果你遇到任何使用问题或有期望的功能,可以[填写该问卷](https://www.wjx.cn/vm/rLIw1uD.aspx#)
- **问题文档**: [先看文档,再提问](https://kjqvjse66l.feishu.cn/docx/HtrgdT0pkonP4kxGx8qcu6XDnGh)
- [点击查看商业版文档](https://fael3z0zfze.feishu.cn/docx/F155dbirfo8vDDx2WgWc6extnwf)
- [点击查看商业版文档](https://doc.fastgpt.run/docs/commercial)
- [计费规则](https://doc.fastgpt.run/docs/pricing/)
**其他问题**

View File

@@ -247,8 +247,8 @@
"QPM": "",
"QPM Tips": "每个 IP 每分钟最多提问多少次",
"QPM is empty": "QPM 不能为空",
"Response Detail": "返回引用",
"Response Detail tips": "是否需要返回引用"
"Response Detail": "返回详情",
"Response Detail tips": "是否需要返回详情(引用内容,调用时间等,不会返回预设提示词和完整上下文)"
},
"system": {
"Help Document": "帮助文档"

View File

@@ -612,6 +612,7 @@ const ChatBox = (
>
{item.obj === 'Human' && (
<>
{/* control icon */}
<Flex w={'100%'} alignItems={'center'} justifyContent={'flex-end'}>
<Flex {...controlContainerStyle} justifyContent={'flex-end'} mr={3}>
<MyTooltip label={t('common.Copy')}>
@@ -654,6 +655,7 @@ const ChatBox = (
</Flex>
<ChatAvatar src={userAvatar} type={'Human'} />
</Flex>
{/* content */}
<Box mt={['6px', 2]} textAlign={'right'}>
<Card
className="markdown"
@@ -670,6 +672,7 @@ const ChatBox = (
)}
{item.obj === 'AI' && (
<>
{/* control icon */}
<Flex w={'100%'} alignItems={'flex-end'}>
<ChatAvatar src={appAvatar} type={'AI'} />
<Flex
@@ -822,6 +825,7 @@ const ChatBox = (
</Flex>
)}
</Flex>
{/* content */}
<Box textAlign={'left'} mt={['6px', 2]}>
<Card bg={'white'} {...MessageCardStyle}>
<Markdown

View File

@@ -83,10 +83,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
API
</Box>
<Link
href={
feConfigs.openAPIUrl ||
'https://kjqvjse66l.feishu.cn/docx/DmLedTWtUoNGX8xui9ocdUEjnNh'
}
href={feConfigs.openAPIUrl || 'https://doc.fastgpt.run/docs/development/openapi'}
target={'_blank'}
ml={1}
color={'myBlue.600'}

View File

@@ -39,6 +39,7 @@ import { formatPrice } from '@fastgpt/common/bill/index';
import { OutLinkTypeEnum } from '@/constants/chat';
import { useTranslation } from 'react-i18next';
import { useToast } from '@/hooks/useToast';
import { feConfigs } from '@/store/static';
import MyTooltip from '@/components/MyTooltip';
import MyModal from '@/components/MyModal';
import dayjs from 'dayjs';
@@ -89,12 +90,14 @@ const Share = ({ appId }: { appId: string }) => {
<Tr>
<Th></Th>
<Th>()</Th>
<>
<Th>()</Th>
<Th>IP限流/</Th>
</>
<Th></Th>
<Th></Th>
<Th></Th>
{feConfigs?.isPlus && (
<>
<Th>()</Th>
<Th>IP限流/</Th>
<Th></Th>
</>
)}
<Th>使</Th>
<Th></Th>
</Tr>
@@ -104,18 +107,20 @@ const Share = ({ appId }: { appId: string }) => {
<Tr key={item._id}>
<Td>{item.name}</Td>
<Td>{formatPrice(item.total)}</Td>
{item.limit && (
<Td>{item.responseDetail ? '✔' : '✖'}</Td>
{feConfigs?.isPlus && (
<>
<Td>{item.limit?.credit > -1 ? `${item.limit?.credit}` : '无限制'}</Td>
<Td>{item.limit?.QPM}</Td>
<Td>
{item.limit && item.limit.credit > -1 ? `${item.limit.credit}` : '无限制'}
</Td>
<Td>{item.limit?.QPM || '-'}</Td>
<Td>
{item.limit?.expiredTime
? dayjs(item.limit?.expiredTime).format('YYYY/MM/DD\nHH:mm')
: '-'}
</Td>
</>
)}
<Td>{item.responseDetail ? '✔' : '✖'}</Td>
<Td>
{item.limit?.expiredTime
? dayjs(item.limit?.expiredTime).format('YYYY/MM/DD\nHH:mm')
: '-'}
</Td>
<Td>{item.lastTime ? formatTimeToChatTime(item.lastTime) : '未使用'}</Td>
<Td display={'flex'} alignItems={'center'}>
<Menu autoSelect={false} isLazy>
@@ -282,55 +287,60 @@ function EditLinkModal({
})}
/>
</Flex>
<Flex alignItems={'center'} mt={4}>
<Flex flex={'0 0 90px'} alignItems={'center'}>
QPM:
<MyTooltip label={t('outlink.QPM Tips' || '')}>
<QuestionOutlineIcon ml={1} />
</MyTooltip>
</Flex>
<Input
max={1000}
{...register('limit.QPM', {
min: 0,
max: 1000,
valueAsNumber: true,
required: t('outlink.QPM is empty') || ''
})}
/>
</Flex>
<Flex alignItems={'center'} mt={4}>
<Flex flex={'0 0 90px'} alignItems={'center'}>
{t('common.Max credit')}:
<MyTooltip label={t('common.Max credit tips' || '')}>
<QuestionOutlineIcon ml={1} />
</MyTooltip>
</Flex>
<Input
{...register('limit.credit', {
min: -1,
max: 1000,
valueAsNumber: true,
required: true
})}
/>
</Flex>
<Flex alignItems={'center'} mt={4}>
<Flex flex={'0 0 90px'} alignItems={'center'}>
{t('common.Expired Time')}:
</Flex>
<Input
type="datetime-local"
defaultValue={
defaultData.limit?.expiredTime
? dayjs(defaultData.limit?.expiredTime).format('YYYY-MM-DDTHH:mm')
: ''
}
onChange={(e) => {
setValue('limit.expiredTime', new Date(e.target.value));
}}
/>
</Flex>
{feConfigs?.isPlus && (
<>
<Flex alignItems={'center'} mt={4}>
<Flex flex={'0 0 90px'} alignItems={'center'}>
QPM:
<MyTooltip label={t('outlink.QPM Tips' || '')}>
<QuestionOutlineIcon ml={1} />
</MyTooltip>
</Flex>
<Input
max={1000}
{...register('limit.QPM', {
min: 0,
max: 1000,
valueAsNumber: true,
required: t('outlink.QPM is empty') || ''
})}
/>
</Flex>
<Flex alignItems={'center'} mt={4}>
<Flex flex={'0 0 90px'} alignItems={'center'}>
{t('common.Max credit')}:
<MyTooltip label={t('common.Max credit tips' || '')}>
<QuestionOutlineIcon ml={1} />
</MyTooltip>
</Flex>
<Input
{...register('limit.credit', {
min: -1,
max: 1000,
valueAsNumber: true,
required: true
})}
/>
</Flex>
<Flex alignItems={'center'} mt={4}>
<Flex flex={'0 0 90px'} alignItems={'center'}>
{t('common.Expired Time')}:
</Flex>
<Input
type="datetime-local"
defaultValue={
defaultData.limit?.expiredTime
? dayjs(defaultData.limit?.expiredTime).format('YYYY-MM-DDTHH:mm')
: ''
}
onChange={(e) => {
setValue('limit.expiredTime', new Date(e.target.value));
}}
/>
</Flex>
</>
)}
<Flex alignItems={'center'} mt={4}>
<Flex flex={'0 0 90px'} alignItems={'center'}>
{t('outlink.Response Detail')}:

View File

@@ -238,7 +238,9 @@ const OutLink = ({ shareId, chatId }: { shareId: string; chatId: string }) => {
}));
}}
onStartChat={startChat}
onDelMessage={({ index }) => delShareChatHistoryItemById({ chatId, index })}
onDelMessage={({ contentId, index }) =>
delShareChatHistoryItemById({ chatId, contentId, index })
}
/>
</Box>
</Flex>

View File

@@ -16,11 +16,10 @@ export async function authOutLinkChat({ shareId, ip }: { shareId: string; ip?: s
const uid = String(outLink.userId);
// authBalance
const user = await authBalanceByUid(uid);
// limit auth
await authOutLinkLimit({ outLink, ip });
const [user] = await Promise.all([
authBalanceByUid(uid), // authBalance
...(global.feConfigs?.isPlus ? [authOutLinkLimit({ outLink, ip })] : []) // limit auth
]);
return {
user,

View File

@@ -16,7 +16,7 @@ type State = {
shareId: string;
}) => void;
delOneShareHistoryByChatId: (chatId: string) => void;
delShareChatHistoryItemById: (e: { chatId: string; index: number }) => void;
delShareChatHistoryItemById: (e: { chatId: string; contentId?: string; index: number }) => void;
delManyShareChatHistoryByShareId: (shareId?: string) => void;
};
@@ -100,14 +100,14 @@ export const useShareChatStore = create<State>()(
);
});
},
delShareChatHistoryItemById({ chatId, index }) {
delShareChatHistoryItemById({ chatId, contentId }) {
set((state) => {
// update history store
const newHistoryList = state.shareChatHistory.map((item) =>
item.chatId === chatId
? {
...item,
chats: [...item.chats.slice(0, index), ...item.chats.slice(index + 1)]
chats: item.chats.filter((item) => item.dataId !== contentId)
}
: item
);