diff --git a/document/content/docs/introduction/development/openapi/app.mdx b/document/content/docs/introduction/development/openapi/app.mdx new file mode 100644 index 000000000..47c21d857 --- /dev/null +++ b/document/content/docs/introduction/development/openapi/app.mdx @@ -0,0 +1,195 @@ +--- +title: 应用接口 +description: FastGPT OpenAPI 应用接口 +--- + +## 前置准备 + +1. 准备 API key: 可用直接使用全局 apikey +2. 准备应用的 AppId + +![alt text](/imgs/image-120.png) + + +## 日志接口 + +### 获取累积运行结果 + + + + + + ```bash + curl --location --request GET 'https://cloud.fastgpt.cn/api/proApi/core/app/logs/getTotalData?appId=68c46a70d950e8850ae564ba' \ +--header 'Authorization: Bearer apikey' + ``` + + + + + + ```bash + { + "code": 200, + "statusText": "", + "message": "", + "data": { + "totalUsers": 0, + "totalChats": 0, + "totalPoints": 0 + } + } + ``` + + + + + +
+ **入参:** + - appId: 应用Id + + **出参:** + - totalUsers: 累积使用用户数量 + - totalChats: 累积对话数量 + - totalPoints: 累积积分消耗 +
+ +
+ +
+ +### 获取应用日志看板 + + + + + + ```bash +curl --location --request POST 'https://cloud.fastgpt.cn/api/proApi/core/app/logs/getChartData' \ +--header 'Authorization: Bearer apikey' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "appId": "68c46a70d950e8850ae564ba", + "dateStart": "2025-09-19T16:00:00.000Z", + "dateEnd": "2025-09-27T15:59:59.999Z", + "offset": 1, + "source": [ + "test", + "online", + "share", + "api", + "cronJob", + "team", + "feishu", + "official_account", + "wecom", + "mcp" + ], + "userTimespan": "day", + "chatTimespan": "day", + "appTimespan": "day" +}' + ``` + + + + + +```bash +{ + "code": 200, + "statusText": "", + "message": "", + "data": { + "userData": [ + { + "timestamp": 1758585600000, + "summary": { + "userCount": 1, + "newUserCount": 0, + "retentionUserCount": 0, + "points": 1.1132600000000001, + "sourceCountMap": { + "test": 1, + "online": 0, + "share": 0, + "api": 0, + "cronJob": 0, + "team": 0, + "feishu": 0, + "official_account": 0, + "wecom": 0, + "mcp": 0 + } + } + } + ], + "chatData": [ + { + "timestamp": 1758585600000, + "summary": { + "chatItemCount": 1, + "chatCount": 1, + "errorCount": 0, + "points": 1.1132600000000001 + } + } + ], + "appData": [ + { + "timestamp": 1758585600000, + "summary": { + "goodFeedBackCount": 0, + "badFeedBackCount": 0, + "chatCount": 1, + "totalResponseTime": 22.31 + } + } + ] + } +} +``` + + + + + +**入参:** +- appId: 应用Id +- dateStart: 开始时间 +- dateEnd: 结束时间 +- source: 日志来源 +- offset: 用户留存偏移量 +- userTimespan: 用户数据时间跨度 //day|week|month|quarter +- chatTimespan: 对话数据时间跨度 //day|week|month|quarter +- appTimespan: 应用数据时间跨度 //day|week|month|quarter + +**出参:** + +- userData: 用户数据数组 + - timestamp: 时间戳 + - summary: 汇总数据对象 + - userCount: 活跃用户数量 + - newUserCount: 新用户数量 + - retentionUserCount: 留存用户数量 + - points: 总积分消耗 + - sourceCountMap: 各来源用户数量 +- chatData: 对话数据数组 + - timestamp: 时间戳 + - summary: 汇总数据对象 + - chatItemCount: 对话次数 + - chatCount - 会话次数 + - errorCount - 错误对话次数 + - points - 总积分消耗 +- appData: 应用数据数组 + - timestamp - 时间戳 + - summary - 汇总数据对象 + - goodFeedBackCount - 好评反馈数量 + - badFeedBackCount - 差评反馈数量 + - chatCount - 对话次数 + - totalResponseTime - 总响应时间 + + + + \ No newline at end of file diff --git a/document/content/docs/introduction/development/openapi/meta.json b/document/content/docs/introduction/development/openapi/meta.json index 795f43d68..123e6b08e 100644 --- a/document/content/docs/introduction/development/openapi/meta.json +++ b/document/content/docs/introduction/development/openapi/meta.json @@ -1,4 +1,4 @@ { "title": "OpenAPI接口文档", - "pages": ["intro","chat","dataset","share"] -} \ No newline at end of file + "pages": ["intro", "app", "chat", "dataset", "share"] +} diff --git a/document/content/docs/toc.mdx b/document/content/docs/toc.mdx index 21538ea8d..f8e2c465c 100644 --- a/document/content/docs/toc.mdx +++ b/document/content/docs/toc.mdx @@ -34,6 +34,7 @@ description: FastGPT 文档目录 - [/docs/introduction/development/modelConfig/one-api](/docs/introduction/development/modelConfig/one-api) - [/docs/introduction/development/modelConfig/ppio](/docs/introduction/development/modelConfig/ppio) - [/docs/introduction/development/modelConfig/siliconCloud](/docs/introduction/development/modelConfig/siliconCloud) +- [/docs/introduction/development/openapi/app](/docs/introduction/development/openapi/app) - [/docs/introduction/development/openapi/chat](/docs/introduction/development/openapi/chat) - [/docs/introduction/development/openapi/dataset](/docs/introduction/development/openapi/dataset) - [/docs/introduction/development/openapi/intro](/docs/introduction/development/openapi/intro) diff --git a/document/data/doc-last-modified.json b/document/data/doc-last-modified.json index 4f906560f..394f385d9 100644 --- a/document/data/doc-last-modified.json +++ b/document/data/doc-last-modified.json @@ -31,6 +31,7 @@ "document/content/docs/introduction/development/modelConfig/one-api.mdx": "2025-07-23T21:35:03+08:00", "document/content/docs/introduction/development/modelConfig/ppio.mdx": "2025-08-05T23:20:39+08:00", "document/content/docs/introduction/development/modelConfig/siliconCloud.mdx": "2025-08-05T23:20:39+08:00", + "document/content/docs/introduction/development/openapi/app.mdx": "2025-09-26T11:31:49+08:00", "document/content/docs/introduction/development/openapi/chat.mdx": "2025-08-14T18:54:47+08:00", "document/content/docs/introduction/development/openapi/dataset.mdx": "2025-09-15T20:02:54+08:00", "document/content/docs/introduction/development/openapi/intro.mdx": "2025-08-14T18:54:47+08:00", @@ -87,7 +88,7 @@ "document/content/docs/introduction/guide/plugins/doc2x_plugin_guide.mdx": "2025-07-23T21:35:03+08:00", "document/content/docs/introduction/guide/plugins/google_search_plugin_guide.mdx": "2025-07-23T21:35:03+08:00", "document/content/docs/introduction/guide/plugins/searxng_plugin_guide.mdx": "2025-07-23T21:35:03+08:00", - "document/content/docs/introduction/guide/plugins/upload_system_tool.mdx": "2025-09-20T19:49:21+08:00", + "document/content/docs/introduction/guide/plugins/upload_system_tool.mdx": "2025-09-24T22:40:31+08:00", "document/content/docs/introduction/guide/team_permissions/invitation_link.mdx": "2025-07-23T21:35:03+08:00", "document/content/docs/introduction/guide/team_permissions/team_roles_permissions.mdx": "2025-07-23T21:35:03+08:00", "document/content/docs/introduction/index.en.mdx": "2025-07-23T21:35:03+08:00", @@ -100,7 +101,7 @@ "document/content/docs/protocol/terms.en.mdx": "2025-08-03T22:37:45+08:00", "document/content/docs/protocol/terms.mdx": "2025-08-03T22:37:45+08:00", "document/content/docs/toc.en.mdx": "2025-08-04T13:42:36+08:00", - "document/content/docs/toc.mdx": "2025-09-23T14:19:37+08:00", + "document/content/docs/toc.mdx": "2025-09-26T11:31:49+08:00", "document/content/docs/upgrading/4-10/4100.mdx": "2025-08-02T19:38:37+08:00", "document/content/docs/upgrading/4-10/4101.mdx": "2025-09-08T20:07:20+08:00", "document/content/docs/upgrading/4-11/4110.mdx": "2025-08-05T23:20:39+08:00", @@ -110,7 +111,7 @@ "document/content/docs/upgrading/4-12/4122.mdx": "2025-09-07T14:41:48+08:00", "document/content/docs/upgrading/4-12/4123.mdx": "2025-09-07T20:55:14+08:00", "document/content/docs/upgrading/4-12/4124.mdx": "2025-09-17T22:29:56+08:00", - "document/content/docs/upgrading/4-13/4130.mdx": "2025-09-24T21:54:28+08:00", + "document/content/docs/upgrading/4-13/4130.mdx": "2025-09-24T22:40:31+08:00", "document/content/docs/upgrading/4-8/40.mdx": "2025-08-02T19:38:37+08:00", "document/content/docs/upgrading/4-8/41.mdx": "2025-08-02T19:38:37+08:00", "document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00", diff --git a/document/public/imgs/image-120.png b/document/public/imgs/image-120.png new file mode 100644 index 000000000..1c318c153 Binary files /dev/null and b/document/public/imgs/image-120.png differ diff --git a/projects/app/src/pages/api/admin/initv4124.ts b/projects/app/src/pages/api/admin/initv4124.ts index f96e36305..b9f3b931b 100644 --- a/projects/app/src/pages/api/admin/initv4124.ts +++ b/projects/app/src/pages/api/admin/initv4124.ts @@ -17,7 +17,7 @@ export type SyncAppChatLogBody = { export type SyncAppChatLogResponse = {}; /** - * 初始化脚本 v4.13.0 + * 初始化脚本 v4.12.4 * 对系统内所有资源 App 和 dataset 添加 tmbId 为自己 owner 的协作者,权限为 OwnerRoleVal */ async function handler(