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

第三方tts get请求格式问题 加号和&符号识别 #120

Closed
Commandement opened this issue Jun 22, 2024 · 1 comment
Closed

第三方tts get请求格式问题 加号和&符号识别 #120

Commandement opened this issue Jun 22, 2024 · 1 comment

Comments

@Commandement
Copy link

如题,我用了自己的tts,封装了一个api,前端的请求都正常,控制台也能收到tts请求,问题出在请求格式上。
我收到的请求格式如下:
GET /api/tts.mp3?speaker=mytts+text=你好
(音色名和内容是示例)
但是根据文档get请求头有两个部分,speaker和text,用加号连接两个部分text请求就没了。我根据文档说明写的api,接收到mi-gpt的请求会报错。我试过把+改成&就好了:
GET /api/tts.mp3?speaker=mytts&text=你好
请问这个问题怎么解决。。

@idootop
Copy link
Owner

idootop commented Jun 22, 2024

MiGPT 下发到小爱音箱的 URL 地址是正常的,
但是小爱音箱访问音频 URL 的时候会把 &text= 转义成 +text=
所以你需要自己手动处理一下: url=url.replace('+text=','&text=')

@idootop idootop closed this as completed Jun 22, 2024
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

No branches or pull requests

2 participants