Skip to content

feat: add DashScope TTS provider and WeChat audio file sending - #3270

Closed
MrTreasure wants to merge 1 commit into
sipeed:mainfrom
MrTreasure:feat/dashscope-tts-weixin-audio
Closed

feat: add DashScope TTS provider and WeChat audio file sending#3270
MrTreasure wants to merge 1 commit into
sipeed:mainfrom
MrTreasure:feat/dashscope-tts-weixin-audio

Conversation

@MrTreasure

Copy link
Copy Markdown

Summary

This PR adds DashScope (Bailian) TTS support and WeChat audio file sending to picoclaw.

Changes

1. DashScope TTS Provider (pkg/audio/tts/dashscope_tts.go — new file)

A complete TTS provider for Alibaba Cloud DashScope/Bailian platform:

  • Calls DashScope aigc/multimodal-generation/generation API
  • Supports qwen3-tts-flash and other DashScope TTS models
  • Auto-extracts workspace ID from Bailian MAAS base URL
  • Downloads generated audio from OSS URL
  • Returns WAV audio stream compatible with existing send_tts tool

2. TTS Provider Routing (pkg/audio/tts/tts.go)

Adds case "dashscope" to providerFromModelConfig:

  • Extracts voice config from extra_body
  • Resolves workspace ID from api_base or default DashScope base URL

3. WeChat Audio Support (pkg/channels/weixin/media.go)

  • outboundMediaKind: Detects audio/* MIME types and common audio extensions — routes as file attachment
  • sendUploadedMedia: Adds UploadMediaTypeVoice case with VoiceItem (forward-looking)
  • tryTranscodeAudioToSilk: ffmpeg PCM decode + silk_encoder -tencent → WeChat SILK

Platform Limitation

WeChat iLink bot API silently drops outbound VoiceItem messages. Audio is routed as file attachment which works reliably. SILK transcode + VoiceItem code paths preserved for future.

🤖 Generated with Claude Code

@CLAassistant

CLAassistant commented Jul 20, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

- Add DashScopeTTSProvider for Bailian/DashScope TTS API
  - Supports qwen3-tts-flash and other DashScope TTS models
  - Auto-extracts workspace ID from Bailian MAAS base URL
  - Downloads audio from OSS and returns WAV stream
  - Integrates with existing provider framework via 'dashscope' protocol

- Add audio type detection in WeChat outboundMediaKind
  - Detects audio/* MIME types and common audio file extensions
  - Routes audio as file attachment (WeChat iLink bots cannot send
    native voice bubbles - server-side limitation)

- Add tryTranscodeAudioToSilk helper for WeChat voice transcoding
  - ffmpeg decode to 24kHz mono PCM → silk_encoder -tencent SILK
  - Ready for future use when WeChat lifts voice bubble restriction

- Add UploadMediaTypeVoice / VoiceItem support in sendUploadedMedia
  - Forward-looking: VoiceItem structure is accepted by iLink API
    but silently dropped on delivery (platform limitation)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

This PR has had no activity for 7 days and has been marked as stale. If you are still working on it, please push an update or leave a comment; otherwise it will be closed automatically in 7 days.

@MrTreasure

Copy link
Copy Markdown
Author

Status update: this change is still actively maintained and remains needed for the WeChat deployment. I have rechecked the affected DashScope TTS, configuration, and WeChat audio delivery paths against the current upstream master; the targeted configuration and WeChat package tests pass locally. The branch is mergeable, and I am available to address review feedback or make any requested API adjustments.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

This PR has had no activity for 7 days and has been marked as stale. If you are still working on it, please push an update or leave a comment; otherwise it will be closed automatically in 7 days.

@github-actions

Copy link
Copy Markdown

This PR has been closed after 14 days of inactivity. If you would like to continue, feel free to reopen it or submit a new PR.

@github-actions github-actions Bot closed this Aug 14, 2026
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.

2 participants