diff --git a/bot.py b/bot.py index a78f7f0..4b143ad 100644 --- a/bot.py +++ b/bot.py @@ -474,7 +474,7 @@ class Bot: parts = [] for e in doc_entries: label = {"pdf": "PDF", "image": "Bild", "text": "Datei"}.get(e["type"], "Dokument") - text = e["text"][:10000] if e["type"] != "image" else e["text"][:2000] + text = e["text"][:40000] if e["type"] != "image" else e["text"][:2000] parts.append(f"[{label}: {e['filename']}]\n{text}") document_context = "\n\n".join(parts) logger.info("Passing %d document context(s) to voice session (%d chars total)", @@ -786,6 +786,7 @@ class Bot: logger.info("Translation check: detected=%s, preferred=%s, len=%d", detected_lang, preferred_lang, len(body)) if ( detected_lang != "Unknown" + and len(detected_lang) < 30 # sanity check: language name, not a sentence and detected_lang.lower() != preferred_lang.lower() and len(body) > 10 # skip very short messages ): diff --git a/voice.py b/voice.py index d6db7df..3bc382f 100644 --- a/voice.py +++ b/voice.py @@ -700,7 +700,7 @@ class VoiceSession: instructions = _build_voice_prompt(model=self.model, timezone=user_timezone) + memory_section if self._document_context: - instructions += f"\n\nDokument-Kontext (PDF im Raum hochgeladen):\n{self._document_context}" + instructions += f"\n\nDokument-Kontext (im Raum hochgeladen):\n{self._document_context}" agent = _NoiseFilterAgent( instructions=instructions, tools=[search_web, set_user_timezone],