debug: add POST test endpoint
Some checks failed
Deploy Development / deploy (push) Successful in 56s
Build Test / pytest-backend (push) Failing after 1s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 21s

This commit is contained in:
Lars 2026-04-18 08:16:51 +02:00
parent 73104a1a4c
commit f864f9894d

View File

@ -30,9 +30,14 @@ from placeholder_resolver import (
OPENROUTER_KEY = os.getenv("OPENROUTER_API_KEY")
OPENROUTER_MODEL = os.getenv("OPENROUTER_MODEL", "anthropic/claude-sonnet-4")
router = APIRouter(prefix="/api/prompts", tags=["prompts"])
router = APIRouter(prefix=/api/prompts, tags=[prompts])
# Metadaten-Schlüssel in workflow aggregate_results (nicht als „einziger“ Nutzer-Output)
@router.post(/test-post)
def test_post(session: dict = Depends(require_auth)):
Simple POST test endpoint
return {status: ok, method: POST}
# Metadaten-Schlüssel in workflow aggregate_results (nicht als „einziger” Nutzer-Output)
_WORKFLOW_AGG_META_KEYS = frozenset({
"combined_analysis",
"all_signals",
@ -1547,6 +1552,17 @@ async def execute_unified_prompt_stream(
)
conn.commit()
# Client (EventSource) wartet auf dieses Event; ohne Payload schließt der Stream
# und der Browser feuert onerror → „Connection to server lost“.
try:
sse_payload = json.loads(json.dumps(result, default=str))
except (TypeError, ValueError):
sse_payload = {"type": result.get("type", "unknown"), "error": "result_not_serializable"}
await event_queue.put({
"type": "execution_complete",
"result": sse_payload,
})
except Exception as e:
# Queue error event
await event_queue.put({