mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-03-19 21:38:18 +08:00
fix: tts voice base url
This commit is contained in:
@@ -94,7 +94,7 @@ class LinkAIBot(Bot):
|
|||||||
file_id = context.kwargs.get("file_id")
|
file_id = context.kwargs.get("file_id")
|
||||||
if file_id:
|
if file_id:
|
||||||
body["file_id"] = file_id
|
body["file_id"] = file_id
|
||||||
logger.info(f"[LINKAI] query={query}, app_code={app_code}, mode={body.get('model')}, file_id={file_id}")
|
logger.info(f"[LINKAI] query={query}, app_code={app_code}, model={body.get('model')}, file_id={file_id}")
|
||||||
headers = {"Authorization": "Bearer " + linkai_api_key}
|
headers = {"Authorization": "Bearer " + linkai_api_key}
|
||||||
|
|
||||||
# do http request
|
# do http request
|
||||||
@@ -120,6 +120,8 @@ class LinkAIBot(Bot):
|
|||||||
if response["choices"][0].get("img_urls"):
|
if response["choices"][0].get("img_urls"):
|
||||||
thread = threading.Thread(target=self._send_image, args=(context.get("channel"), context, response["choices"][0].get("img_urls")))
|
thread = threading.Thread(target=self._send_image, args=(context.get("channel"), context, response["choices"][0].get("img_urls")))
|
||||||
thread.start()
|
thread.start()
|
||||||
|
if response["choices"][0].get("text_content"):
|
||||||
|
reply_content = response["choices"][0].get("text_content")
|
||||||
return Reply(ReplyType.TEXT, reply_content)
|
return Reply(ReplyType.TEXT, reply_content)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ class OpenaiVoice(Voice):
|
|||||||
|
|
||||||
def textToVoice(self, text):
|
def textToVoice(self, text):
|
||||||
try:
|
try:
|
||||||
url = 'https://api.openai.com/v1/audio/speech'
|
api_base = conf().get("open_ai_api_base") or "https://api.openai.com/v1"
|
||||||
|
url = f'{api_base}/audio/speech'
|
||||||
headers = {
|
headers = {
|
||||||
'Authorization': 'Bearer ' + conf().get("open_ai_api_key"),
|
'Authorization': 'Bearer ' + conf().get("open_ai_api_key"),
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
|
|||||||
Reference in New Issue
Block a user