Skip to content

Conversation

@hezhijie0327
Copy link
Contributor

@hezhijie0327 hezhijie0327 commented May 26, 2025

💻 变更类型 | Change Type

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

🔀 变更说明 | Description of Change

  1. 增加对 MiniMax web_search 工具的支持及引用源解析
  2. 增加对 Zhipu 新版的 web_search 工具的支持及引用源解析,引入 ZHIPU_SEARCH_ENGINE 变量(默认:search_std;可选:search_pro, search_pro_sogou, search_pro_quark, search_pro_jina, search_pro_bing
  3. 增加对 OpenAI Search Preview 模型引用源解析,引入 OPENAI_SEARCH_CONTEXT_SIZE 变量(默认不引入;可选:low, medium, high
  4. 修复 xAI 引用源解析

Note:

  1. Minimax 的引用源会在第一个 tools 响应中返回 content 需要屏蔽;在最后一个流中 messages 的最后一个 Object 中返回 annotations
  2. Zhipu 的引用源有概率会出现 link 为空的情况导致崩溃
  3. xAI 的引用源在最后两个流中出现

Provider Screenshot
MiniMax image
Zhipu image
xAI image
OpenAI image

📝 补充信息 | Additional Information

ref: https://platform.minimaxi.com/document/ChatCompletion%20v2?key=66701d281d57f38758d581d0#QklxsNSbaf6kM4j6wjO5eEek
ref: https://bigmodel.cn/dev/api/search-tool/websearch-in-chat
ref: https://platform.openai.com/docs/guides/tools-web-search

@vercel
Copy link

vercel bot commented May 26, 2025

@hezhijie0327 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

👍 @hezhijie0327

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

@codecov
Copy link

codecov bot commented May 26, 2025

Codecov Report

Attention: Patch coverage is 48.90511% with 70 lines in your changes missing coverage. Please review.

Project coverage is 88.27%. Comparing base (aef19f4) to head (98325eb).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/libs/model-runtime/utils/streams/openai.ts 20.63% 50 Missing ⚠️
src/libs/model-runtime/minimax/index.ts 0.00% 10 Missing ⚠️
src/libs/model-runtime/openai/index.ts 0.00% 7 Missing ⚠️
src/libs/model-runtime/zhipu/index.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7980      +/-   ##
==========================================
- Coverage   88.36%   88.27%   -0.09%     
==========================================
  Files         825      825              
  Lines       60553    60674     +121     
  Branches     5506     5514       +8     
==========================================
+ Hits        53509    53562      +53     
- Misses       7044     7112      +68     
Flag Coverage Δ
app 88.27% <48.90%> (-0.09%) ⬇️
server 95.67% <ø> (ø)

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hezhijie0327 hezhijie0327 changed the title 💄 style: support web_search for MiniMax 💄 style: support web_search for MiniMax & Zhipu May 26, 2025
@hezhijie0327 hezhijie0327 changed the title 💄 style: support web_search for MiniMax & Zhipu 💄 style: support web_search tool for MiniMax & Zhipu May 26, 2025
@hezhijie0327 hezhijie0327 marked this pull request as ready for review May 27, 2025 03:18
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label May 27, 2025
@dosubot dosubot bot added the 💄 Design Design and style issues label May 27, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Added web search functionality to MiniMax and Zhipu AI providers, with support for citation parsing and search engine configuration.

  • Added web_search tool support in src/libs/model-runtime/minimax/index.ts with citation handling for first tools response and final message annotations
  • Implemented Zhipu search configuration in src/libs/model-runtime/zhipu/index.ts with customizable search engines via ZHIPU_SEARCH_ENGINE environment variable
  • Enhanced citation parsing in src/libs/model-runtime/utils/streams/openai.ts to handle empty links and provider-specific formats
  • Added search capabilities to MiniMax models (MiniMax-Text-01 and abab6.5s-chat) in model configuration

💡 (4/5) You can add custom instructions or style guidelines for the bot here!

4 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +114 to +115
if ((item as any).messages && (item as any).messages.length > 0) {
const citations = (item as any).messages.at(-1).annotations;
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Potential null reference error if annotations is undefined in the last message

Suggested change
if ((item as any).messages && (item as any).messages.length > 0) {
const citations = (item as any).messages.at(-1).annotations;
if ((item as any).messages && (item as any).messages.length > 0) {
const lastMessage = (item as any).messages.at(-1);
const citations = lastMessage?.annotations;
if (!citations) return [];

Comment on lines +123 to +124
title: item.url,
url: item.url,
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Using URL as both title and URL may be confusing for users - consider using item.text for title

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels May 27, 2025
@vercel
Copy link

vercel bot commented Jun 1, 2025

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

Name Status Preview Comments Updated (UTC)
lobe-chat-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 1, 2025 10:05am

@arvinxx arvinxx merged commit 28cdafb into lobehub:main Jun 1, 2025
16 of 18 checks passed
@lobehubbot
Copy link
Member

❤️ Great PR @hezhijie0327 ❤️

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 Jun 1, 2025
### [Version&nbsp;1.90.2](v1.90.1...v1.90.2)
<sup>Released on **2025-06-01**</sup>

#### 💄 Styles

- **misc**: Support `web_search` tool for MiniMax & Zhipu.

<br/>

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

#### Styles

* **misc**: Support `web_search` tool for MiniMax & Zhipu, closes [#7980](#7980) ([28cdafb](28cdafb))

</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.90.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@hezhijie0327 hezhijie0327 deleted the minimax branch June 1, 2025 13:21
github-actions bot pushed a commit to jaworldwideorg/OneJA-Bot that referenced this pull request Jun 2, 2025
## [Version&nbsp;1.88.0](v1.87.2...v1.88.0)
<sup>Released on **2025-06-02**</sup>

#### ✨ Features

- **misc**:  Support ModelScope Provider, support protect page.

#### 🐛 Bug Fixes

- **misc**: Agent automatic completion meta not working error, disable LaTeX and Mermaid rendering in SystemRoleContent to prevent lag caused by massive rendering tasks when switching topics, fix DeepSeek new R1 Search error.

#### 💄 Styles

- **misc**:  `+` in the welcome message can be clicked to create an assistant, Enable deploymentName for Aliyun Bailian, Enhanced reasoning_effort Slider Component, support `web_search` tool for MiniMax & Zhipu, support 01.ai proxy url, Update Hunyuan models & deepseek-r1-0528, use default deployment name when parseModelString doesn't contain deployment name.

<br/>

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

#### What's improved

* **misc**:  Support ModelScope Provider, closes [lobehub#8026](https://github.com/jaworldwideorg/OneJA-Bot/issues/8026) ([7b91dfd](7b91dfd))
* **misc**: Support protect page, closes [lobehub#8024](https://github.com/jaworldwideorg/OneJA-Bot/issues/8024) ([d61a9f5](d61a9f5))

#### What's fixed

* **misc**: Agent automatic completion meta not working error, closes [lobehub#8003](https://github.com/jaworldwideorg/OneJA-Bot/issues/8003) ([c5307bf](c5307bf))
* **misc**: Disable LaTeX and Mermaid rendering in SystemRoleContent to prevent lag caused by massive rendering tasks when switching topics, closes [lobehub#8034](https://github.com/jaworldwideorg/OneJA-Bot/issues/8034) ([5b42ee2](5b42ee2))
* **misc**: Fix DeepSeek new R1 Search error, closes [lobehub#8035](https://github.com/jaworldwideorg/OneJA-Bot/issues/8035) ([cf58628](cf58628))

#### Styles

* **misc**:  `+` in the welcome message can be clicked to create an assistant, closes [lobehub#7984](https://github.com/jaworldwideorg/OneJA-Bot/issues/7984) ([9f07e4c](9f07e4c))
* **misc**: Enable deploymentName for Aliyun Bailian, closes [lobehub#7576](https://github.com/jaworldwideorg/OneJA-Bot/issues/7576) ([169e598](169e598))
* **misc**: Enhanced reasoning_effort Slider Component, closes [lobehub#7998](https://github.com/jaworldwideorg/OneJA-Bot/issues/7998) ([750b26a](750b26a))
* **misc**: Support `web_search` tool for MiniMax & Zhipu, closes [lobehub#7980](https://github.com/jaworldwideorg/OneJA-Bot/issues/7980) ([28cdafb](28cdafb))
* **misc**: Support 01.ai proxy url, closes [lobehub#8025](https://github.com/jaworldwideorg/OneJA-Bot/issues/8025) ([e0442b8](e0442b8))
* **misc**: Update Hunyuan models & deepseek-r1-0528, closes [lobehub#7993](https://github.com/jaworldwideorg/OneJA-Bot/issues/7993) ([2eb198c](2eb198c))
* **misc**: Use default deployment name when parseModelString doesn't contain deployment name, closes [lobehub#7719](https://github.com/jaworldwideorg/OneJA-Bot/issues/7719) ([aef19f4](aef19f4))

</details>

<div align="right">

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

</div>
sxjeru pushed a commit to sxjeru/lobe-chat that referenced this pull request Jun 4, 2025
* 💄 style: support web_search for MiniMax

* ♻️ refactor: refactor zhipu `web_search` tools

* 🐛 fix: fix live search citations

* ♻️ refactor: refactor Minimax citations

* 🐛 fix: fix ci error

* 🐛 fix: fix ci error

* 💄 style: support OpenAI Search model citations

---------

Co-authored-by: Arvin Xu <[email protected]>
sxjeru pushed a commit to sxjeru/lobe-chat that referenced this pull request Jun 4, 2025
### [Version&nbsp;1.90.2](lobehub/lobe-chat@v1.90.1...v1.90.2)
<sup>Released on **2025-06-01**</sup>

#### 💄 Styles

- **misc**: Support `web_search` tool for MiniMax & Zhipu.

<br/>

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

#### Styles

* **misc**: Support `web_search` tool for MiniMax & Zhipu, closes [lobehub#7980](lobehub#7980) ([28cdafb](lobehub@28cdafb))

</details>

<div align="right">

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

</div>
AirboZH pushed a commit to yuanze-dev/lobe-chat that referenced this pull request Jul 9, 2025
* 💄 style: support web_search for MiniMax

* ♻️ refactor: refactor zhipu `web_search` tools

* 🐛 fix: fix live search citations

* ♻️ refactor: refactor Minimax citations

* 🐛 fix: fix ci error

* 🐛 fix: fix ci error

* 💄 style: support OpenAI Search model citations

---------

Co-authored-by: Arvin Xu <[email protected]>
AirboZH pushed a commit to yuanze-dev/lobe-chat that referenced this pull request Jul 9, 2025
### [Version&nbsp;1.90.2](lobehub/lobe-chat@v1.90.1...v1.90.2)
<sup>Released on **2025-06-01**</sup>

#### 💄 Styles

- **misc**: Support `web_search` tool for MiniMax & Zhipu.

<br/>

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

#### Styles

* **misc**: Support `web_search` tool for MiniMax & Zhipu, closes [lobehub#7980](lobehub#7980) ([28cdafb](lobehub@28cdafb))

</details>

<div align="right">

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

</div>
bbbugg pushed a commit to bbbugg/lobe-chat that referenced this pull request Aug 14, 2025
* 💄 style: support web_search for MiniMax

* ♻️ refactor: refactor zhipu `web_search` tools

* 🐛 fix: fix live search citations

* ♻️ refactor: refactor Minimax citations

* 🐛 fix: fix ci error

* 🐛 fix: fix ci error

* 💄 style: support OpenAI Search model citations

---------

Co-authored-by: Arvin Xu <[email protected]>
bbbugg pushed a commit to bbbugg/lobe-chat that referenced this pull request Aug 14, 2025
### [Version&nbsp;1.90.2](lobehub/lobe-chat@v1.90.1...v1.90.2)
<sup>Released on **2025-06-01**</sup>

#### 💄 Styles

- **misc**: Support `web_search` tool for MiniMax & Zhipu.

<br/>

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

#### Styles

* **misc**: Support `web_search` tool for MiniMax & Zhipu, closes [lobehub#7980](lobehub#7980) ([2f12db8](lobehub@2f12db8))

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

💄 Design Design and style issues released size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants