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
d8d9b936
authored
Nov 18, 2024
by
Archer
Committed by
GitHub
Nov 18, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: custom uid (#3177)
* chat api doc * fix: custom uid
parent
b237a3ec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
docSite/content/zh-cn/docs/development/openapi/chat.md
+3
-1
projects/app/src/pages/chat/share.tsx
+1
-1
No files found.
docSite/content/zh-cn/docs/development/openapi/chat.md
View file @
d8d9b936
...
...
@@ -35,9 +35,10 @@ curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
--header
'Authorization: Bearer fastgpt-xxxxxx'
\
--header
'Content-Type: application/json'
\
--data-raw
'{
"chatId": "
abc
d",
"chatId": "
my_chatI
d",
"stream": false,
"detail": false,
"responseChatItemId": "my_responseChatItemId",
"variables": {
"uid": "asdfadsfasfd2323",
"name": "张三"
...
...
@@ -104,6 +105,7 @@ curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
-
为
`undefined`
时(不传入),不使用 FastGpt 提供的上下文功能,完全通过传入的 messages 构建上下文。 不会将你的记录存储到数据库中,你也无法在记录汇总中查阅到。
-
为
`非空字符串`
时,意味着使用 chatId 进行对话,自动从 FastGpt 数据库取历史记录,并使用 messages 数组最后一个内容作为用户问题。请自行确保 chatId 唯一,长度小于250,通常可以是自己系统的对话框ID。
-
messages: 结构与
[
GPT接口
](
https://platform.openai.com/docs/api-reference/chat/object
)
chat模式一致。
-
responseChatItemId: string | undefined 。如果传入,则会将该值作为本次对话的响应消息的 ID,FastGPT 会自动将该 ID 存入数据库。请确保,在当前
`chatId`
下,
`responseChatItemId`
是唯一的。
-
detail: 是否返回中间值(模块状态,响应的完整结果等),
`stream模式`
下会通过
`event`
进行区分,
`非stream模式`
结果保存在
`responseData`
中。
-
variables: 模块变量,一个对象,会替换模块中,输入框内容里的
`{{key}}`
{{% /alert %}}
...
...
projects/app/src/pages/chat/share.tsx
View file @
d8d9b936
...
...
@@ -385,7 +385,7 @@ const Render = (props: Props) => {
const
[
isLoaded
,
setIsLoaded
]
=
useState
(
false
);
const
contextParams
=
useMemo
(()
=>
{
return
{
shareId
,
outLinkUid
:
authToken
||
localUId
||
customUi
d
};
return
{
shareId
,
outLinkUid
:
authToken
||
customUid
||
localUI
d
};
},
[
authToken
,
customUid
,
localUId
,
shareId
]);
useMount
(()
=>
{
...
...
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