v2.5 — Context-aware Portraits + DE→EN Translation
- Chat-Kontext wird in Portrait-Prompt einbezogen:
- Outfit-Änderungen ('umgezogen', 'Kleid', 'Hoodie' etc.)
- Posen ('lacht', 'schläft', 'sitzt' etc.)
- Szenen ('Café', 'Schlafzimmer', 'Nacht' etc.)
- I2I denoise steigt auf 0.55 bei Outfit-Wechsel (Gesicht bleibt, Kleidung ändert sich)
- Deutsche Appearance-Felder → englische Model-Tags (translate_map)
- SDXL-Auflösung 1024x1024 (war 512 — produzierte Chaos)
- 'upper body' statt 'headshot' (war nur Scheitel)
This commit is contained in:
@@ -15,7 +15,7 @@ from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.templating import Jinja2Templates
|
||||
from pydantic import BaseModel
|
||||
|
||||
from comfyui_integration import is_comfyui_running, generate_portrait
|
||||
from comfyui_integration import is_comfyui_running, generate_portrait, build_context_from_messages
|
||||
|
||||
# === Konfiguration ===
|
||||
BASE_DIR = Path(__file__).parent
|
||||
@@ -553,6 +553,17 @@ async def api_generate_portrait(name: str, request: Request):
|
||||
body = await request.json() if request.headers.get("content-type") == "application/json" else {}
|
||||
custom_prompt = body.get("prompt", "")
|
||||
|
||||
# Lese letzte Chat-Nachrichten für Kontext (Outfit-Änderungen etc.)
|
||||
session_id = request.cookies.get(SESSION_COOKIE_NAME, "")
|
||||
try:
|
||||
if session_id:
|
||||
recent_msgs = get_short_term_memory(session_id, name, limit=10)
|
||||
chat_context = build_context_from_messages(recent_msgs, name)
|
||||
if chat_context:
|
||||
custom_prompt = f"{custom_prompt}, {chat_context}" if custom_prompt else chat_context
|
||||
except Exception as e:
|
||||
print(f"Context extraction failed (non-fatal): {e}")
|
||||
|
||||
import uuid
|
||||
job_id = str(uuid.uuid4())[:8]
|
||||
_portrait_jobs[job_id] = {"status": "generating", "image": None, "error": None}
|
||||
|
||||
Reference in New Issue
Block a user