Skip to content

Fix external calls to the published workflow version update#783

Open
tf1928 wants to merge 1 commit into
iflytek:mainfrom
tf1928:fix-workflows-update
Open

Fix external calls to the published workflow version update#783
tf1928 wants to merge 1 commit into
iflytek:mainfrom
tf1928:fix-workflows-update

Conversation

@tf1928
Copy link
Copy Markdown

@tf1928 tf1928 commented May 7, 2026

📝 Pull Request 描述 | Description

Fixed an issue where, when updating, rolling back, or enabling versions of published applications under the designer, the corresponding externally callable applications under the executor were not updated synchronously.

🎯 变更类型 | Change Type

  • ✨ 新功能 | New Feature
  • 🐛 Bug 修复 | Bug Fix
  • 📚 文档更新 | Documentation
  • 🎨 代码格式/样式 | Code Style
  • ♻️ 重构 | Refactoring
  • ⚡ 性能优化 | Performance
  • ✅ 测试相关 | Tests
  • 🔧 配置变更 | Configuration
  • 🔨 构建/CI | Build/CI
  • 🌐 国际化 | Internationalization
  • ⬆️ 依赖升级 | Dependencies Update

🔗 相关 Issue | Related Issues

  • Closes #
  • Related to #

📋 变更内容 | Changes Made

主要变更 | Main Changes

  • The front-end Vue side has existing back-end API interfaces via getRobotLastIsExternalCall (to get whether the application allows external calls) and setRobotIsExternalCall (to save the configuration of whether external calls are allowed). When the application is released and the options to enable the current release version, rollback version, or enable a specific version are checked, the corresponding workflow in the workflows table is updated.

技术细节 | Technical Details


🧪 测试 | Testing

测试环境 | Test Environment

  • Windows 10/11
  • Linux
  • macOS
  • Docker

测试步骤 | Test Steps

  1. The test of creating version v1 passed.
015a869f-6145-43e6-b65c-ab02c5fe9f91 e18f6c08-b9a0-46a9-a854-d4f8b71c9af1
2. The error message has been modified for concurrent version v2. The debugger and executor have been updated, but the external API call is still using version v1, and the corresponding data item in the database has not been updated.
365056aa-f740-4851-9742-8334758d1c47 63f54f7d-7782-41e7-a144-ba75bb0c33b3 63f54f7d-7782-41e7-a144-ba75bb0c33b3 image
3. After fixing the code, the prompt content was modified for concurrent version v3, and the debugging, executor, external API, and database were all successfully updated.
9edefe86-a3ba-4ea7-8ba7-c457eff99ab9 f4571a6e-29b9-424d-885c-3ef2c5b5e0ed f5708548-52b6-43a2-915c-409ae4ef5165
4. In the Designer - Version Management section, different versions were rolled back and enabled. The debugger, executor, external API, and database were all successfully updated, and the repair was completed.
fc357504-30db-4b62-b6a4-0d48308721b5

测试结果 | Test Results


📸 截图/录屏 | Screenshots/Recordings

变更前 | Before

变更后 | After


⚠️ 破坏性变更 | Breaking Changes

  • 此 PR 包含破坏性变更 | This PR contains breaking changes
破坏性变更详情 | Breaking Changes Details

✅ 检查清单 | Checklist

代码质量 | Code Quality

  • 代码遵循项目的编码规范 | Code follows project coding standards
  • 已进行自我代码审查 | Self-reviewed the code
  • 代码有适当的注释(特别是复杂逻辑)| Code has appropriate comments (especially for complex logic)
  • 更新了相关文档 | Updated relevant documentation
  • 没有产生新的警告 | No new warnings generated

测试 | Testing

  • 添加了相应的测试用例 | Added corresponding test cases
  • 所有测试通过 | All tests pass
  • 手动测试验证通过 | Manual testing verification passed

文档 | Documentation

  • 更新了 README(如需要)| Updated README (if needed)
  • 更新了 API 文档(如需要)| Updated API documentation (if needed)
  • 更新了用户指南(如需要)| Updated user guide (if needed)
  • 更新了 CHANGELOG(如需要)| Updated CHANGELOG (if needed)

其他 | Others

  • 已与相关利益方沟通 | Communicated with relevant stakeholders
  • 不影响现有功能 | Does not affect existing functionality
  • 考虑了向后兼容性 | Considered backward compatibility
  • 考虑了性能影响 | Considered performance impact
  • 考虑了安全性 | Considered security

📌 额外说明 | Additional Notes


🙏 致谢 | Acknowledgements


📖 提示 | Tips:

  • 确保 PR 标题简洁明了,使用动词开头(例如:Add, Fix, Update, Remove)
  • Ensure PR title is concise and clear, starting with a verb (e.g., Add, Fix, Update, Remove)
  • 尽量保持 PR 的改动范围小而集中,便于审查
  • Try to keep PR changes small and focused for easier review
  • 遵循项目的分支管理策略
  • Follow the project's branch management strategy

/cc @maintainers

测试结果 | Test Results


📸 截图/录屏 | Screenshots/Recordings

变更前 | Before

变更后 | After


⚠️ 破坏性变更 | Breaking Changes

  • 此 PR 包含破坏性变更 | This PR contains breaking changes
破坏性变更详情 | Breaking Changes Details

✅ 检查清单 | Checklist

代码质量 | Code Quality

  • 代码遵循项目的编码规范 | Code follows project coding standards
  • 已进行自我代码审查 | Self-reviewed the code
  • 代码有适当的注释(特别是复杂逻辑)| Code has appropriate comments (especially for complex logic)
  • 更新了相关文档 | Updated relevant documentation
  • 没有产生新的警告 | No new warnings generated

测试 | Testing

  • 添加了相应的测试用例 | Added corresponding test cases
  • 所有测试通过 | All tests pass
  • 手动测试验证通过 | Manual testing verification passed

文档 | Documentation

  • 更新了 README(如需要)| Updated README (if needed)
  • 更新了 API 文档(如需要)| Updated API documentation (if needed)
  • 更新了用户指南(如需要)| Updated user guide (if needed)
  • 更新了 CHANGELOG(如需要)| Updated CHANGELOG (if needed)

其他 | Others

  • 已与相关利益方沟通 | Communicated with relevant stakeholders
  • 不影响现有功能 | Does not affect existing functionality
  • 考虑了向后兼容性 | Considered backward compatibility
  • 考虑了性能影响 | Considered performance impact
  • 考虑了安全性 | Considered security

📌 额外说明 | Additional Notes


🙏 致谢 | Acknowledgements


📖 提示 | Tips:

  • 确保 PR 标题简洁明了,使用动词开头(例如:Add, Fix, Update, Remove)
  • Ensure PR title is concise and clear, starting with a verb (e.g., Add, Fix, Update, Remove)
  • 尽量保持 PR 的改动范围小而集中,便于审查
  • Try to keep PR changes small and focused for easier review
  • 遵循项目的分支管理策略
  • Follow the project's branch management strategy

/cc @maintainers

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces logic to synchronize external call configurations when a robot is published or a version is enabled, ensuring that the active version is correctly reflected in the external call settings. Feedback includes addressing potential data corruption from double-serializing parameters, fixing the placement of the synchronization call in the publishing flow to cover all scenarios, and reducing code duplication by extracting shared logic. Additionally, there are suggestions to correct indentation and remove trailing semicolons to maintain project style consistency.

project_id: props.robotId,
version: lastPublishData.version,
status: 1,
parameters: JSON.stringify(currentConfig.parameters),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using JSON.stringify(currentConfig.parameters) may lead to double-serialization if currentConfig.parameters is already a string. It is safer to verify the type before stringifying to avoid corrupted data in the database.

          parameters: typeof currentConfig.parameters === 'string' ? currentConfig.parameters : JSON.stringify(currentConfig.parameters),

if (Number(basicFormData.value.version) > 1 && res.data === 'market') {
message.success(t('publish.syncMarketSuccess'))
// 更新已发布工作流外部调用版本
refreshExternalCall()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The refreshExternalCall() function is currently only called within one specific branch of the applicationReleaseCheck callback. This means the external call configuration won't be updated if a market release application is triggered (the first callback at line 82). Since refreshExternalCall already checks enableLastVersion.value, it should be called directly after publishRobot succeeds to ensure the version is synchronized whenever it is enabled.

Comment on lines +51 to +75
const refreshExternalCall = async () => {
try {
// 获取工作流外部调用版本外部调用配置
const currentConfig = await getRobotLastIsExternalCall(props.robotId)

// 是否开启外部调用且启用当前发布版本
if (currentConfig?.status === 1 && enableLastVersion.value) {
console.log('检测到外部调用已开启,执行强制更新以同步版本...')

const updatePayload = {
...currentConfig,
project_id: props.robotId,
version: lastPublishData.version,
status: 1,
parameters: JSON.stringify(currentConfig.parameters),
}

// 更新已发布工作流
await setRobotIsExternalCall(updatePayload)
console.log('外部调用配置强制更新成功')
}
} catch (error) {
console.error('发版后更新已发布工作流外部调用版本失败', error)
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic for refreshExternalCall is duplicated here and in useVersionManage.ts. To improve maintainability and ensure consistency across the application, consider extracting this logic into a shared utility function or a method within the API layer (e.g., in @/api/robot.ts).

Comment on lines +82 to +107
// 更新已发布工作流外部调用版本
const refreshExternalCall = async (item: versionMap) => {
try {
// 获取工作流外部调用版本外部调用配置
const currentConfig = await getRobotLastIsExternalCall(props.robotId)

// 是否开启外部调用
if (currentConfig?.status === 1) {
console.log('检测到外部调用已开启,更新外部调用版本...')

const updatePayload = {
...currentConfig,
project_id: props.robotId,
version: item.versionNum,
status: 1,
parameters: JSON.stringify(currentConfig.parameters),
}

// 更新已发布工作流
await setRobotIsExternalCall(updatePayload)
console.log('外部调用配置强制更新成功')
}
} catch (error) {
console.error('发版后更新已发布工作流外部调用版本失败', error)
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The indentation in this block uses 4 spaces, while the rest of the file uses 2 spaces. Please adjust it to match the project's style guide for consistency.

Signed-off-by: tf1928 <codertf@163.com>
@tf1928 tf1928 force-pushed the fix-workflows-update branch from 97de118 to 513055d Compare May 7, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant