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
2fe03ec0
authored
Apr 22, 2026
by
Archer
Committed by
GitHub
Apr 22, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: ts (#6794)
parent
509b227f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
18 deletions
+24
-18
packages/global/openapi/core/chat/completion/api.ts
+24
-18
No files found.
packages/global/openapi/core/chat/completion/api.ts
View file @
2fe03ec0
...
@@ -8,23 +8,28 @@ import { OutLinkChatAuthSchema } from '../../../../support/permission/chat';
...
@@ -8,23 +8,28 @@ import { OutLinkChatAuthSchema } from '../../../../support/permission/chat';
import
{
StoreEdgeItemTypeSchema
}
from
'../../../../core/workflow/type/edge'
;
import
{
StoreEdgeItemTypeSchema
}
from
'../../../../core/workflow/type/edge'
;
import
{
OpenAPIStoreNodeItemTypeSchema
}
from
'../../workflow/node'
;
import
{
OpenAPIStoreNodeItemTypeSchema
}
from
'../../workflow/node'
;
const
nullishToUndefined
=
<
T
extends
z
.
ZodTypeAny
>
(
schema
:
T
)
=>
z
.
preprocess
((
v
)
=>
v
??
undefined
,
schema
);
const
WebCompletionsSchema
=
z
.
object
({
const
WebCompletionsSchema
=
z
.
object
({
chatId
:
z
chatId
:
nullishToUndefined
(
z
.
string
().
max
(
1024
).
optional
()).
meta
({
.
string
()
description
:
'聊天ID, 传入的话会自动获取历史记录,不传入则认为是新对话'
.
max
(
1024
)
}),
.
nullish
()
appId
:
nullishToUndefined
(
ObjectIdSchema
.
optional
()),
.
meta
({
description
:
'聊天ID, 传入的话会自动获取历史记录,不传入则认为是新对话'
}),
customUid
:
nullishToUndefined
(
z
.
string
().
max
(
1024
).
optional
()).
meta
({
appId
:
ObjectIdSchema
.
nullish
(),
description
:
'自定义用户ID(分享链接)'
customUid
:
z
.
string
().
max
(
1024
).
nullish
().
meta
({
description
:
'自定义用户ID(分享链接)'
}),
}),
metadata
:
z
.
record
(
z
.
string
(),
z
.
any
()).
nullish
().
meta
({
description
:
'元数据'
})
metadata
:
nullishToUndefined
(
z
.
record
(
z
.
string
(),
z
.
any
()).
optional
()).
meta
({
description
:
'元数据'
})
});
});
// completions 接口实际上并没有用完所有字段,所以这里就取局部即可
// completions 接口实际上并没有用完所有字段,所以这里就取局部即可
const
ChatCompletionCreateParamsSchema
=
z
.
object
({
const
ChatCompletionCreateParamsSchema
=
z
.
object
({
messages
:
z
.
array
(
ChatCompletionMessageParamSchema
).
nullish
().
default
([]
).
meta
({
messages
:
nullishToUndefined
(
z
.
array
(
ChatCompletionMessageParamSchema
).
default
([])
).
meta
({
description
:
'消息列表'
description
:
'消息列表'
}),
}),
stream
:
z
.
boolean
().
nullish
().
default
(
false
).
meta
({
stream
:
nullishToUndefined
(
z
.
boolean
().
default
(
false
)
).
meta
({
description
:
'是否流式返回'
description
:
'是否流式返回'
})
})
});
});
...
@@ -32,23 +37,24 @@ const ChatCompletionCreateParamsSchema = z.object({
...
@@ -32,23 +37,24 @@ const ChatCompletionCreateParamsSchema = z.object({
export
const
CompletionsPropsSchema
=
OutLinkChatAuthSchema
.
extend
(
WebCompletionsSchema
.
shape
)
export
const
CompletionsPropsSchema
=
OutLinkChatAuthSchema
.
extend
(
WebCompletionsSchema
.
shape
)
.
extend
(
ChatCompletionCreateParamsSchema
.
shape
)
.
extend
(
ChatCompletionCreateParamsSchema
.
shape
)
.
extend
({
.
extend
({
variables
:
z
.
record
(
z
.
string
(),
z
.
any
()).
nullish
().
default
({}
).
meta
({
variables
:
nullishToUndefined
(
z
.
record
(
z
.
string
(),
z
.
any
()).
default
({})
).
meta
({
description
:
'全局变量或插件输入'
description
:
'全局变量或插件输入'
}),
}),
responseChatItemId
:
z
responseChatItemId
:
nullishToUndefined
(
z
.
string
()
.
string
()
.
nullish
()
.
default
(()
=>
getNanoid
())
.
default
(()
=>
getNanoid
())
.
meta
({
.
meta
({
description
:
'自定义响应的 assistant 的消息 ID,如果不传入,则自动生成一个'
description
:
'自定义响应的 assistant 的消息 ID,如果不传入,则自动生成一个'
}),
})
detail
:
z
.
boolean
().
nullish
().
default
(
false
).
meta
({
),
detail
:
nullishToUndefined
(
z
.
boolean
().
default
(
false
)).
meta
({
description
:
'是否返回详细信息,包括 reasoning_content, tool_calls, usage 等'
description
:
'是否返回详细信息,包括 reasoning_content, tool_calls, usage 等'
}),
}),
retainDatasetCite
:
z
.
boolean
().
nullish
().
default
(
false
).
meta
({
retainDatasetCite
:
nullishToUndefined
(
z
.
boolean
().
default
(
false
)
).
meta
({
description
:
'是否保留数据集引用'
description
:
'是否保留数据集引用'
}),
}),
showSkillReferences
:
z
.
boolean
().
nullish
().
default
(
false
).
meta
({
showSkillReferences
:
nullishToUndefined
(
z
.
boolean
().
default
(
false
)
).
meta
({
description
:
'是否显示技能引用'
description
:
'是否显示技能引用'
})
})
});
});
...
@@ -134,7 +140,7 @@ export const ChatTestPropsSchema = z.object({
...
@@ -134,7 +140,7 @@ export const ChatTestPropsSchema = z.object({
nodes
:
z
.
array
(
OpenAPIStoreNodeItemTypeSchema
).
meta
({
description
:
'节点列表'
}),
nodes
:
z
.
array
(
OpenAPIStoreNodeItemTypeSchema
).
meta
({
description
:
'节点列表'
}),
edges
:
z
.
array
(
StoreEdgeItemTypeSchema
).
meta
({
description
:
'边列表'
}),
edges
:
z
.
array
(
StoreEdgeItemTypeSchema
).
meta
({
description
:
'边列表'
}),
chatConfig
:
AppChatConfigTypeSchema
.
meta
({
description
:
'聊天配置'
}),
chatConfig
:
AppChatConfigTypeSchema
.
meta
({
description
:
'聊天配置'
}),
variables
:
z
.
record
(
z
.
string
(),
z
.
any
()).
nullish
().
default
({}
).
meta
({
variables
:
nullishToUndefined
(
z
.
record
(
z
.
string
(),
z
.
any
()).
default
({})
).
meta
({
description
:
'全局变量或插件输入'
description
:
'全局变量或插件输入'
}),
}),
appId
:
ObjectIdSchema
.
meta
({
description
:
'应用ID'
}),
appId
:
ObjectIdSchema
.
meta
({
description
:
'应用ID'
}),
...
...
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