Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
f71ce25c
authored
Jul 17, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flow chat
parent
ecce182a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
92 additions
and
49 deletions
+92
-49
client/public/docs/chatProblem.md
+2
-3
client/public/docs/versionIntro.md
+7
-1
client/src/components/ChatBox/index.tsx
+30
-0
client/src/pages/app/detail/components/Settings.tsx
+1
-1
client/src/pages/app/detail/components/edit/components/NodeChat.tsx
+50
-38
client/src/pages/chat/index.tsx
+1
-0
client/src/pages/index.tsx
+0
-5
client/src/pages/number/components/PayModal.tsx
+1
-1
No files found.
client/public/docs/chatProblem.md
View file @
f71ce25c
### 常见问题
**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.00
1
|
| 知识库 - 索引 | 0.00
2
|
| FastAI4k - 对话 | 0.015 |
| FastAI16k - 对话 | 0.03 |
| FastAI-Plus - 对话 | 0.45 |
...
...
client/public/docs/versionIntro.md
View file @
f71ce25c
### Fast GPT V
3.9
### Fast GPT V
4.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)
client/src/components/ChatBox/index.tsx
View file @
f71ce25c
...
...
@@ -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 */
}
...
...
client/src/pages/app/detail/components/Settings.tsx
View file @
f71ce25c
...
...
@@ -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
})
=>
{
...
...
client/src/pages/app/detail/components/edit/components/NodeChat.tsx
View file @
f71ce25c
...
...
@@ -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
);
...
...
client/src/pages/chat/index.tsx
View file @
f71ce25c
...
...
@@ -296,6 +296,7 @@ const Chat = () => {
<
Box
flex=
{
1
}
>
<
ChatBox
ref=
{
ChatBoxRef
}
showEmptyIntro
historyId=
{
historyId
}
appAvatar=
{
chatData
.
app
.
avatar
}
variableModules=
{
chatData
.
app
.
variableModules
}
...
...
client/src/pages/index.tsx
View file @
f71ce25c
...
...
@@ -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"
>
...
...
client/src/pages/number/components/PayModal.tsx
View file @
f71ce25c
...
...
@@ -113,7 +113,7 @@ const PayModal = ({ onClose }: { onClose: () => void }) => {
source=
{
`
| 计费项 | 价格: 元/ 1K tokens(包含上下文)|
| --- | --- |
| 知识库 - 索引 | 0.00
1
|
| 知识库 - 索引 | 0.00
2
|
| FastAI4k - 对话 | 0.015 |
| FastAI16k - 对话 | 0.03 |
| FastAI-Plus - 对话 | 0.45 |
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment