flow chat

This commit is contained in:
archer
2023-07-17 22:31:01 +08:00
parent ecce182a20
commit f71ce25c46
8 changed files with 92 additions and 49 deletions

View File

@@ -1,12 +1,11 @@
### 常见问题
**Git 地址**: [项目地址,完全开源,随便用](https://github.com/labring/FastGPT)
**Git 地址**: [项目地址。V4-beta 暂为开源,在正式版发布后会开源](https://github.com/c121914yu/FastGPT)
**问题文档**: [先看文档,再提问](https://kjqvjse66l.feishu.cn/docx/HtrgdT0pkonP4kxGx8qcu6XDnGh)
**价格表**
如果使用了自己的 Api Key网页上 openai 模型聊天不会计费。可以在账号页,看到详细账单。
| 计费项 | 价格: 元/ 1K tokens包含上下文|
| --- | --- |
| 知识库 - 索引 | 0.001 |
| 知识库 - 索引 | 0.002 |
| FastAI4k - 对话 | 0.015 |
| FastAI16k - 对话 | 0.03 |
| FastAI-Plus - 对话 | 0.45 |

View File

@@ -1,6 +1,12 @@
### Fast GPT V3.9
### Fast GPT V4.0-beta
<<<<<<< HEAD
1. 新增 - 直接分段训练可调节段落大小
2. 优化 - tokens 计算性能
3. 优化 - key 池管理结合 one-api 项目实现更方便的 key 池管理具体参考[docker 部署 FastGpt](https://github.com/labring/FastGPT/blob/main/docs/deploy/docker.md)
4. 新增 - V2 OpenAPI可以在任意第三方套壳 ChatGpt 项目中直接使用 FastGpt 的应用注意是直接不需要改任何代码具体参考[API 文档中《在第三方应用中使用 FastGpt》](https://kjqvjse66l.feishu.cn/docx/DmLedTWtUoNGX8xui9ocdUEjnNh)
=======
1. 全新交互采用模块组合的方式构建知识库
2. 问题分类 - 可以对用户的问题进行分类再执行不同的操作
3. beta 版本尚未稳定请以测试为主详细使用文档后续会补上
>>>>>>> 5f8a88d (flow chat)

View File

@@ -21,6 +21,7 @@ import MyIcon from '@/components/Icon';
import Avatar from '@/components/Avatar';
import { adaptChatItem_openAI } from '@/utils/plugin/openai';
import { useMarkdown } from '@/hooks/useMarkdown';
import { VariableItemType } from '@/types/app';
import { VariableInputEnum } from '@/constants/app';
import { useForm } from 'react-hook-form';
@@ -68,8 +69,34 @@ const VariableLabel = ({
</Box>
);
const Empty = () => {
const { data: chatProblem } = useMarkdown({ url: '/chatProblem.md' });
const { data: versionIntro } = useMarkdown({ url: '/versionIntro.md' });
return (
<Box
minH={'100%'}
w={'85%'}
maxW={'600px'}
m={'auto'}
py={'5vh'}
alignItems={'center'}
justifyContent={'center'}
>
{/* version intro */}
<Card p={4} mb={10}>
<Markdown source={versionIntro} />
</Card>
<Card p={4}>
<Markdown source={chatProblem} />
</Card>
</Box>
);
};
const ChatBox = (
{
showEmptyIntro = false,
historyId,
appAvatar,
variableModules,
@@ -78,6 +105,7 @@ const ChatBox = (
onStartChat,
onDelMessage
}: {
showEmptyIntro?: boolean;
historyId?: string;
appAvatar: string;
variableModules?: VariableItemType[];
@@ -568,6 +596,8 @@ const ChatBox = (
</Flex>
))}
</Box>
{showEmptyIntro && chatHistory.length === 0 && !hasVariableInput && <Empty />}
</Box>
</Box>
{/* input */}

View File

@@ -15,7 +15,7 @@ import MyIcon from '@/components/Icon';
import TotalUsage from './Charts/TotalUsage';
const InfoModal = dynamic(() => import('./InfoModal'));
const AppEdit = dynamic(() => import('./edit'), { ssr: true });
import AppEdit from './edit';
import styles from '../../list/index.module.scss';
const Settings = ({ appId }: { appId: string }) => {

View File

@@ -11,6 +11,7 @@ import MySelect from '@/components/Select';
import { chatModelList } from '@/store/static';
import MySlider from '@/components/Slider';
import { Box } from '@chakra-ui/react';
import { formatPrice } from '@/utils/user';
const NodeChat = ({
data: { moduleId, inputs, outputs, onChangeNode, ...props }
@@ -29,45 +30,56 @@ const NodeChat = ({
onChangeNode={onChangeNode}
flowInputList={inputs}
CustomComponent={{
model: (inputItem) => (
<MySelect
width={'100%'}
value={inputItem.value}
list={inputItem.list || []}
onchange={(e) => {
onChangeNode({
moduleId,
key: inputItem.key,
value: e
});
// update max tokens
const model = chatModelList.find((item) => item.model === e);
if (!model) return;
model: (inputItem) => {
const list = chatModelList.map((item) => {
const priceStr = `(${formatPrice(item.price, 1000)}元/1k Tokens)`;
onChangeNode({
moduleId,
key: 'maxToken',
valueKey: 'markList',
value: [
{ label: '100', value: 100 },
{ label: `${model.contextMaxToken}`, value: model.contextMaxToken }
]
});
onChangeNode({
moduleId,
key: 'maxToken',
valueKey: 'max',
value: model.contextMaxToken
});
onChangeNode({
moduleId,
key: 'maxToken',
valueKey: 'value',
value: model.contextMaxToken / 2
});
}}
/>
),
return {
value: item.model,
label: `${item.name}${priceStr}`
};
});
return (
<MySelect
width={'100%'}
value={inputItem.value}
list={list}
onchange={(e) => {
onChangeNode({
moduleId,
key: inputItem.key,
value: e
});
// update max tokens
const model = chatModelList.find((item) => item.model === e);
if (!model) return;
onChangeNode({
moduleId,
key: 'maxToken',
valueKey: 'markList',
value: [
{ label: '100', value: 100 },
{ label: `${model.contextMaxToken}`, value: model.contextMaxToken }
]
});
onChangeNode({
moduleId,
key: 'maxToken',
valueKey: 'max',
value: model.contextMaxToken
});
onChangeNode({
moduleId,
key: 'maxToken',
valueKey: 'value',
value: model.contextMaxToken / 2
});
}}
/>
);
},
maxToken: (inputItem) => {
const model = inputs.find((item) => item.key === 'model')?.value;
const modelData = chatModelList.find((item) => item.model === model);

View File

@@ -296,6 +296,7 @@ const Chat = () => {
<Box flex={1}>
<ChatBox
ref={ChatBoxRef}
showEmptyIntro
historyId={historyId}
appAvatar={chatData.app.avatar}
variableModules={chatData.app.variableModules}

View File

@@ -13,7 +13,6 @@ import MyIcon from '@/components/Icon';
const Home = () => {
const router = useRouter();
const { inviterId } = router.query as { inviterId: string };
const { data } = useMarkdown({ url: '/intro.md' });
const { isPc } = useGlobalStore();
const [star, setStar] = useState(1500);
@@ -211,10 +210,6 @@ const Home = () => {
</Flex>
<Box w={'100%'} mt={'100vh'} px={[5, 10]} pb={[5, 10]}>
<Card p={5} lineHeight={2}>
<Markdown source={data} isChatting={false} />
</Card>
<Card p={5} mt={4} textAlign={'center'}>
{beianText && (
<Link href="https://beian.miit.gov.cn/" target="_blank">

View File

@@ -113,7 +113,7 @@ const PayModal = ({ onClose }: { onClose: () => void }) => {
source={`
| 计费项 | 价格: 元/ 1K tokens(包含上下文)|
| --- | --- |
| 知识库 - 索引 | 0.001 |
| 知识库 - 索引 | 0.002 |
| FastAI4k - 对话 | 0.015 |
| FastAI16k - 对话 | 0.03 |
| FastAI-Plus - 对话 | 0.45 |