엔진 게이트웨이 계약 고정
This commit is contained in:
parent
ebef20560e
commit
f0771db919
8 changed files with 1123 additions and 72 deletions
|
|
@ -25,6 +25,7 @@ from app.contracts.engine_gateway import (
|
|||
ENGINE_GATEWAY_SSE_ERROR,
|
||||
ENGINE_GATEWAY_SSE_TOKEN,
|
||||
EngineMessage as GwMessage,
|
||||
GenerateResponse,
|
||||
GenerateRequest as GwGenerateReq,
|
||||
StreamDoneEvent,
|
||||
StreamErrorEvent,
|
||||
|
|
@ -419,16 +420,16 @@ async def v1_generate(req: GwGenerateReq):
|
|||
structured = json.loads(text)
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
structured = None # 파싱 실패는 호출부가 text 로 폴백
|
||||
return {
|
||||
"text": text,
|
||||
"model": s.model or DEFAULT_MODEL or "claude-opus-4-8",
|
||||
"provider": "claude_cli",
|
||||
"tokens_in": 0,
|
||||
"tokens_out": 0,
|
||||
"cost_usd": result.get("cost_usd", 0.0),
|
||||
"inference_geo": "us",
|
||||
"structured": structured,
|
||||
}
|
||||
return GenerateResponse(
|
||||
text=text,
|
||||
model=s.model or DEFAULT_MODEL or "claude-opus-4-8",
|
||||
provider="claude_cli",
|
||||
tokens_in=0,
|
||||
tokens_out=0,
|
||||
cost_usd=result.get("cost_usd", 0.0),
|
||||
inference_geo="us",
|
||||
structured=structured,
|
||||
).model_dump()
|
||||
|
||||
|
||||
@app.post("/v1/stream")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue