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: update message roles for specific Azure OpenAI models #6222

Merged
merged 6 commits into from
Feb 20, 2025

Conversation

hcygnaw
Copy link
Contributor

@hcygnaw hcygnaw commented Feb 16, 2025

💻 变更类型 | Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • 📝 docs
  • 🔨 chore

🔀 变更说明 | Description of Change

Fix #6201

system role切换成user role或者developer role。

📝 补充信息 | Additional Information

当使用 Azure OpenAI 的 O-series 模型(如 o1, o1-mini 等)时,如果设定了 system prompt 会导致以下错误:

"error": {
  "message": "Unsupported value: 'messages[0].role' does not support 'system' with this model.",
  "type": "invalid_request_error",
  "param": "messages[0].role",
  "code": "unsupported_value"
}

Copy link

vercel bot commented Feb 16, 2025

@cygnaw is attempting to deploy a commit to the LobeHub Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 16, 2025
@lobehubbot
Copy link
Member

👍 @hcygnaw

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.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

@dosubot dosubot bot added the 🐛 Bug Something isn't working | 缺陷 label Feb 16, 2025
Copy link

codecov bot commented Feb 16, 2025

Codecov Report

Attention: Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 91.83%. Comparing base (a0a9592) to head (e3b31d2).
Report is 36 commits behind head on main.

Files with missing lines Patch % Lines
src/libs/agent-runtime/azureOpenai/index.ts 85.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6222      +/-   ##
==========================================
- Coverage   91.86%   91.83%   -0.04%     
==========================================
  Files         684      684              
  Lines       62196    62311     +115     
  Branches     3095     2908     -187     
==========================================
+ Hits        57137    57221      +84     
- Misses       5059     5090      +31     
Flag Coverage Δ
app 91.83% <85.00%> (-0.04%) ⬇️
server 97.90% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Feb 18, 2025
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Feb 19, 2025
Copy link
Contributor

@arvinxx arvinxx left a comment

Choose a reason for hiding this comment

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

LGTM now. Thanks for your contribution!

Copy link

vercel bot commented Feb 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
lobe-chat-preview ⬜️ Ignored (Inspect) Visit Preview Feb 20, 2025 5:48am

@arvinxx arvinxx merged commit d49329a into lobehub:main Feb 20, 2025
18 of 21 checks passed
@lobehubbot
Copy link
Member

❤️ Great PR @hcygnaw ❤️

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.
项目的成长离不开用户反馈和贡献,感谢您的贡献! 如果您对 LobeHub 开发者社区感兴趣,请加入我们的 discord,然后私信 @arvinxx@canisminor1990。他们会邀请您加入我们的私密开发者频道。我们将会讨论关于 Lobe Chat 的开发,分享和讨论全球范围内的 AI 消息。

github-actions bot pushed a commit that referenced this pull request Feb 20, 2025
### [Version&nbsp;1.62.2](v1.62.1...v1.62.2)
<sup>Released on **2025-02-20**</sup>

#### 🐛 Bug Fixes

- **misc**: Fix message roles for specific Azure OpenAI models.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

* **misc**: Fix message roles for specific Azure OpenAI models, closes [#6222](#6222) ([d49329a](d49329a))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
@lobehubbot
Copy link
Member

🎉 This PR is included in version 1.62.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@1oca1h0st
Copy link
Contributor

我测试了v1.62.2,Azure的o1-mini模型还是用的system role...请问这是什么原因

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I tested v1.62.2, and Azure's o1-mini model still uses the system role... What is the reason for this?

github-actions bot pushed a commit to bentwnghk/lobe-chat that referenced this pull request Feb 20, 2025
### [Version&nbsp;1.103.1](v1.103.0...v1.103.1)
<sup>Released on **2025-02-20**</sup>

#### 🐛 Bug Fixes

- **misc**: Add sambanova proxy url, fix message roles for specific Azure OpenAI models.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

* **misc**: Add sambanova proxy url, closes [lobehub#6348](https://github.com/bentwnghk/lobe-chat/issues/6348) ([c9cb7d9](c9cb7d9))
* **misc**: Fix message roles for specific Azure OpenAI models, closes [lobehub#6222](https://github.com/bentwnghk/lobe-chat/issues/6222) ([d49329a](d49329a))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
@hcygnaw hcygnaw deleted the cygnaw/changesystemrole branch February 20, 2025 11:56
@hcygnaw
Copy link
Contributor Author

hcygnaw commented Feb 20, 2025

@1oca1h0st 我这边deploy了1.62.3版本,测试gpt-4o, gpt-4o-mini, o1-mini, o3-mini都是没问题的,o1没有访问权限所以没有测试。你升到1.62.3版本试试?
image

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@1oca1h0st 我这边deploy了1.62.3版本,测试gpt-4o, gpt-4o-mini, o1-mini, o3-mini都是没问题的,o1没有访问权限所以没有测试。 Have you tried to upgrade to version 1.62.3?
image

bentwnghk pushed a commit to bentwnghk/lobe-chat that referenced this pull request Feb 20, 2025
* 🐛 fix: update message roles for specific Azure OpenAI models

* 🐛 fix: refine role assignment logic for specific Azure OpenAI models

* Create an auto-deploy file

* Delete .github/workflows/lobechatazure-AutoDeployTrigger-bdbe175d-28d2-43a7-a2db-f0a2225af446.yml

---------

Co-authored-by: yichuan <[email protected]>
@1oca1h0st
Copy link
Contributor

不好意思,我看了下代码,是我搞错了,我用的是Azure AI的provider,我已经另外提了一个PR来修复这个bug了。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Sorry, I looked at the code and it was me who made a mistake. I was using Azure AI provider. I have mentioned another PR to fix this bug.

likaiqiang pushed a commit to likaiqiang/lobe-chat that referenced this pull request Feb 26, 2025
* 🐛 fix: update message roles for specific Azure OpenAI models

* 🐛 fix: refine role assignment logic for specific Azure OpenAI models

* Create an auto-deploy file

* Delete .github/workflows/lobechatazure-AutoDeployTrigger-bdbe175d-28d2-43a7-a2db-f0a2225af446.yml

---------

Co-authored-by: yichuan <[email protected]>
likaiqiang pushed a commit to likaiqiang/lobe-chat that referenced this pull request Feb 26, 2025
### [Version&nbsp;1.62.2](lobehub/lobe-chat@v1.62.1...v1.62.2)
<sup>Released on **2025-02-20**</sup>

#### 🐛 Bug Fixes

- **misc**: Fix message roles for specific Azure OpenAI models.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

* **misc**: Fix message roles for specific Azure OpenAI models, closes [lobehub#6222](lobehub#6222) ([d49329a](lobehub@d49329a))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷 released size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
5 participants