Skip to content

Commit b22ba1a

Browse files
FinleyGec121914yu
andauthored
chore: customDomain openapi doc && new nextapi code snippets (#6082)
* perf: faq * index * delete dataset * delete dataset * perf: delete dataset * init * fix: faq * refresh * empty tip * chore: customDomain openapi doc && new nextapi code snippets * chore: update doc * remove ivalid code * snippets --------- Co-authored-by: archer <[email protected]>
1 parent 805cd33 commit b22ba1a

File tree

8 files changed

+291
-32
lines changed

8 files changed

+291
-32
lines changed

.vscode/nextapi.code-snippets

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
{
2-
// Place your FastGPT 工作区 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
3-
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
4-
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
5-
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
6-
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
2+
// Place your FastGPT 工作区 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
3+
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
4+
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
5+
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
6+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
77
// Placeholders with the same ids are connected.
88
// Example:
99
"Next api template": {
1010
"scope": "javascript,typescript",
1111
"prefix": "nextapi",
1212
"body": [
13-
"import type { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/next';",
14-
"import { NextAPI } from '@/service/middleware/entry';",
15-
"",
16-
"export type ${TM_FILENAME_BASE}Query = {};",
17-
"",
18-
"export type ${TM_FILENAME_BASE}Body = {};",
19-
"",
20-
"export type ${TM_FILENAME_BASE}Response = {};",
21-
"",
22-
"async function handler(",
23-
" req: ApiRequestProps<${TM_FILENAME_BASE}Body, ${TM_FILENAME_BASE}Query>,",
24-
" res: ApiResponseType<any>",
25-
"): Promise<${TM_FILENAME_BASE}Response> {",
26-
" $1",
27-
" return {}",
28-
"}",
29-
"",
30-
"export default NextAPI(handler);"
13+
"import { NextAPI } from '@/service/middleware/entry';",
14+
"import type { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/next';",
15+
"",
16+
"async function handler(",
17+
" req: ApiRequestProps,",
18+
" res: ApiResponseType<${1}ResponseType>",
19+
"): Promise<${1}ResponseType> {",
20+
" const body = ${1}BodySchema.parse(req.body);",
21+
" const query = ${1}QuerySchema.parse(req.query);",
22+
"",
23+
" ${2}",
24+
"",
25+
" return {};",
26+
"}",
27+
"",
28+
"export default NextAPI(handler);"
3129
],
32-
"description": "FastGPT Next API template"
30+
"description": "FastGPT Next API template with Zod validation"
3331
},
3432
"use context template": {
3533
"scope": "typescriptreact",
@@ -38,7 +36,7 @@
3836
"import React, { ReactNode } from 'react';",
3937
"import { createContext } from 'use-context-selector';",
4038
"",
41-
"type ContextType = {$1};",
39+
"type ContextType = {${1}};",
4240
"",
4341
"export const Context = createContext<ContextType>({});",
4442
"",
@@ -65,4 +63,4 @@
6563
"});"
6664
]
6765
}
68-
}
66+
}

document/content/docs/upgrading/4-14/4144.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,7 @@ curl --location --request POST 'https://{{host}}/api/admin/initv4144' \
6868

6969
1. 新增 GLM4.6 与 DS3.2 系列模型预设。
7070
2. 修复 MinerU SaaS 插件模型版本不能选择 vlm 的问题
71+
3. 修复微信公众号插件批量上传 markdown 参数传递问题
72+
4. 新增获取微信公众号草稿箱列表工具
73+
5. markdown 转文件支持自定义文件名
74+
6. 修复 import cache 导致的插件无法被更新的问题

