Skip to content

Add MiniMax text to speech support to the speech generation path - #9825

Open
octo-patch wants to merge 1 commit into
jeecgboot:mainfrom
octo-patch:octo/20260817-tts-tool-recvs9cyueOuXF
Open

Add MiniMax text to speech support to the speech generation path#9825
octo-patch wants to merge 1 commit into
jeecgboot:mainfrom
octo-patch:octo/20260817-tts-tool-recvs9cyueOuXF

Conversation

@octo-patch

Copy link
Copy Markdown

Reason: add MiniMax text to speech support to the existing speech generation path

Summary

  • Route the existing speech generation helper to the MiniMax text to audio operation when
    jeecg.ai-chat.ai-model-voice.provider is MINIMAX, keeping the current OpenAI compatible
    /audio/speech branch as the default so the voice module and the video dubbing caller are unchanged.
  • Add MiniMaxVoiceApi with the regional /v1/t2a_v2 endpoints, the accepted speech models and the
    default model, the documented request fields (model, text, stream, output_format,
    voice_setting, audio_setting) and Bearer authorization.
  • Parse the json response instead of streaming raw bytes: validate base_resp.status_code, then decode
    the hex encoded data.audio payload and write it to the target file, reporting data.status when no
    audio is returned.
  • Accept every configured api host shape (bare regional host, host carrying the version segment, or the
    full operation url) so the endpoint is taken from configuration rather than assumed, and clamp the
    configured speed and decibel volume gain into the ranges the operation accepts.

Changes

  • jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/voice/util/MiniMaxVoiceApi.java (new)
  • jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/voice/util/VoiceApiHelper.java
  • jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/test/java/org/jeecg/modules/airag/voice/util/MiniMaxVoiceApiTest.java (new)

Verification

  • javac compile of the changed speech sources together with AiChatConfig on Java 21: passed.
  • MiniMaxVoiceApiTest on the JUnit 5 console launcher: 16 tests passed. The suite drives
    VoiceApiHelper.generateAudio end to end against a local http server and asserts the request path,
    the Bearer header, the request body fields, and that the decoded audio bytes reach the output file.
    It also covers a failed base_resp.status_code, a non 200 response, malformed hex payloads, and a
    regression test that a non MiniMax provider still calls /audio/speech.
  • Maven could not resolve the full reactor in this environment, so the module build was not run and is
    not claimed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant