llm bugfix
This commit is contained in:
parent
103d2eee63
commit
d4c32c581d
|
@ -155,7 +155,7 @@ cython_debug/
|
|||
|
||||
#ML
|
||||
VeraMind-Mini/
|
||||
Token.txt
|
||||
Token.py
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
from langchain_community.llms import Ollama
|
||||
from Ai.Token import get_token
|
||||
|
||||
class ArticleRater:
|
||||
def __init__(self):
|
||||
self.client = "https://ai.fabelous.app/v1/ollama/generic"
|
||||
self.headers = self._load_token("Token.txt")
|
||||
|
||||
def _load_token(self, token_path):
|
||||
with open(token_path, "r") as f:
|
||||
token = f.read().strip()
|
||||
return {"Authorization": f"Token {token}"}
|
||||
self.headers = {"Authorization": f"Token {get_token()}"}
|
||||
|
||||
def get_response(self, article, result, confidence):
|
||||
ollama_params = {
|
||||
|
|
|
@ -8,8 +8,8 @@ from models.provider import Provider
|
|||
from collections import Counter
|
||||
from Ai.llm import ArticleRater
|
||||
|
||||
BAD_WORDS = ["FAKE", "SATIRE", "Fake", "fake", "fake news", "Fake News"]
|
||||
GOOD_WORDS = ["REAL", "real", "Real", "Reale News", "reale", "reale News", "realen"]
|
||||
BAD_WORDS = ["FAKE", "SATIRE", "Fake", "fake", "fake news", "Fake News", "FakeNews"]
|
||||
GOOD_WORDS = ["REAL", "real ", "Real", "Reale News", "reale", "reale News", "realen", "Real News"]
|
||||
BAD_COLOR = "#ff8080"
|
||||
GOOD_COLOR = "#80ff8f"
|
||||
WORDS = BAD_WORDS + GOOD_WORDS
|
||||
|
@ -122,7 +122,7 @@ class MainFrameController:
|
|||
:param text_data: TextData object containing the analyzed information
|
||||
"""
|
||||
|
||||
self.db.insert_data(url=text_data.url, anbieter=text_data.get_provider(),is_fake_news= text_data.is_fake_news)
|
||||
self.db.insert_data(url=text_data.url, anbieter=text_data.get_provider(), is_fake_news= text_data.is_fake_news)
|
||||
|
||||
def _fetch_db_data(self):
|
||||
self.text_data_list = []
|
||||
|
|
|
@ -50,10 +50,10 @@ class TextData:
|
|||
:return: The extracted domain or None if the URL is invalid
|
||||
"""
|
||||
if not self._is_valid_url(self.url):
|
||||
self.provider = "None"
|
||||
self.provider = "Unknown"
|
||||
parsed_url = urlparse(self.url)
|
||||
domain_parts = parsed_url.netloc.split('.')
|
||||
self.provider = f"{domain_parts[-2]}.{domain_parts[-1]}" if len(domain_parts) >= 2 else "None"
|
||||
self.provider = f"{domain_parts[-2]}.{domain_parts[-1]}" if len(domain_parts) >= 2 else "Unknown"
|
||||
|
||||
def _is_valid_url(self, url: str) -> bool:
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue