|
@@ -22,7 +22,6 @@ class LinkAIBot(Bot, OpenAIImage): |
|
|
|
|
|
|
|
|
def __init__(self): |
|
|
def __init__(self): |
|
|
super().__init__() |
|
|
super().__init__() |
|
|
self.base_url = "https://api.link-ai.chat/v1" |
|
|
|
|
|
self.sessions = SessionManager(ChatGPTSession, model=conf().get("model") or "gpt-3.5-turbo") |
|
|
self.sessions = SessionManager(ChatGPTSession, model=conf().get("model") or "gpt-3.5-turbo") |
|
|
|
|
|
|
|
|
def reply(self, query, context: Context = None) -> Reply: |
|
|
def reply(self, query, context: Context = None) -> Reply: |
|
@@ -83,7 +82,8 @@ class LinkAIBot(Bot, OpenAIImage): |
|
|
headers = {"Authorization": "Bearer " + linkai_api_key} |
|
|
headers = {"Authorization": "Bearer " + linkai_api_key} |
|
|
|
|
|
|
|
|
# do http request |
|
|
# do http request |
|
|
res = requests.post(url=self.base_url + "/chat/completions", json=body, headers=headers, |
|
|
|
|
|
|
|
|
base_url = conf().get("linkai_api_base", "https://api.link-ai.chat") |
|
|
|
|
|
res = requests.post(url=base_url + "/v1/chat/completions", json=body, headers=headers, |
|
|
timeout=conf().get("request_timeout", 180)) |
|
|
timeout=conf().get("request_timeout", 180)) |
|
|
if res.status_code == 200: |
|
|
if res.status_code == 200: |
|
|
# execute success |
|
|
# execute success |
|
|