from sentence_transformers import SentenceTransformer from sklearn.cluster import KMeans from memory_utils import get_history, decrypt_data import numpy as np class QuantumLearner: def __init__(self): # Koristimo lightweight multi-jezički model self.model = SentenceTransformer('paraphrase-multilingual-MiniLM-L12-v2') self.model.max_seq_length = 256 # Optimizacija za performanse def analyze_conversations(self, history_limit=1000): """Analizira razgovore i pronalazi ključne teme""" try: history = get_history(limit=history_limit) if not history: return {"info": "Nema dostupne povijesti za analizu"} # Dekriptiraj i kombinuj poruke texts = [ f"{decrypt_data(row[2])} → {decrypt_data(row[3])}" for row in history if len(row) >= 4 # Zaštita od nepotpunih podataka ] # Vektorizacija teksta