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:
+14
-14
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user