token file now fully optional

This commit is contained in:
Falko Victor Habel 2024-10-22 16:52:07 +02:00
parent 2fe50b41f8
commit 88b8e3d279
1 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,5 @@
from langchain_community.llms import Ollama
import os
class ArticleRater:
def __init__(self):
@ -8,8 +8,12 @@ class ArticleRater:
self.headers = {"Authorization": f"Token {self.token}"}
def _get_token(self):
with open("Token/Token.txt", "r") as t:
return t.readline().strip()
if os.path.exists("Token/Token.txt"):
with open("Token/Token.txt", "r") as t:
return t.readline().strip()
else:
return None
def get_response(self, article, result, confidence):
ollama_params = {
"base_url": self.client,