Browse Source

fix: tts voice base url

master
zhayujie 11 months ago
parent
commit
e5ba26febe
2 changed files with 5 additions and 2 deletions
  1. +3
    -1
      bot/linkai/link_ai_bot.py
  2. +2
    -1
      voice/openai/openai_voice.py

+ 3
- 1
bot/linkai/link_ai_bot.py View File

@@ -94,7 +94,7 @@ class LinkAIBot(Bot):
file_id = context.kwargs.get("file_id")
if 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}

# do http request
@@ -120,6 +120,8 @@ class LinkAIBot(Bot):
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.start()
if response["choices"][0].get("text_content"):
reply_content = response["choices"][0].get("text_content")
return Reply(ReplyType.TEXT, reply_content)

else:


+ 2
- 1
voice/openai/openai_voice.py View File

@@ -33,7 +33,8 @@ class OpenaiVoice(Voice):

def textToVoice(self, text):
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 = {
'Authorization': 'Bearer ' + conf().get("open_ai_api_key"),
'Content-Type': 'application/json'


Loading…
Cancel
Save