from typing import Optional from fastapi import APIRouter, File, Form, UploadFile from services.credit_debug_service import CreditDebugService from services.credit_payload_service import CreditPayloadService router = APIRouter() payload_service = CreditPayloadService("config/credit_feature_schema.json") debug_service = CreditDebugService("config/credit_response_examples.json") @router.post("/xfeature-mngs/conversation/htmlEval") async def html_eval( model: Optional[str] = Form(None), hType: Optional[str] = Form(None), file: Optional[UploadFile] = File(None), ): error_response = debug_service.validate_request( model=model, h_type=hType, file_present=file is not None, ) if error_response: return error_response payload = payload_service.generate_payload( model=model, h_type=hType, filename=file.filename or "credit.html", ) return debug_service.build_success_response(payload) @router.get("/credit/health") async def credit_health(): return {"status": "healthy", "service": "credit-mock"}