document/data/doc-last-modified.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"document/content/docs/faq/app.mdx": "2025-08-02T19:38:37+08:00",
33
"document/content/docs/faq/chat.mdx": "2025-08-02T19:38:37+08:00",
44
"document/content/docs/faq/dataset.mdx": "2025-08-02T19:38:37+08:00",
5-
"document/content/docs/faq/error.mdx": "2025-12-10T13:24:24+08:00",
5+
"document/content/docs/faq/error.mdx": "2025-12-10T20:07:05+08:00",
66
"document/content/docs/faq/external_channel_integration.mdx": "2025-08-02T19:38:37+08:00",
77
"document/content/docs/faq/index.mdx": "2025-08-02T19:38:37+08:00",
88
"document/content/docs/faq/other.mdx": "2025-08-04T22:07:52+08:00",
@@ -89,7 +89,7 @@
8989
"document/content/docs/introduction/guide/plugins/google_search_plugin_guide.mdx": "2025-07-23T21:35:03+08:00",
9090
"document/content/docs/introduction/guide/plugins/searxng_plugin_guide.mdx": "2025-07-23T21:35:03+08:00",
9191
"document/content/docs/introduction/guide/plugins/upload_system_tool.mdx": "2025-11-04T16:58:12+08:00",
92-
"document/content/docs/introduction/guide/team_permissions/customDomain.mdx": "2025-12-10T13:24:24+08:00",
92+
"document/content/docs/introduction/guide/team_permissions/customDomain.mdx": "2025-12-10T20:07:05+08:00",
9393
"document/content/docs/introduction/guide/team_permissions/invitation_link.mdx": "2025-07-23T21:35:03+08:00",
9494
"document/content/docs/introduction/guide/team_permissions/team_roles_permissions.mdx": "2025-07-23T21:35:03+08:00",
9595
"document/content/docs/introduction/index.en.mdx": "2025-07-23T21:35:03+08:00",
@@ -119,7 +119,7 @@
119119
"document/content/docs/upgrading/4-14/4141.mdx": "2025-11-19T10:15:27+08:00",
120120
"document/content/docs/upgrading/4-14/4142.mdx": "2025-11-18T19:27:14+08:00",
121121
"document/content/docs/upgrading/4-14/4143.mdx": "2025-11-26T20:52:05+08:00",
122-
"document/content/docs/upgrading/4-14/4144.mdx": "2025-12-10T13:28:04+08:00",
122+
"document/content/docs/upgrading/4-14/4144.mdx": "2025-12-10T20:07:05+08:00",
123123
"document/content/docs/upgrading/4-8/40.mdx": "2025-08-02T19:38:37+08:00",
124124
"document/content/docs/upgrading/4-8/41.mdx": "2025-08-02T19:38:37+08:00",
125125
"document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00",
@@ -191,14 +191,14 @@
191191
"document/content/docs/use-cases/app-cases/feishu_webhook.mdx": "2025-07-23T21:35:03+08:00",
192192
"document/content/docs/use-cases/app-cases/fixingEvidence.mdx": "2025-07-23T21:35:03+08:00",
193193
"document/content/docs/use-cases/app-cases/google_search.mdx": "2025-07-23T21:35:03+08:00",
194-
"document/content/docs/use-cases/app-cases/lab_appointment.mdx": "2025-12-10T13:24:24+08:00",
194+
"document/content/docs/use-cases/app-cases/lab_appointment.mdx": "2025-12-10T20:07:05+08:00",
195195
"document/content/docs/use-cases/app-cases/multi_turn_translation_bot.mdx": "2025-07-23T21:35:03+08:00",
196196
"document/content/docs/use-cases/app-cases/submit_application_template.mdx": "2025-08-05T23:20:39+08:00",
197197
"document/content/docs/use-cases/app-cases/translate-subtitle-using-gpt.mdx": "2025-07-23T21:35:03+08:00",
198198
"document/content/docs/use-cases/external-integration/dingtalk.mdx": "2025-07-23T21:35:03+08:00",
199199
"document/content/docs/use-cases/external-integration/feishu.mdx": "2025-07-24T14:23:04+08:00",
200200
"document/content/docs/use-cases/external-integration/official_account.mdx": "2025-08-05T23:20:39+08:00",
201201
"document/content/docs/use-cases/external-integration/openapi.mdx": "2025-09-29T11:34:11+08:00",
202-
"document/content/docs/use-cases/external-integration/wecom.mdx": "2025-12-10T13:24:24+08:00",
202+
"document/content/docs/use-cases/external-integration/wecom.mdx": "2025-12-10T20:07:05+08:00",
203203
"document/content/docs/use-cases/index.mdx": "2025-07-24T14:23:04+08:00"
204204
}

packages/global/openapi/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ApiKeyPath } from './support/openapi';
44
import { TagsMap } from './tag';
55
import { PluginPath } from './core/plugin';
66
import { WalletPath } from './support/wallet';
7+
import { CustomDomainPath } from './support/customDomain';
78

89
export const openAPIDocument = createDocument({
910
openapi: '3.1.0',
@@ -16,7 +17,8 @@ export const openAPIDocument = createDocument({
1617
...ChatPath,
1718
...ApiKeyPath,
1819
...PluginPath,
19-
...WalletPath
20+
...WalletPath,
21+
...CustomDomainPath
2022
},
2123
servers: [{ url: '/api' }],
2224
'x-tagGroups': [
@@ -39,6 +41,10 @@ export const openAPIDocument = createDocument({
3941
{
4042
name: '支付',
4143
tags: [TagsMap.walletBill, TagsMap.walletDiscountCoupon]
44+
},
45+
{
46+
name: '自定义域名',
47+
tags: [TagsMap.customDomain]
4248
}
4349
]
4450
});
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { z } from 'zod';
2+
import { CustomDomainType, ProviderEnum } from '../../../support/customDomain/type';
3+
4+
// Create custom domain
5+
export const CreateCustomDomainBodySchema = z.object({
6+
domain: z.string().meta({ example: 'chat.example.com', description: '自定义域名' }),
7+
provider: ProviderEnum.meta({
8+
example: 'aliyun',
9+
description: 'DNS 提供商:aliyun, tencent, volcengine'
10+
}),
11+
cnameDomain: z.string().meta({ example: 'lb.example.com', description: 'CNAME 目标域名' })
12+
});
13+
export type CreateCustomDomainBodyType = z.infer<typeof CreateCustomDomainBodySchema>;
14+
15+
export const CreateCustomDomainResponseSchema = z.object({
16+
success: z.boolean().meta({ example: true, description: '创建是否成功' })
17+
});
18+
export type CreateCustomDomainResponseType = z.infer<typeof CreateCustomDomainResponseSchema>;
19+
20+
// List custom domains
21+
export const CustomDomainListResponseSchema = z.array(
22+
CustomDomainType.extend({
23+
_id: z
24+
.string()
25+
.optional()
26+
.meta({ example: '68ad85a7463006c963799a05', description: '域名记录 ID' })
27+
})
28+
);
29+
export type CustomDomainListResponseType = z.infer<typeof CustomDomainListResponseSchema>;
30+
31+
// Delete custom domain
32+
export const DeleteCustomDomainQuerySchema = z.object({
33+
domain: z.string().meta({ example: 'chat.example.com', description: '要删除的域名' })
34+
});
35+
export type DeleteCustomDomainQueryType = z.infer<typeof DeleteCustomDomainQuerySchema>;
36+
37+
export const DeleteCustomDomainResponseSchema = z.object({
38+
success: z.boolean().meta({ example: true, description: '删除是否成功' })
39+
});
40+
export type DeleteCustomDomainResponseType = z.infer<typeof DeleteCustomDomainResponseSchema>;
41+
42+
// Check DNS resolve
43+
export const CheckDNSResolveBodySchema = z.object({
44+
domain: z.string().meta({ example: 'chat.example.com', description: '要检查的域名' }),
45+
cnameDomain: z.string().meta({ example: 'lb.example.com', description: 'CNAME 目标域名' })
46+
});
47+
export type CheckDNSResolveBodyType = z.infer<typeof CheckDNSResolveBodySchema>;
48+
49+
export const CheckDNSResolveResponseSchema = z.object({
50+
success: z.boolean().meta({ example: true, description: 'DNS 解析是否成功' }),
51+
message: z
52+
.string()
53+
.optional()
54+
.meta({ example: 'CNAME record not resolved', description: '错误信息' })
55+
});
56+
export type CheckDNSResolveResponseType = z.infer<typeof CheckDNSResolveResponseSchema>;
57+
58+
// Active custom domain
59+
export const ActiveCustomDomainBodySchema = z.object({
60+
domain: z.string().meta({ example: 'chat.example.com', description: '要激活的域名' })
61+
});
62+
export type ActiveCustomDomainBodyType = z.infer<typeof ActiveCustomDomainBodySchema>;
63+
64+
export const ActiveCustomDomainResponseSchema = z.object({
65+
success: z.boolean().meta({ example: true, description: '激活是否成功' })
66+
});
67+
export type ActiveCustomDomainResponseType = z.infer<typeof ActiveCustomDomainResponseSchema>;
68+
69+
// Update domain verify file
70+
export const UpdateDomainVerifyFileBodySchema = z.object({
71+
domain: z.string().meta({ example: 'chat.example.com', description: '域名' }),
72+
path: z
73+
.string()
74+
.meta({ example: '/.well-known/pki-validation/fileauth.txt', description: '验证文件路径' }),
75+
content: z.string().meta({ example: '202312121234567890abcdef', description: '验证文件内容' })
76+
});
77+
export type UpdateDomainVerifyFileBodyType = z.infer<typeof UpdateDomainVerifyFileBodySchema>;
78+
79+
export const UpdateDomainVerifyFileResponseSchema = z.object({
80+
success: z.boolean().meta({ example: true, description: '更新是否成功' })
81+
});
82+
export type UpdateDomainVerifyFileResponseType = z.infer<
83+
typeof UpdateDomainVerifyFileResponseSchema
84+
>;
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
import type { OpenAPIPath } from '../../type';
2+
import {
3+
CreateCustomDomainBodySchema,
4+
CreateCustomDomainResponseSchema,
5+
CustomDomainListResponseSchema,
6+
DeleteCustomDomainQuerySchema,
7+
DeleteCustomDomainResponseSchema,
8+
CheckDNSResolveBodySchema,
9+
CheckDNSResolveResponseSchema,
10+
ActiveCustomDomainBodySchema,
11+
ActiveCustomDomainResponseSchema,
12+
UpdateDomainVerifyFileBodySchema,
13+
UpdateDomainVerifyFileResponseSchema
14+
} from './api';
15+
import { TagsMap } from '../../tag';
16+
17+
export const CustomDomainPath: OpenAPIPath = {
18+
'/proApi/support/customDomain/create': {
19+
post: {
20+
summary: '创建自定义域名',
21+
description:
22+
'创建一个新的自定义域名配置,需要高级套餐权限。创建后域名会自动部署到 K8s 集群中',
23+
tags: [TagsMap.customDomain],
24+
requestBody: {
25+
content: {
26+
'application/json': {
27+
schema: CreateCustomDomainBodySchema
28+
}
29+
}
30+
},
31+
responses: {
32+
200: {
33+
description: '成功创建自定义域名',
34+
content: {
35+
'application/json': {
36+
schema: CreateCustomDomainResponseSchema
37+
}
38+
}
39+
}
40+
}
41+
}
42+
},
43+
'/proApi/support/customDomain/list': {
44+
get: {
45+
summary: '获取自定义域名列表',
46+
description: '获取当前团队的所有自定义域名配置列表',
47+
tags: [TagsMap.customDomain],
48+
responses: {
49+
200: {
50+
description: '成功获取自定义域名列表',
51+
content: {
52+
'application/json': {
53+
schema: CustomDomainListResponseSchema
54+
}
55+
}
56+
}
57+
}
58+
}
59+
},
60+
'/proApi/support/customDomain/delete': {
61+
delete: {
62+
summary: '删除自定义域名',
63+
description: '删除指定的自定义域名配置,同时会从 K8s 集群中移除相关资源',
64+
tags: [TagsMap.customDomain],
65+
requestParams: {
66+
query: DeleteCustomDomainQuerySchema
67+
},
68+
responses: {
69+
200: {
70+
description: '成功删除自定义域名',
71+
content: {
72+
'application/json': {
73+
schema: DeleteCustomDomainResponseSchema
74+
}
75+
}
76+
}
77+
}
78+
}
79+
},
80+
'/proApi/support/customDomain/checkDNSResolve': {
81+
post: {
82+
summary: '检查 DNS 解析',
83+
description: '检查自定义域名的 CNAME 记录是否正确配置和解析',
84+
tags: [TagsMap.customDomain],
85+
requestBody: {
86+
content: {
87+
'application/json': {
88+
schema: CheckDNSResolveBodySchema
89+
}
90+
}
91+
},
92+
responses: {
93+
200: {
94+
description: 'DNS 解析检查结果',
95+
content: {
96+
'application/json': {
97+
schema: CheckDNSResolveResponseSchema
98+
}
99+
}
100+
}
101+
}
102+
}
103+
},
104+
'/proApi/support/customDomain/active': {
105+
post: {
106+
summary: '激活自定义域名',
107+
description: '将自定义域名状态设置为激活,并重新部署到 K8s 集群',
108+
tags: [TagsMap.customDomain],
109+
requestBody: {
110+
content: {
111+
'application/json': {
112+
schema: ActiveCustomDomainBodySchema
113+
}
114+
}
115+
},
116+
responses: {
117+
200: {
118+
description: '成功激活自定义域名',
119+
content: {
120+
'application/json': {
121+
schema: ActiveCustomDomainResponseSchema
122+
}
123+
}
124+
}
125+
}
126+
}
127+
},
128+
'/proApi/support/customDomain/updateVerifyFile': {
129+
post: {
130+
summary: '更新域名验证文件',
131+
description:
132+
'更新域名验证文件配置,用于 SSL 证书验证。更新后会在 K8s 中创建或更新对应的 Ingress',
133+
tags: [TagsMap.customDomain],
134+
requestBody: {
135+
content: {
136+
'application/json': {
137+
schema: UpdateDomainVerifyFileBodySchema
138+
}
139+
}
140+
},
141+
responses: {
142+
200: {
143+
description: '成功更新域名验证文件',
144+
content: {
145+
'application/json': {
146+
schema: UpdateDomainVerifyFileResponseSchema
147+
}
148+
}
149+
}
150+
}
151+
}
152+
}
153+
};

0 commit comments

Comments
 (0)