feat: Add created_by and cost fields to generation models, populate created_by from the authenticated user, and implement cost calculation.
This commit is contained in:
Binary file not shown.
@@ -56,10 +56,10 @@ async def get_generations(character_id: Optional[str] = None, limit: int = 10, o
|
||||
|
||||
@router.post("/_run", response_model=GenerationResponse)
|
||||
async def post_generation(generation: GenerationRequest, request: Request,
|
||||
generation_service: GenerationService = Depends(
|
||||
get_generation_service)) -> GenerationResponse:
|
||||
generation_service: GenerationService = Depends(get_generation_service),
|
||||
current_user: dict = Depends(get_current_user)) -> GenerationResponse:
|
||||
logger.info(f"post_generation (run) called. LinkedCharId: {generation.linked_character_id}, PromptLength: {len(generation.prompt)}")
|
||||
return await generation_service.create_generation_task(generation)
|
||||
return await generation_service.create_generation_task(generation, user_id=current_user.get("username"))
|
||||
|
||||
|
||||
@router.get("/{generation_id}", response_model=GenerationResponse)
|
||||
|
||||
Reference in New Issue
Block a user