functionality tests mostly pass

This commit is contained in:
2026-01-03 14:52:25 -07:00
parent 55b0a698d0
commit e3d7e7de3a
11 changed files with 779 additions and 269 deletions

View File

@@ -25,6 +25,10 @@ class FillPoolResponse(BaseModel):
total_in_pool: int
target_volume: int
class SelectPromptRequest(BaseModel):
"""Request model for selecting a prompt."""
prompt_text: str
class SelectPromptResponse(BaseModel):
"""Response model for selecting a prompt."""
selected_prompt: str
@@ -155,29 +159,35 @@ async def get_prompt_history(
detail=f"Error getting prompt history: {str(e)}"
)
@router.post("/select/{prompt_index}")
@router.post("/select", response_model=SelectPromptResponse)
async def select_prompt(
prompt_index: int,
request: SelectPromptRequest,
prompt_service: PromptService = Depends(get_prompt_service)
):
"""
Select a prompt from drawn prompts to add to history.
Select a prompt to add to history.
Adds the provided prompt text to the historic prompts cyclic buffer.
The prompt will be added at position 0 (most recent), shifting existing prompts down.
Args:
prompt_index: Index of the prompt to select (0-based)
request: SelectPromptRequest containing the prompt text
Returns:
Confirmation of prompt selection
Confirmation of prompt selection with position in history
"""
try:
# This endpoint would need to track drawn prompts in session
# For now, we'll implement a simplified version
raise HTTPException(
status_code=status.HTTP_501_NOT_IMPLEMENTED,
detail="Prompt selection not yet implemented"
# Add the prompt to history
position_key = await prompt_service.add_prompt_to_history(request.prompt_text)
# Get updated history stats
history_stats = await prompt_service.get_history_stats()
return SelectPromptResponse(
selected_prompt=request.prompt_text,
position_in_history=position_key,
history_size=history_stats.total_prompts
)
except HTTPException:
raise
except Exception as e:
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,