lobehub / chat-plugin-sdk

🧩 Lobe Chat Plugin SDK - The LobeChat Plugin SDK assists you in creating exceptional chat plugins for Lobe Chat.
https://chat-plugin-sdk.lobehub.com
MIT License
51 stars 21 forks source link

🐛 fix: ensure request body properties are defined #43

Closed luquitared closed 4 months ago

luquitared commented 4 months ago

💻 变更类型 | Change Type

🔀 变更说明 | Description of Change

Sometimes when parsing more complex openapi schemas, this crash can happen:

Error processing request: TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at OpenAPIConvertor.convertOpenAPIToPluginSchema (/Users/lucasnegritto/projects/dynama-builder/tools-api/node_modules/@lobehub/chat-plugin-sdk/lib/openapi/index.js:55:45)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async convertManifest (/Users/lucasnegritto/projects/dynama-builder/tools-api/index.js:43:26)
    at async /Users/lucasnegritto/projects/dynama-builder/tools-api/index.js:74:54

By ensuring the request body properties are defined, we prevent trying to convert an undefined or null object to keys, avoiding the TypeError.

lobehubbot commented 4 months ago

👍 @luquitared
Thank you for raising your pull request and contributing to our Community Please make sure you have followed our contributing guidelines. We will review it as soon as possible. If you encounter any problems, please feel free to connect with us.\ 非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。 如果您遇到任何问题,请随时与我们联系。

lobehubbot commented 4 months ago

❤️ Great PR @luquitared ❤️
The growth of project is inseparable from user feedback and contribution, thanks for your contribution!\ 项目的成长离不开用户反馈和贡献,感谢您的贡献!

lobehubbot commented 4 months ago

:tada: This PR is included in version 1.32.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket: