mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-19 10:07:24 +00:00
New document (#5299)
* add new doc (#5175) Co-authored-by: dreamer6680 <146868355@qq.com> * Test docs (#5235) * fix: change the page of doc * chore: add new dependencies, update global styles/layout, optimize docs, add Feishu & GitHub icons, update API examples * fix: docs/index 404 not found * Update environment variable names, optimize styles, add new API routes, fix component styles, adjust documentation, and update GitHub and Feishu icons * update readme * feat: add a linkfastgpt compontent * feat: update new doc * fix:remove unuse page and redirect homepage to docs (#5288) * fix:remove some unuse doc * fix: redirect homepage to doc * git ignore * fix:navbar to index (#5295) * sidbar * fix: navtab unlight (#5298) * doc --------- Co-authored-by: dreamer6680 <1468683855@qq.com> Co-authored-by: dreamer6680 <146868355@qq.com>
This commit is contained in:
12
document/content/docs/api/api1.mdx
Normal file
12
document/content/docs/api/api1.mdx
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Tabs
|
||||
description:
|
||||
A Tabs component built with Radix UI, with additional features such as
|
||||
persistent and shared value.
|
||||
---
|
||||
|
||||
<Tabs items={['Javascript', 'Rust']}>
|
||||
<Tab value="Javascript">Javascript is weird</Tab>
|
||||
<Tab value="Rust">Rust is fast</Tab>
|
||||
</Tabs>
|
||||
|
101
document/content/docs/api/api2.mdx
Normal file
101
document/content/docs/api/api2.mdx
Normal file
@@ -0,0 +1,101 @@
|
||||
---
|
||||
title: 对话接口
|
||||
description: FastGPT OpenAPI 对话接口
|
||||
---
|
||||
|
||||
import { Alert } from '@/components/docs/Alert';
|
||||
|
||||
# 如何获取 AppId
|
||||
|
||||
可在应用详情的路径里获取 AppId。
|
||||
|
||||

|
||||
|
||||
# 发起对话
|
||||
|
||||
<Alert icon="🤖" context="success">
|
||||
* 该接口的 API Key 需使用`应用特定的 key`,否则会报错。
|
||||
|
||||
{/* * 对话现在有`v1`和`v2`两个接口,可以按需使用,v2 自 4.9.4 版本新增,v1 接口同时不再维护 */}
|
||||
|
||||
* 有些包调用时,`BaseUrl`需要添加`v1`路径,有些不需要,如果出现404情况,可补充`v1`重试。
|
||||
</Alert>
|
||||
|
||||
## 请求简易应用和工作流
|
||||
|
||||
`v1`对话接口兼容`GPT`的接口!如果你的项目使用的是标准的`GPT`官方接口,可以直接通过修改`BaseUrl`和 `Authorization`来访问 FastGpt 应用,不过需要注意下面几个规则:
|
||||
|
||||
<Alert icon="🤖" context="success">
|
||||
* 传入的`model`,`temperature`等参数字段均无效,这些字段由编排决定,不会根据 API 参数改变。
|
||||
* 不会返回实际消耗`Token`值,如果需要,可以设置`detail=true`,并手动计算 `responseData` 里的`tokens`值。
|
||||
</Alert>
|
||||
|
||||
### 请求
|
||||
|
||||
<Tabs items={['基础请求示例','参数说明','12312','1231221']}>
|
||||
<Tab>
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
|
||||
--header 'Authorization: Bearer fastgpt-xxxxxx' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"chatId": "my_chatId",
|
||||
"stream": false,
|
||||
"detail": false,
|
||||
"responseChatItemId": "my_responseChatItemId",
|
||||
"variables": {
|
||||
"uid": "asdfadsfasfd2323",
|
||||
"name": "张三"
|
||||
},
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "导演是谁"
|
||||
}
|
||||
]
|
||||
}'
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab>
|
||||
|
||||
* 仅`messages`有部分区别,其他参数一致。
|
||||
* 目前不支持上传文件,需上传到自己的对象存储中,获取对应的文件链接。
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
|
||||
--header 'Authorization: Bearer fastgpt-xxxxxx' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"chatId": "abcd",
|
||||
"stream": false,
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "导演是谁"
|
||||
},
|
||||
{
|
||||
"type": "image_url",
|
||||
"image_url": {
|
||||
"url": "图片链接"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "file_url",
|
||||
"name": "文件名",
|
||||
"url": "文档链接,支持 txt md html word pdf ppt csv excel"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}'
|
||||
```
|
||||
|
||||
</Tab>
|
||||
|
||||
|
||||
</Tabs>
|
8
document/content/docs/api/index.mdx
Normal file
8
document/content/docs/api/index.mdx
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
title: API手册
|
||||
description: FastGPT API手册
|
||||
---
|
||||
|
||||
import { Redirect } from '@/components/docs/Redirect';
|
||||
|
||||
<Redirect to="/docs/api/api1" />
|
7
document/content/docs/api/meta.json
Normal file
7
document/content/docs/api/meta.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"title": "API手册",
|
||||
"description": "FastGPT API手册",
|
||||
"root": true,
|
||||
"pages": ["api1", "api2", "test"],
|
||||
"order": 4
|
||||
}
|
12
document/content/docs/api/test/api3.mdx
Normal file
12
document/content/docs/api/test/api3.mdx
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Tabs
|
||||
description:
|
||||
A Tabs component built with Radix UI, with additional features such as
|
||||
persistent and shared value.
|
||||
---
|
||||
|
||||
<Tabs items={['Javascript', 'Rust']}>
|
||||
<Tab value="Javascript">Javascript is weird</Tab>
|
||||
<Tab value="Rust">Rust is fast</Tab>
|
||||
</Tabs>
|
||||
|
Reference in New Issue
Block a user