Feature/ support (alibaba tts + alibaba function calling + network search)
💻 变更类型 | Change Type
- [x] feat
- [ ] fix
- [ ] refactor
- [ ] perf
- [ ] style
- [ ] test
- [ ] docs
- [ ] ci
- [ ] chore
- [ ] build
🔀 变更说明 | Description of Change
- 增加阿里云千问语音模型(qwen-tts, qwen-tts-latest)支持
- 支持流式语音内容播放,支持边接收边播放功能
- 重构音频处理逻辑,统一PCM转AudioBuffer的实现
- 更新TTS配置选项,支持多引擎动态切换
- 阿里云模型支持 function calling
- 添加联网搜索功能,更新相关配置和多语言支持
📝 补充信息 | Additional Information
https://github.com/user-attachments/assets/e5c20d4c-f1da-4b85-a4b8-b20f89527e59
Summary by CodeRabbit
-
New Features
- Web Search toggle in chat for supported models.
- Streaming TTS playback with real-time audio streaming and queued playback.
-
Improvements
- Dynamic multi-engine TTS settings (OpenAI, Alibaba, Edge) with selectable models/voices/providers.
- Robust, class-based TTS playback manager with streaming controls and PCM support.
- Many new localized strings for the Web Search toggle.
-
Chores
- Yarn/node versions pinned via Volta; Yarn set to use node_modules.
Walkthrough
Introduces Yarn/Volta tooling, widens LLM API speech types and adds optional streaming API, implements Alibaba (Qwen) SSE PCM audio streaming, refactors TTS config and player into a streaming-capable manager, adds a network toggle and config, and adds locale strings for the toggle.
Changes
| Cohort / File(s) | Summary |
|---|---|
Tooling./.yarnrc.yml, package.json |
Add .yarnrc.yml with nodeLinker: node-modules; add volta pin in package.json (node 20.19.4, yarn 1.22.19). |
API surfaceapp/client/api.ts |
Widen LLMApi.speech return type to Promise<ArrayBuffer | AudioBuffer> and add optional streamSpeech?(options, audioManager?): AsyncGenerator<AudioBuffer>. |
Alibaba platform & constantsapp/client/platforms/alibaba.ts, app/constant.ts |
Add QwenApi.streamSpeech SSE-based audio streaming (parses SSE JSON, converts PCM base64 → AudioBuffer), make speech async, extend request params with tools? and enable_search?, add Alibaba.SpeechPath. |
Chat UI & TTS behaviorapp/components/chat.tsx, app/components/tts-config.tsx, app/store/config.ts, app/utils.ts |
Add NetWork toggle UI and enableNetWork config; dynamic TTS provider selection; support streaming TTS via llm.streamSpeech and new TTS provider flows; refactor TTS configs to typed TTS_CONFIGS; add modelProvider to ttsConfig; add canUseNetWork util and update plugin visibility. |
TTS player / audio utilsapp/utils/audio.ts |
Replace function-based player with TTSPlayManager class implementing TTSPlayer, add queueing, streaming controls (start/finish stream, stream controller), PCM conversion helpers (pcmBase64ToAudioBuffer, pcmDataToAudioBuffer), and broaden play to accept `ArrayBuffer |
Localesapp/locales/*.ts |
Add Chat.InputActions.NetWork translations (on/off) across locale files (ar, bn, cn, cs, da, de, en, es, fr, id, it, jp, ko, no, pt, ru, sk, tr, tw, vi). |
Small additions./.yarnrc.yml |
New Yarn config file to force node_modules linker. |
Sequence Diagram(s)
sequenceDiagram
participant UI as Chat UI
participant Client as ClientApi.llm
participant Qwen as Alibaba SSE
participant Player as TTSPlayManager
UI->>Client: request streamSpeech(options, audioManager)
Client->>Qwen: POST /Alibaba.SpeechPath (SSE, params include tools/enable_search)
UI->>Player: startStreamPlay(onended)
loop SSE chunks
Qwen-->>Client: SSE chunk (data: JSON with output.audio.data = PCM base64)
Client->>Client: decode base64 → AudioBuffer (pcmBase64ToAudioBuffer)
Client-->>UI: yield AudioBuffer
UI->>Player: addToQueue(AudioBuffer)
end
Client-->>UI: stream complete
UI->>Player: finishStreamPlay()
Player-->>UI: onended()
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
- ChatGPTNextWeb/NextChat#6542: Updates LLMApi speech signature and adds optional streamSpeech — directly related to API changes here.
- ChatGPTNextWeb/NextChat#6292: Modifies Alibaba platform paths/behavior — overlaps with Alibaba SSE and constant changes.
- ChatGPTNextWeb/NextChat#5581: Touches chat streaming and tool integration — relates to chat streaming/tool parameter changes.
Suggested labels
enhancement
Suggested reviewers
- lloydzhou
- Dogtiti
- ElricLiu
Poem
I twitch my ears at streams that flow,
Small PCM crumbs in audio snow.
I queue each nibble, hop in time,
While toggled nets go fetch and find.
New engines hum — a rabbit’s rhyme. 🐇🎧
[!TIP]
🔌 Remote MCP (Model Context Protocol) integration is now available!
Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
🧪 Generate unit tests
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. - PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
CodeRabbit Commands (Invoked using PR/Issue comments)
Type @coderabbitai help to get the list of available commands.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Status, Documentation and Community
- Visit our Status Page to check the current availability of CodeRabbit.
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.