@@ -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"] | |||
@@ -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服务地址 | |||
} | |||
@@ -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 = {} | |||
@@ -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")} | |||
@@ -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]: | |||