chore: rimuove emoji da codice e output terminale

Sostituisce tutti i simboli grafici con testo:
- checkmark/cross -> OK / ERRORE: / AVVISO:
- icone tema GUI -> testo Chiaro / Scuro

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 09:57:24 +02:00
parent 91d20da120
commit ba8035887c
5 changed files with 31 additions and 31 deletions
+1 -1
View File
@@ -226,7 +226,7 @@ function addMessage(role, content, sources) {
const doc = s.source || '';
const path = s.header_path || '';
chip.innerHTML = path
? `<span class="src-doc">${esc(doc)}</span> <span class="src-path">${esc(path)}</span>`
? `<span class="src-doc">${esc(doc)}</span> &gt; <span class="src-path">${esc(path)}</span>`
: `<span class="src-doc">${esc(doc)}</span>`;
srcDiv.appendChild(chip);
});
+7 -7
View File
@@ -46,8 +46,8 @@ _THEMES = {
padding:8px 12px; font-size:14px;
}
""",
"theme_btn": "background:#2a2a2a; color:#ececec; border:1px solid #3a3a3a; border-radius:6px; font-size:16px; padding:4px 8px;",
"icon": "☀️",
"theme_btn": "background:#2a2a2a; color:#ececec; border:1px solid #3a3a3a; border-radius:6px; font-size:12px; font-weight:600; padding:4px 8px;",
"icon": "Chiaro",
},
"light": {
"topbar": "background:#f5f5f5; border-bottom:1px solid #e0e0e0;",
@@ -72,8 +72,8 @@ _THEMES = {
padding:8px 12px; font-size:14px;
}
""",
"theme_btn": "background:#fff; color:#1a1a1a; border:1px solid #ddd; border-radius:6px; font-size:16px; padding:4px 8px;",
"icon": "🌙",
"theme_btn": "background:#fff; color:#1a1a1a; border:1px solid #ddd; border-radius:6px; font-size:12px; font-weight:600; padding:4px 8px;",
"icon": "Scuro",
},
}
@@ -130,7 +130,7 @@ class ChatWindow(QMainWindow):
tl.addStretch()
self._theme_btn = QPushButton()
self._theme_btn.setFixedSize(36, 30)
self._theme_btn.setFixedSize(60, 30)
self._theme_btn.setToolTip("Cambia tema")
self._theme_btn.clicked.connect(self._toggle_theme)
tl.addWidget(self._theme_btn)
@@ -212,7 +212,7 @@ class ChatWindow(QMainWindow):
if not question:
return
if not self._collection:
self._js("addMessage('assistant', '⚠️ Seleziona una collezione prima di inviare.', [])")
self._js("addMessage('assistant', 'Seleziona una collezione prima di inviare.', [])")
return
self._input.clear()
@@ -236,7 +236,7 @@ class ChatWindow(QMainWindow):
def _on_error(self, msg: str) -> None:
self._js("removeThinking()")
self._js(f"addMessage('assistant', {json.dumps('Errore: ' + msg)}, [])")
self._js(f"addMessage('assistant', {json.dumps('Errore: ' + msg)}, [])")
self._set_enabled(True)
# ── Helpers ───────────────────────────────────────────────────────────────
+14 -14
View File
@@ -83,13 +83,13 @@ def check_ollama(model: str) -> bool:
for m in models
)
if found:
print(f"Ollama OK — {model} disponibile")
print(f"Ollama OK — {model} disponibile")
return True
print(f" Modello {model} non trovato in Ollama")
print(f"ERRORE: Modello {model} non trovato in Ollama")
print(f" → ollama pull {model}")
return False
except (urllib.error.URLError, OSError):
print(" Ollama non raggiungibile — assicurati che sia in esecuzione")
print("ERRORE: Ollama non raggiungibile — assicurati che sia in esecuzione")
print(" → ollama serve")
return False
@@ -116,18 +116,18 @@ def _ingest_stem(stem: str, collection: chromadb.Collection,
"""
chunks_path = CHUNKS_DIR / stem / "chunks.json"
if not chunks_path.exists():
print(f" File non trovato: {chunks_path}")
print(f"ERRORE: File non trovato: {chunks_path}")
return 0
with open(chunks_path, encoding="utf-8") as f:
chunks = json.load(f)
if not chunks:
print(f"⚠️ {stem}: chunks.json è vuoto — skip")
print(f"AVVISO: {stem}: chunks.json e' vuoto — skip")
return 0
total = len(chunks)
print(f" 📄 {stem}: {total} chunk\n")
print(f" {stem}: {total} chunk\n")
ids = []
embeddings = []
@@ -167,7 +167,7 @@ def _ingest_stem(stem: str, collection: chromadb.Collection,
eta = int(avg * (total - i))
done = f"[{offset + i:>6}/{offset + total}]"
cid = chunk["chunk_id"][:40]
print(f" {done} {stem}/{cid:<40} ETA: {eta}s", end="\r", flush=True)
print(f" {done} {stem}/{cid:<40} ETA: {eta}s", end="\r", flush=True)
if len(ids) == 100:
collection.add(ids=ids, embeddings=embeddings,
@@ -180,7 +180,7 @@ def _ingest_stem(stem: str, collection: chromadb.Collection,
elapsed = int(time.monotonic() - start)
print()
print(f" {stem}: {total} chunk in {elapsed}s")
print(f" OK {stem}: {total} chunk in {elapsed}s")
return total
@@ -200,11 +200,11 @@ def ingest_multi(stems: list[str], collection_name: str,
if collection_exists(client, collection_name):
if not force:
print(f"⚠️ Collection '{collection_name}' già presente in ChromaDB — skip")
print(f"AVVISO: Collection '{collection_name}' gia' presente in ChromaDB — skip")
print(f" → usa --force per sovrascrivere")
return True
client.delete_collection(collection_name)
print(f"🗑️ Collection '{collection_name}' rimossa (--force)")
print(f"Collection '{collection_name}' rimossa (--force)")
collection = client.create_collection(
name=collection_name,
@@ -218,7 +218,7 @@ def ingest_multi(stems: list[str], collection_name: str,
return False
total_chunks += n
print(f"\n Collection '{collection_name}': {total_chunks} chunk totali")
print(f"\nOK Collection '{collection_name}': {total_chunks} chunk totali")
print(f" Documenti: {', '.join(stems)}")
print(f" Percorso: {CHROMA_DIR}/")
return True
@@ -266,10 +266,10 @@ def main() -> int:
# ── Modalità multi-documento ─────────────────────────────────────────────
if args.stems or args.collection:
if not args.stems:
print(" --collection richiede --stems (es. --stems doc1 doc2 doc3)")
print("ERRORE: --collection richiede --stems (es. --stems doc1 doc2 doc3)")
return 1
if not args.collection:
print(" --stems richiede --collection (es. --collection archivio)")
print("ERRORE: --stems richiede --collection (es. --collection archivio)")
return 1
print(f" Collection : {args.collection}")
print(f" Documenti : {', '.join(args.stems)}\n")
@@ -280,7 +280,7 @@ def main() -> int:
# ── Modalità singolo / tutti ─────────────────────────────────────────────
stems = [args.stem] if args.stem else find_stems()
if not stems:
print(" Nessun chunks.json trovato in chunks/")
print("ERRORE: Nessun chunks.json trovato in chunks/")
return 1
results = []
+5 -5
View File
@@ -133,7 +133,7 @@ def answer(question: str, collection: chromadb.Collection, verbose: bool) -> Non
try:
chunks = retrieve(collection, question)
except (urllib.error.URLError, OSError) as e:
print(f"❌ Errore embedding: {e}")
print(f"ERRORE embedding: {e}")
return
if verbose:
@@ -151,7 +151,7 @@ def answer(question: str, collection: chromadb.Collection, verbose: bool) -> Non
try:
response = call_ollama(prompt, system=system)
except (urllib.error.URLError, OSError) as e:
print(f"❌ Errore generazione: {e}")
print(f"ERRORE generazione: {e}")
return
print(f"\n{response}\n")
@@ -234,13 +234,13 @@ def main() -> int:
print()
if not CHROMA_DIR.exists():
print(" chroma_db/ non trovata — esegui prima ingestion")
print("ERRORE: chroma_db/ non trovata — esegui prima ingestion")
return 1
client = chromadb.PersistentClient(path=str(CHROMA_DIR))
collections = [c.name for c in client.list_collections()]
if collection_name not in collections:
print(f" Collection '{collection_name}' non trovata in chroma_db/")
print(f"ERRORE: Collection '{collection_name}' non trovata in chroma_db/")
if args.stem:
print(f" → python ingestion/ingest.py --stem {collection_name}")
else:
@@ -248,7 +248,7 @@ def main() -> int:
return 1
collection = client.get_collection(collection_name)
print(f" Collection '{collection_name}' caricata ({collection.count()} chunk)\n")
print(f"OK Collection '{collection_name}' caricata ({collection.count()} chunk)\n")
run_loop(collection)
return 0
+4 -4
View File
@@ -134,7 +134,7 @@ def run_loop(collection: chromadb.Collection, top_k: int) -> None:
try:
chunks = retrieve(collection, query, top_k)
except (urllib.error.URLError, OSError) as e:
print(f"❌ Errore embedding (Ollama raggiungibile?): {e}\n")
print(f"ERRORE embedding (Ollama raggiungibile?): {e}\n")
continue
print()
@@ -204,13 +204,13 @@ def main() -> int:
print()
if not CHROMA_DIR.exists():
print(" chroma_db/ non trovata — esegui prima ingestion", file=sys.stderr)
print("ERRORE: chroma_db/ non trovata — esegui prima ingestion", file=sys.stderr)
return 1
client = chromadb.PersistentClient(path=str(CHROMA_DIR))
collections = [c.name for c in client.list_collections()]
if collection_name not in collections:
print(f" Collection '{collection_name}' non trovata in chroma_db/", file=sys.stderr)
print(f"ERRORE: Collection '{collection_name}' non trovata in chroma_db/", file=sys.stderr)
if args.stem:
print(f" → python ingestion/ingest.py --stem {collection_name}", file=sys.stderr)
else:
@@ -218,7 +218,7 @@ def main() -> int:
return 1
collection = client.get_collection(collection_name)
print(f" Collection '{collection_name}' caricata ({collection.count()} chunk)\n")
print(f"OK Collection '{collection_name}' caricata ({collection.count()} chunk)\n")
run_loop(collection, args.top_k)
return 0