Ver código fonte

Merge branch 'zhayujie:master' into master

develop
跃迁 GitHub 11 meses atrás
pai
commit
6b30dced43
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados ID da chave GPG: 4AEE18F83AFDEB23
4 arquivos alterados com 21 adições e 6 exclusões
  1. +3
    -1
      bot/linkai/link_ai_bot.py
  2. +7
    -4
      bot/xunfei/xunfei_spark_bot.py
  3. +9
    -0
      lib/itchat/LICENSE
  4. +2
    -1
      voice/openai/openai_voice.py

+ 3
- 1
bot/linkai/link_ai_bot.py Ver arquivo

@@ -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:


+ 7
- 4
bot/xunfei/xunfei_spark_bot.py Ver arquivo

@@ -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


+ 9
- 0
lib/itchat/LICENSE Ver arquivo

@@ -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.

+ 2
- 1
voice/openai/openai_voice.py Ver arquivo

@@ -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'


Carregando…
Cancelar
Salvar