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

✨ feat: support minimax as provider #2087

Merged
merged 25 commits into from
Apr 29, 2024
Merged

✨ feat: support minimax as provider #2087

merged 25 commits into from
Apr 29, 2024

Conversation

lwshen
Copy link
Contributor

@lwshen lwshen commented Apr 18, 2024

💻 变更类型 | Change Type

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

🔀 变更说明 | Description of Change

Support model provider: Minimax

close #1053

minimax-demo.mp4

📝 补充信息 | Additional Information

Copy link

vercel bot commented Apr 18, 2024

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

A member of the Team first needs to authorize it.

@lobehubbot
Copy link
Member

👍 @lwshen

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

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.

感谢贡献!整体看下来没啥太大问题,个别自动生成的翻译需要调整下~

locales/nl-NL/modelProvider.json Outdated Show resolved Hide resolved
locales/tr-TR/modelProvider.json Outdated Show resolved Hide resolved
locales/zh-TW/modelProvider.json Outdated Show resolved Hide resolved
Copy link

codecov bot commented Apr 18, 2024

Codecov Report

Attention: Patch coverage is 96.96970% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 92.62%. Comparing base (a3cb538) to head (a1e1c3d).
Report is 1 commits behind head on main.

Files Patch % Lines
src/libs/agent-runtime/minimax/index.ts 95.67% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2087      +/-   ##
==========================================
+ Coverage   92.54%   92.62%   +0.07%     
==========================================
  Files         286      289       +3     
  Lines       16152    16416     +264     
  Branches     1868     1908      +40     
==========================================
+ Hits        14948    15205     +257     
- Misses       1204     1211       +7     

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

Copy link

vercel bot commented Apr 18, 2024

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

Name Status Preview Comments Updated (UTC)
lobe-chat-community ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 29, 2024 2:21am

@arvinxx
Copy link
Contributor

arvinxx commented Apr 18, 2024

@lwshen 我测了下 apikey 的余额不足的情况下,没有抛错:

image

这个是api接口本身就这样,没有返回错误码,还是实现问题?

@lwshen
Copy link
Contributor Author

lwshen commented Apr 18, 2024

@lwshen 我测了下 apikey 的余额不足的情况下,没有抛错:

image 这个是api接口本身就这样,没有返回错误码,还是实现问题?
< HTTP/2 200
<
* Connection #0 to host api.minimax.chat left intact
{"base_resp":{"status_code":1004,"status_msg":"token is unusable"}}

试了一下 api key 失效的情况,api 依旧返回了 200 的状态码

@arvinxx
Copy link
Contributor

arvinxx commented Apr 19, 2024

这有点离谱… 有可能做兼容吗?

@lobehubbot
Copy link
Member

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


This is a bit outrageous... Is it possible to do compatibility?

@lwshen
Copy link
Contributor Author

lwshen commented Apr 19, 2024

这有点离谱… 有可能做兼容吗?

更新了一下代码。

本来打算直接从 openai response 中读取内容,但是 api 返回的不是 SSE 格式,读取不到里面的内容。

因此,实现了一个 MinimaxStream,通过返回值中的 status_code 进行判断有没有错误,不过遇到了 unhandledRejection 错误,不知道你有没有什么想法?

⨯ unhandledRejection: {
  error: { code: 1004, message: 'token is unusable' },
  errorType: 'InvalidMinimaxAPIKey',
  provider: 'minimax'
}

@arvinxx
Copy link
Contributor

arvinxx commented Apr 20, 2024

@lwshen 得 rebase 下代码了,上一个 PR #2041 调整了 AgentRuntime 的位置

@lobehubbot
Copy link
Member

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


@lwshen needs to rebase the code. The previous PR #2041 adjusted the location of AgentRuntime.

@lwshen
Copy link
Contributor Author

lwshen commented Apr 20, 2024

@lwshen 得 rebase 下代码了,上一个 PR #2041 调整了 AgentRuntime 的位置

done

@lobehubbot
Copy link
Member

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


@lwshen needs to rebase the code. The previous PR #2041 adjusted the location of AgentRuntime.

done

@arvinxx
Copy link
Contributor

arvinxx commented Apr 21, 2024

image

我试了下还是有问题

@lwshen lwshen force-pushed the minimax branch 4 times, most recently from 8b2530e to 7a954b3 Compare April 21, 2024 14:41
@lwshen lwshen requested a review from arvinxx April 28, 2024 02:22
@arvinxx arvinxx changed the title feat: support minimax as provider ✨ feat: support minimax as provider Apr 28, 2024
@arvinxx
Copy link
Contributor

arvinxx commented Apr 28, 2024

@lwshen rebase 下 main ,其他我测下来没问题了~

@lobehubbot
Copy link
Member

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


@lwshen rebase main and I have tested the others and everything is fine~

@lwshen
Copy link
Contributor Author

lwshen commented Apr 28, 2024

@arvinxx done

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, I'll merge it. Thanks for your hard working! I'm really appraciate your great contribution! 👏

@arvinxx arvinxx merged commit 00abd82 into lobehub:main Apr 29, 2024
6 checks passed
@lobehubbot
Copy link
Member

❤️ Great PR @lwshen ❤️

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 Apr 29, 2024
## [Version&nbsp;0.151.0](v0.150.10...v0.151.0)
<sup>Released on **2024-04-29**</sup>

#### ✨ Features

- **misc**: Support minimax as a new provider.

<br/>

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

#### What's improved

* **misc**: Support minimax as a new provider, closes [#2087](#2087) ([00abd82](00abd82))

</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 0.151.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

github-actions bot pushed a commit to bentwnghk/lobe-chat that referenced this pull request Apr 29, 2024
## [Version&nbsp;1.31.0](v1.30.6...v1.31.0)
<sup>Released on **2024-04-29**</sup>

#### ✨ Features

- **misc**: Support minimax as a new provider.

#### 💄 Styles

- **misc**: Improve Inbox Assistant Welcome Guide.

<br/>

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

#### What's improved

* **misc**: Support minimax as a new provider, closes [lobehub#2087](https://github.com/bentwnghk/lobe-chat/issues/2087) ([00abd82](00abd82))

#### Styles

* **misc**: Improve Inbox Assistant Welcome Guide, closes [lobehub#2086](https://github.com/bentwnghk/lobe-chat/issues/2086) ([df37212](df37212))

</details>

<div align="right">

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

</div>
@lwshen lwshen deleted the minimax branch April 29, 2024 07:59
Yanyutin753 pushed a commit to Yanyutin753/lobe-chat that referenced this pull request May 11, 2024
* add minimax as provider

* add i18n token

* update

* update

* Revert "add i18n token"

This reverts commit 4be6d67.

* add i18n token

* add doc

* update i18n

* implement MinimaxStream

* use fetchSSE function

* fix TypeError and SyntaxError

* add unit test

* add agent runtime

* add debug log

* use fetch function directly

* refactor(minimax): streamline response parsing logic

* remove redundant error response check

* fix code style
Yanyutin753 added a commit to Yanyutin753/lobe-chat that referenced this pull request May 11, 2024
* add minimax as provider

* add i18n token

* update

* update

* Revert "add i18n token"

This reverts commit 4be6d67.

* add i18n token

* add doc

* update i18n

* implement MinimaxStream

* use fetchSSE function

* fix TypeError and SyntaxError

* add unit test

* add agent runtime

* add debug log

* use fetch function directly

* refactor(minimax): streamline response parsing logic

* remove redundant error response check

* fix code style
TheNameIsNigel pushed a commit to TheNameIsNigel/lobe-chat that referenced this pull request May 15, 2024
* add minimax as provider

* add i18n token

* update

* update

* Revert "add i18n token"

This reverts commit 4be6d67.

* add i18n token

* add doc

* update i18n

* implement MinimaxStream

* use fetchSSE function

* fix TypeError and SyntaxError

* add unit test

* add agent runtime

* add debug log

* use fetch function directly

* refactor(minimax): streamline response parsing logic

* remove redundant error response check

* fix code style
TheNameIsNigel pushed a commit to TheNameIsNigel/lobe-chat that referenced this pull request May 15, 2024
## [Version&nbsp;0.151.0](lobehub/lobe-chat@v0.150.10...v0.151.0)
<sup>Released on **2024-04-29**</sup>

#### ✨ Features

- **misc**: Support minimax as a new provider.

<br/>

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

#### What's improved

* **misc**: Support minimax as a new provider, closes [lobehub#2087](lobehub#2087) ([00abd82](lobehub@00abd82))

</details>

<div align="right">

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

</div>
ipoly pushed a commit to ipoly/lobe-chat that referenced this pull request Jul 29, 2024
* add minimax as provider

* add i18n token

* update

* update

* Revert "add i18n token"

This reverts commit 4be6d67.

* add i18n token

* add doc

* update i18n

* implement MinimaxStream

* use fetchSSE function

* fix TypeError and SyntaxError

* add unit test

* add agent runtime

* add debug log

* use fetch function directly

* refactor(minimax): streamline response parsing logic

* remove redundant error response check

* fix code style
ipoly pushed a commit to ipoly/lobe-chat that referenced this pull request Jul 29, 2024
## [Version&nbsp;0.151.0](lobehub/lobe-chat@v0.150.10...v0.151.0)
<sup>Released on **2024-04-29**</sup>

#### ✨ Features

- **misc**: Support minimax as a new provider.

<br/>

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

#### What's improved

* **misc**: Support minimax as a new provider, closes [lobehub#2087](lobehub#2087) ([00abd82](lobehub@00abd82))

</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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request] MiniMax 模型支持
3 participants