diff --git a/README.md b/README.md index 3d6a4537d17f2dd6cb15f2f7bc868eceeaedd48b..5b1a9582eec08ba4d24ea308804ee3aea9cdaa3e 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,10 @@ CLI 会保留原始输出文件,同时生成提供给 AI 使用的“业务系 当前版本在扫描和生成 Ontology 时,存在以下技术限制: -- 无法扫描 `附件/图片` 类型的列,这将导致 AI 无法操作涉及到文件上传/下载的业务系统功能。对于输入或输出参数中包含这种列的服务端命令,推荐在备注中加入 `[HOB_EXCLUDE]` +- 无法扫描 `附件/图片` 类型的列,这将导致 AI 无法直接理解涉及文件上传/下载的数据结构。 +- 如果工程中同时包含名称为 `uploadFiles` 和 `downloadFiles` 的服务端命令,则视为该工程已经补齐文件能力支持;否则,对于输入或输出参数中包含附件/图片类型信息的服务端命令,工具仍会提示“当前暂不支持文件能力”。 +- 如需支持文件能力,可以参考指导文档完善 `uploadFiles` 和 `downloadFiles` 命令。 +- 对于暂未补齐文件能力、且输入或输出参数中包含这种列的服务端命令,推荐在备注中加入 `[HOB_EXCLUDE]`。 - 无法扫描 `外部服务端命令`,这将导致 AI 无法直接调用注册到应用的外部服务端命令。如有需要,可以将其封装为服务端命令。 ## 本地开发 diff --git a/package-lock.json b/package-lock.json index 80c8cede7dcd54c2a0f248c73577e56463139369..05441d965fffbb7fd6c2b5d368712ea07ecd05dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "huozige-ontology-builder", - "version": "1.0.7", + "version": "1.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "huozige-ontology-builder", - "version": "1.0.7", + "version": "1.1.2", "license": "MIT", "dependencies": { "archiver": "^8.0.0", diff --git a/src/core/governance/policies/file-arguments.ts b/src/core/governance/policies/file-arguments.ts index cba9e995d20eec99e287f6641829681482b7664a..8fa117428095b7280c74dc4610af7e46371b0526 100644 --- a/src/core/governance/policies/file-arguments.ts +++ b/src/core/governance/policies/file-arguments.ts @@ -5,9 +5,18 @@ import { } from '../shared.js'; import type { CommandMeta, GovernanceIssue } from '../types.js'; +function supportsFileCapability(commandMetas: Map): boolean { + const commandNames = new Set([...commandMetas.values()].map((command) => command.name)); + return commandNames.has('uploadFiles') && commandNames.has('downloadFiles'); +} + export function detectFileArgumentIssues(commandMetas: Map): GovernanceIssue[] { const issues: GovernanceIssue[] = []; + if (supportsFileCapability(commandMetas)) { + return issues; + } + for (const command of postRequestCommands(commandMetas)) { const fileParameters = command.parameters.filter((parameter) => isFileLikeNameOrRemark(parameter.name, parameter.remark)); const fileReturns = command.returnProperties.filter((property) => isFileLikeNameOrRemark(property.name, property.remark)); @@ -30,7 +39,11 @@ export function detectFileArgumentIssues(commandMetas: Map) command.description, '包含图片或附件类型参数/返回值,暂不支持文件', )}`, - details: [`当前备注:${command.description || '(空)'}`, `命中项:${names.join('、')}`], + details: [ + `当前备注:${command.description || '(空)'}`, + `命中项:${names.join('、')}`, + '可以按照指导文档完善 uploadFiles 和 downloadFiles 命令,以支持文件能力。', + ], }); }