functionality tests mostly pass
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -38,7 +38,7 @@ class Settings(BaseSettings):
|
||||
# Application Settings
|
||||
MIN_PROMPT_LENGTH: int = 500
|
||||
MAX_PROMPT_LENGTH: int = 1000
|
||||
NUM_PROMPTS_PER_SESSION: int = 6
|
||||
NUM_PROMPTS_PER_SESSION: int = 3
|
||||
CACHED_POOL_VOLUME: int = 20
|
||||
HISTORY_BUFFER_SIZE: int = 60
|
||||
FEEDBACK_HISTORY_SIZE: int = 30
|
||||
|
||||
Reference in New Issue
Block a user