debug: add POST test endpoint
This commit is contained in:
parent
73104a1a4c
commit
f864f9894d
|
|
@ -30,9 +30,14 @@ from placeholder_resolver import (
|
||||||
OPENROUTER_KEY = os.getenv("OPENROUTER_API_KEY")
|
OPENROUTER_KEY = os.getenv("OPENROUTER_API_KEY")
|
||||||
OPENROUTER_MODEL = os.getenv("OPENROUTER_MODEL", "anthropic/claude-sonnet-4")
|
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({
|
_WORKFLOW_AGG_META_KEYS = frozenset({
|
||||||
"combined_analysis",
|
"combined_analysis",
|
||||||
"all_signals",
|
"all_signals",
|
||||||
|
|
@ -1547,6 +1552,17 @@ async def execute_unified_prompt_stream(
|
||||||
)
|
)
|
||||||
conn.commit()
|
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:
|
except Exception as e:
|
||||||
# Queue error event
|
# Queue error event
|
||||||
await event_queue.put({
|
await event_queue.put({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user