This commit is contained in:
Lars committed 2025-12-27 19:12:14 +01:00
1 parent e045371969
commit 37ec8b614e
3 files changed
+59 -45

No files matched your search

+6 -6
View File
@@ -6,11 +6,11 @@ DESCRIPTION: Hybrid-Client für Ollama, Google GenAI (Gemini) und OpenRouter.
WP-20 Fix: Bulletproof Prompt-Auflösung für format() Aufrufe.
WP-22/JSON: Optionales JSON-Schema + strict (für OpenRouter structured outputs).
FIX: Intelligente Rate-Limit Erkennung (429 Handling), v1-API Sync & Timeouts.
VERSION: 3.3.8
VERSION: 3.3.9
STATUS: Active
FIX:
- Integriert clean_llm_text zur Entfernung von Steuerzeichen (<s>, [OUT] etc.) in Antworten.
- Stellt sicher, dass Chat-Antworten sauber formatiert ausgegeben werden.
- Importiert clean_llm_text von app.core.registry zur Vermeidung von Circular Imports.
- Wendet clean_llm_text auf Text-Antworten in generate_raw_response an.
"""
import httpx
import yaml
@@ -24,8 +24,8 @@ from pathlib import Path
from typing import Optional, Dict, Any, Literal
from app.config import get_settings
# Import der zentralen Bereinigungs-Logik (WP-14 Fix)
from app.core.ingestion.ingestion_utils import clean_llm_text
# ENTSCHEIDENDER FIX: Import der neutralen Bereinigungs-Logik (WP-14)
from app.core.registry import clean_llm_text
logger = logging.getLogger(__name__)
@@ -140,6 +140,7 @@ class LLMService:
max_retries, base_delay, model_override,
json_schema, json_schema_name, strict_json_schema
)
# WP-14 Fix: Bereinige Text-Antworten vor Rückgabe
return clean_llm_text(res) if not force_json else res
async def _dispatch(
@@ -212,7 +213,6 @@ class LLMService:
config = types.GenerateContentConfig(
system_instruction=system,
# WICHTIG: Gemini 1.5+ unterstützt response_mime_type nativ
response_mime_type="application/json" if force_json else "text/plain"
)
response = await asyncio.wait_for(