Repository navigation
fix(plugin): support structured content parts in tool responses - #563
lirenjie95 wants to merge 4 commits into
Conversation
d37b9c2 to
37f5d3a
Compare
|
联查 FastGPT PR #7923,本评论基于当前提交 [P1] 将 handler 业务返回中的 本次预期是让工具响应向后兼容地支持字符串及显式复合内容,已有业务字段及内容应保持原意。原先 handler 返回值允许任意字段;现在 ToolHandlerReturnSchema,32–36 行 将顶层业务 例如,原本合法的返回值: { content: 'ordinary document text', title: 'Result' }现在会在 tool-factory.ts,133–144 行 被 parse 拒绝,并把一次正常工具执行转换成 error。若旧服务端仍输出这样的 response,新版客户端也会在 tool-stream.ts,123–139 行 因共享 schema 校验失败而丢弃消息,最终可能报 已直接调用本 PR 的两个 schema 验证:上述对象的 建议保留旧 handler 业务对象的解析路径,通过明确的结构化输出契约承载新增的模型内容,不要将所有业务 相关 schema/factory 局部测试 26 项通过,但目前通过的测试并不能证明旧输出兼容;部分测试正是在要求拒绝旧字符串 content。未修改源码。 |
|
按意见改了:
|
90f3655 to
d59a252
Compare
- add ToolMessageContentPartSchema (text / image_url) in domain tool vo, allow an optional content parts array in ToolHandlerReturnSchema - sdk factory: validate the content contract before sending the response and report readable validation errors - sdk client: re-export the part schema and type for tool authors - docs: document the content parts contract and wire-first priority in the system tool SKILL - tests: cover part validation, passthrough, unknown fields and error cases
d59a252 to
f8d99e0
Compare
背景
主仓库 labring/FastGPT PR #7923 让工具消息 content 支持 text / image_url parts(对齐 OpenAI tool message 契约)。本 PR 为配套的插件侧联动修改:插件工具处理器允许返回结构化 content parts,并打通工厂、SDK 客户端、CLI 调试、连接网关四个解析点。
联动
改动内容
path: message文本,content 类型错误附专项中文提示测试
兼容性