A-kirami / nonebot-plugin-chatgpt

MIT License
319 stars 37 forks source link

新增配置项 `chatgpt_detailed_error` 与细分错误输出 #105

Closed zeithrold closed 1 year ago

zeithrold commented 1 year ago

这个 PR 带来了什么样的更改?

本PR提出了一个chatgpt_detailed_error的配置项,旨在调整当ChatGPT并没有按预期运行时引发非必要的错误输出,同时细分错误输出。

这个 PR 是否存在破坏性变更?

描述

新增了chatgpt_detailed_error配置项,并细分ChatGPT错误内容(超时、其他)。

动机和背景

在生产环境下大量输出错误Stack实属一种不合适的行为,应该将其设定为一个配置项供用户配置。

其他信息

检查工作

sourcery-ai[bot] commented 1 year ago

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 3.26%.

Quality metrics Before After Change
Complexity 4.21 ⭐ 6.08 ⭐ 1.87 👎
Method Length 61.42 🙂 64.16 🙂 2.74 👎
Working memory 6.65 🙂 6.81 🙂 0.16 👎
Quality 72.41% 🙂 69.15% 🙂 -3.26% 👎
Other metrics Before After Change
Lines 191 205 14
Changed files Quality Before Quality After Quality Change
nonebot_plugin_chatgpt/__init__.py 71.31% 🙂 67.44% 🙂 -3.87% 👎
nonebot_plugin_chatgpt/config.py 77.41% ⭐ 77.01% ⭐ -0.40% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
nonebot_plugin_chatgpt/__init__.py ai_chat 16 🙂 252 ⛔ 10 😞 40.30% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

mergify[bot] commented 1 year ago

@zeithrold 这个拉取请求中存在代码质量问题, 请查看状态检查中的详细报告并修复问题

mergify[bot] commented 1 year ago

@zeithrold 此 PR 已合并, 感谢你做出的贡献!