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

♻️ refactor: Refactor Azure OpenAI Implementation #4619

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

BrandonStudio
Copy link
Contributor

@BrandonStudio BrandonStudio commented Nov 6, 2024

💻 变更类型 | Change Type

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

🔀 变更说明 | Description of Change

  • Migrate from @azure/openai to openai
  • Rename apikey to apiKey
  • Refactor o1model check from o1Models.has to isO1Model
  • Add generic type for OpenAI.transformResponseToStream

📝 补充信息 | Additional Information

Note that on non-database deployment, sending large image results in 431 Request Header Fields Too Large
Same issue happens in GitHub provider

refs:

TODOs:

  • Add Embedding
  • Refactor GitHub to Azure

Rename apikey to apiKey
Refactor o1model check
Add generic type for OpenAI.transformResponseToStream
Copy link

vercel bot commented Nov 6, 2024

@BrandonStudio is attempting to deploy a commit to the LobeChat Community Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

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

Project coverage is 92.52%. Comparing base (87ac46d) to head (8a27fbe).
Report is 90 commits behind head on main.

Files with missing lines Patch % Lines
src/libs/agent-runtime/azureOpenai/index.ts 96.87% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4619      +/-   ##
==========================================
+ Coverage   92.43%   92.52%   +0.09%     
==========================================
  Files         509      512       +3     
  Lines       36602    36820     +218     
  Branches     2229     3401    +1172     
==========================================
+ Hits        33832    34069     +237     
+ Misses       2770     2751      -19     
Flag Coverage Δ
app 92.52% <97.74%> (+0.09%) ⬆️
server 97.34% <ø> (ø)

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.


🚨 Try these New Features:

@BrandonStudio BrandonStudio marked this pull request as ready for review November 7, 2024 03:51
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. azure labels Nov 7, 2024
@BrandonStudio
Copy link
Contributor Author

BrandonStudio commented Nov 7, 2024

I'm not going to complete TODOs for now. I'd rather wait for refactor of LobeOpenAICompatibleAI, which will be another PR.

@BrandonStudio BrandonStudio changed the title Refactor Azure OpenAI Implementation ♻️ refactor: Refactor Azure OpenAI Implementation Nov 21, 2024
Copy link
Contributor

Choose a reason for hiding this comment

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

如果都换成了下划线模式,应该可以直接用 OpenAI 的 stream处理方法,不需要再单独写一个 Azure Openai 的了?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我记得有一块不一样来着,忘了是哪块了
回头试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants