ソースを参照

feat: update service url

master
zhayujie 7ヶ月前
コミット
4db19f816f
5個のファイルの変更9行の追加9行の削除
  1. +4
    -4
      bot/linkai/link_ai_bot.py
  2. +1
    -1
      config.py
  3. +1
    -1
      plugins/linkai/midjourney.py
  4. +1
    -1
      plugins/linkai/summary.py
  5. +2
    -2
      voice/linkai/linkai_voice.py

+ 4
- 4
bot/linkai/link_ai_bot.py ファイルの表示

@@ -122,7 +122,7 @@ class LinkAIBot(Bot):
headers = {"Authorization": "Bearer " + linkai_api_key}

# do http request
base_url = conf().get("linkai_api_base", "https://api.link-ai.chat")
base_url = conf().get("linkai_api_base", "https://api.link-ai.tech")
res = requests.post(url=base_url + "/v1/chat/completions", json=body, headers=headers,
timeout=conf().get("request_timeout", 180))
if res.status_code == 200:
@@ -261,7 +261,7 @@ class LinkAIBot(Bot):
headers = {"Authorization": "Bearer " + conf().get("linkai_api_key")}

# do http request
base_url = conf().get("linkai_api_base", "https://api.link-ai.chat")
base_url = conf().get("linkai_api_base", "https://api.link-ai.tech")
res = requests.post(url=base_url + "/v1/chat/completions", json=body, headers=headers,
timeout=conf().get("request_timeout", 180))
if res.status_code == 200:
@@ -304,7 +304,7 @@ class LinkAIBot(Bot):
def _fetch_app_info(self, app_code: str):
headers = {"Authorization": "Bearer " + conf().get("linkai_api_key")}
# do http request
base_url = conf().get("linkai_api_base", "https://api.link-ai.chat")
base_url = conf().get("linkai_api_base", "https://api.link-ai.tech")
params = {"app_code": app_code}
res = requests.get(url=base_url + "/v1/app/info", params=params, headers=headers, timeout=(5, 10))
if res.status_code == 200:
@@ -326,7 +326,7 @@ class LinkAIBot(Bot):
"response_format": "url",
"img_proxy": conf().get("image_proxy")
}
url = conf().get("linkai_api_base", "https://api.link-ai.chat") + "/v1/images/generations"
url = conf().get("linkai_api_base", "https://api.link-ai.tech") + "/v1/images/generations"
res = requests.post(url, headers=headers, json=data, timeout=(5, 90))
t2 = time.time()
image_url = res.json()["data"][0]["url"]


+ 1
- 1
config.py ファイルの表示

@@ -163,7 +163,7 @@ available_setting = {
"use_linkai": False,
"linkai_api_key": "",
"linkai_app_code": "",
"linkai_api_base": "https://api.link-ai.chat", # linkAI服务地址,若国内无法访问或延迟较高可改为 https://api.link-ai.tech
"linkai_api_base": "https://api.link-ai.tech", # linkAI服务地址
}




+ 1
- 1
plugins/linkai/midjourney.py ファイルの表示

@@ -68,7 +68,7 @@ class MJTask:
# midjourney bot
class MJBot:
def __init__(self, config):
self.base_url = conf().get("linkai_api_base", "https://api.link-ai.chat") + "/v1/img/midjourney"
self.base_url = conf().get("linkai_api_base", "https://api.link-ai.tech") + "/v1/img/midjourney"
self.headers = {"Authorization": "Bearer " + conf().get("linkai_api_key")}
self.config = config
self.tasks = {}


+ 1
- 1
plugins/linkai/summary.py ファイルの表示

@@ -61,7 +61,7 @@ class LinkSummary:
return None

def base_url(self):
return conf().get("linkai_api_base", "https://api.link-ai.chat")
return conf().get("linkai_api_base", "https://api.link-ai.tech")

def headers(self):
return {"Authorization": "Bearer " + conf().get("linkai_api_key")}


+ 2
- 2
voice/linkai/linkai_voice.py ファイルの表示

@@ -19,7 +19,7 @@ class LinkAIVoice(Voice):
def voiceToText(self, voice_file):
logger.debug("[LinkVoice] voice file name={}".format(voice_file))
try:
url = conf().get("linkai_api_base", "https://api.link-ai.chat") + "/v1/audio/transcriptions"
url = conf().get("linkai_api_base", "https://api.link-ai.tech") + "/v1/audio/transcriptions"
headers = {"Authorization": "Bearer " + conf().get("linkai_api_key")}
model = None
if not conf().get("text_to_voice") or conf().get("voice_to_text") == "openai":
@@ -54,7 +54,7 @@ class LinkAIVoice(Voice):

def textToVoice(self, text):
try:
url = conf().get("linkai_api_base", "https://api.link-ai.chat") + "/v1/audio/speech"
url = conf().get("linkai_api_base", "https://api.link-ai.tech") + "/v1/audio/speech"
headers = {"Authorization": "Bearer " + conf().get("linkai_api_key")}
model = const.TTS_1
if not conf().get("text_to_voice") or conf().get("text_to_voice") in ["openai", const.TTS_1, const.TTS_1_HD]:


読み込み中…
キャンセル
保存