Обновить Backend/model.py
This commit is contained in:
parent
682f68b319
commit
68632a7ad1
@ -246,8 +246,6 @@ llm_large = CustomMistralLLM(
|
|||||||
# Funkcia na klasifikáciu dopytu: vyhladavanie vs. upresnenie alebo update informácií
|
# Funkcia na klasifikáciu dopytu: vyhladavanie vs. upresnenie alebo update informácií
|
||||||
###############################################################################
|
###############################################################################
|
||||||
def classify_query(query: str, chat_history: str = "") -> str:
|
def classify_query(query: str, chat_history: str = "") -> str:
|
||||||
# Ak v histórii sa nachádza výzva na zadanie údajov a query obsahuje číslice (napr. vek),
|
|
||||||
# považujeme to za odpoveď na doplnenie informácií.
|
|
||||||
if "Prosím, uveďte vek pacienta" in chat_history and re.search(r"\d+\s*(rok(ov|y)?|years?)", query.lower()):
|
if "Prosím, uveďte vek pacienta" in chat_history and re.search(r"\d+\s*(rok(ov|y)?|years?)", query.lower()):
|
||||||
return "update"
|
return "update"
|
||||||
if not chat_history.strip():
|
if not chat_history.strip():
|
||||||
@ -379,7 +377,6 @@ CHAT_HISTORY_ENDPOINT = "http://localhost:5000/api/chat_history_detail"
|
|||||||
def process_query_with_mistral(query: str, chat_id: str, chat_context: str, k=10):
|
def process_query_with_mistral(query: str, chat_id: str, chat_context: str, k=10):
|
||||||
logger.info("Processing query started.")
|
logger.info("Processing query started.")
|
||||||
|
|
||||||
# Načítame históriu chatu
|
|
||||||
chat_history = ""
|
chat_history = ""
|
||||||
if chat_context:
|
if chat_context:
|
||||||
chat_history = chat_context
|
chat_history = chat_context
|
||||||
|
Loading…
Reference in New Issue
Block a user