token file now fully optional
This commit is contained in:
parent
2fe50b41f8
commit
88b8e3d279
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue