diff --git a/bot/linkai/link_ai_bot.py b/bot/linkai/link_ai_bot.py index f308370..cd743b4 100644 --- a/bot/linkai/link_ai_bot.py +++ b/bot/linkai/link_ai_bot.py @@ -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: diff --git a/bot/xunfei/xunfei_spark_bot.py b/bot/xunfei/xunfei_spark_bot.py index ed441bf..395d81e 100644 --- a/bot/xunfei/xunfei_spark_bot.py +++ b/bot/xunfei/xunfei_spark_bot.py @@ -40,10 +40,13 @@ class XunFeiBot(Bot): self.app_id = conf().get("xunfei_app_id") self.api_key = conf().get("xunfei_api_key") self.api_secret = conf().get("xunfei_api_secret") - # 默认使用v3.0版本,2.0版本可设置为generalv2, 1.5版本可设置为 general - self.domain = "generalv2" - # 默认使用v3.0版本,1.5版本可设置为 "ws://spark-api.xf-yun.com/v1.1/chat", - # 2.0版本可设置为 "ws://spark-api.xf-yun.com/v2.1/chat" + # 默认使用v2.0版本: "generalv2" + # v1.5版本为 "general" + # v3.0版本为: "generalv3" + self.domain = "generalv3" + # 默认使用v2.0版本: "ws://spark-api.xf-yun.com/v2.1/chat" + # v1.5版本为: "ws://spark-api.xf-yun.com/v1.1/chat" + # v3.0版本为: "ws://spark-api.xf-yun.com/v3.1/chat" self.spark_url = "ws://spark-api.xf-yun.com/v3.1/chat" self.host = urlparse(self.spark_url).netloc self.path = urlparse(self.spark_url).path diff --git a/lib/itchat/LICENSE b/lib/itchat/LICENSE new file mode 100644 index 0000000..ba1a0e2 --- /dev/null +++ b/lib/itchat/LICENSE @@ -0,0 +1,9 @@ +**The MIT License (MIT)** + +Copyright (c) 2017 LittleCoder ([littlecodersh@Github](https://github.com/littlecodersh)) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/voice/openai/openai_voice.py b/voice/openai/openai_voice.py index 2dd3cbe..767353e 100644 --- a/voice/openai/openai_voice.py +++ b/voice/openai/openai_voice.py @@ -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'