Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add Role Check to Prevent Validation Error #889

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

YunZLu
Copy link
Contributor

@YunZLu YunZLu commented Sep 23, 2024

概述

实现/解决/优化的内容:

在OpenAI ChatCompletion API 请求器处理中转站返回的message时,因部分中转站返回AI回复message中不含role,导致role=none而报Validation Error,故在_make_msg函数中处理完message后添加对role字段的检查,确保 role 字段存在且不为 None。考虑到中转站应该都用OpenAI ChatCompletion API 请求器,所以暂不检查其他请求器返回的message。

检查清单

#886

PR 作者完成

  • [ √] 阅读仓库贡献指引了吗?
  • [ √] 与项目所有者沟通过了吗?

项目所有者完成

  • 相关 issues 链接了吗?
  • 配置项写好了吗?迁移写好了吗?生效了吗?
  • 依赖写到 requirements.txt 和 core/bootutils/deps.py 了吗
  • 文档编写了吗?

@RockChinQ
Copy link
Owner

自己测试过了吧?

@RockChinQ RockChinQ merged commit 47e308b into RockChinQ:master Sep 26, 2024
1 check failed
@YunZLu YunZLu deleted the add-check-role branch September 26, 2024 05:41
@YunZLu
Copy link
Contributor Author

YunZLu commented Sep 26, 2024

测试了,没有问题

@RockChinQ
Copy link
Owner

RockChinQ commented Sep 26, 2024

最新版 3.3.1.1 已经包含了,感谢贡献!

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.

[Bug]: 中转站claude回复消息时,不返回role,导致出现none is not an allowed value报错
2 participants