add: 添加ollama调用AI chat逻辑

This commit is contained in:
taylor
2024-10-13 17:32:06 +08:00
parent e75406e3d6
commit 82a47c881f
2 changed files with 3 additions and 0 deletions

View File

@@ -27,7 +27,9 @@ class Ollama(Platform):
headers = {}
if self.api_key is not None:
headers['Authorization'] = self.api_key
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()}")
if response.status != 200:
return ChatCompletion(
message={},