From e4ba651dfd5b5b8cd4f2480e89b49d4b43debbb8 Mon Sep 17 00:00:00 2001 From: taylor Date: Sun, 13 Oct 2024 17:51:31 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=B7=BB=E5=8A=A0ollama=E8=B0=83?= =?UTF-8?q?=E7=94=A8AI=20chat=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maubot_llmplus/local_paltform.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/maubot_llmplus/local_paltform.py b/maubot_llmplus/local_paltform.py index d1d7cd8..2c2beca 100644 --- a/maubot_llmplus/local_paltform.py +++ b/maubot_llmplus/local_paltform.py @@ -27,6 +27,7 @@ class Ollama(Platform): headers = {} if self.api_key is not None: headers['Authorization'] = self.api_key + headers['Content-Type'] = 'application/json' plugin.log.debug(f"{json.dumps(req_body)}") async with self.http.post(endpoint, headers=headers, data=json.dumps(req_body)) as response: plugin.log.debug(f"响应内容:{response.status}, {response.json()}") @@ -36,11 +37,11 @@ class Ollama(Platform): finish_reason=f"http status {response.status}", model=None ) - response_json = await response.json() + response_json = response.json() return ChatCompletion( message=response_json['message'], finish_reason='success', - model=response_json.get('model', None) + model=response_json['model'] ) def get_type(self) -> str: