cambios menores

This commit is contained in:
Your Name
2025-02-09 07:56:49 +01:00
parent f1632aa899
commit 94da85702f
2 changed files with 0 additions and 7 deletions

View File

@ -34,7 +34,6 @@ def create_news_item(item: NewsItemCreate, db: Session = Depends(get_db)):
existing_item = db.query(NewsItem).filter(NewsItem.titulo == item.titulo).first()
if existing_item:
logging.info("Título ya en la base de datos")
raise HTTPException(status_code=400, detail="El título ya existe en la base de datos")
# Crear nuevo objeto
new_item = NewsItem(

View File

@ -16,7 +16,6 @@ OLLAMA_URL = os.environ.get("OLLAMA_URL", "http://host.docker.internal:11434/api
OLLAMA_MODEL = os.environ.get("OLLAMA_MODEL", "llama3")
def is_security_related(prompt):
logging.info(f"Checking if topic is security-related: {prompt}")
data = {
"model": OLLAMA_MODEL,
"prompt": f"Does the following topic relate to national defense, armed forces, police, espionage, or intelligence? Answer only with 'true' or 'false'. Topic: {prompt}",
@ -30,7 +29,6 @@ def is_security_related(prompt):
json_data = json.loads(line)
if "response" in json_data and json_data["response"].strip():
result = json_data["response"].strip().lower() == "true"
logging.info(f"Result for '{prompt}': {result}")
return result
except requests.RequestException as e:
@ -41,7 +39,6 @@ def is_security_related(prompt):
return False
def is_critico(prompt):
logging.info(f"Checking if topic is critical of security forces: {prompt}")
data = {
"model": OLLAMA_MODEL,
"prompt": f"Does the following text criticizes the armed forces, security forces as Guardia Civil or Police, intelligence agencies such as CNI? Answer only with 'true' or 'false'. Topic: {prompt}",
@ -55,7 +52,6 @@ def is_critico(prompt):
json_data = json.loads(line)
if "response" in json_data and json_data["response"].strip():
result = json_data["response"].strip().lower() == "true"
logging.info(f"Result for '{prompt}': {result}")
return result
except requests.RequestException as e:
@ -66,7 +62,6 @@ def is_critico(prompt):
return False
def is_favorable(prompt):
logging.info(f"Checking if topic is favorable to security forces: {prompt}")
data = {
"model": OLLAMA_MODEL,
"prompt": f"Does the following text favor the armed forces, security forces as Guardia Civil or Police, intelligence agencies such as CNI? Answer only with 'true' or 'false'. Topic: {prompt}",
@ -80,7 +75,6 @@ def is_favorable(prompt):
json_data = json.loads(line)
if "response" in json_data and json_data["response"].strip():
result = json_data["response"].strip().lower() == "true"
logging.info(f"Result for '{prompt}': {result}")
return result
except requests.RequestException as e: