优化api接口逻辑

This commit is contained in:
puke
2025-11-20 14:28:23 +08:00
parent 68e3eedcd2
commit e2eac8798c
3 changed files with 6 additions and 7 deletions

View File

@@ -56,15 +56,14 @@ async def render_frame(
try: try:
logger.info(f"Frame render request: template={request.template}") logger.info(f"Frame render request: template={request.template}")
# Resolve template path (handles both "default.html" and "1080x1920/default.html") # Resolve template path (returns absolute path with "templates/" or "data/templates/" prefix)
template_path = resolve_template_path(request.template) template_path = resolve_template_path(request.template)
full_template_path = f"templates/{template_path}"
# Parse template size # Parse template size
width, height = parse_template_size(full_template_path) width, height = parse_template_size(template_path)
# Create HTML frame generator # Create HTML frame generator
generator = HTMLFrameGenerator(full_template_path) generator = HTMLFrameGenerator(template_path)
# Generate frame # Generate frame
frame_path = await generator.generate_frame( frame_path = await generator.generate_frame(

View File

@@ -100,8 +100,8 @@ async def list_image_workflows(pixelle_video: PixelleVideoDep):
``` ```
""" """
try: try:
# Get all workflows from image service # Get all workflows from media service (image generation is handled by media service)
all_workflows = pixelle_video.image.list_workflows() all_workflows = pixelle_video.media.list_workflows()
# Filter to image workflows only (filename starts with "image_") # Filter to image workflows only (filename starts with "image_")
image_workflows = [ image_workflows = [

View File

@@ -26,7 +26,7 @@ class FrameRenderRequest(BaseModel):
) )
title: Optional[str] = Field(None, description="Frame title (optional)") title: Optional[str] = Field(None, description="Frame title (optional)")
text: str = Field(..., description="Frame text content") text: str = Field(..., description="Frame text content")
image: str = Field(..., description="Image path or URL") image: Optional[str] = Field(None, description="Image path or URL (optional)")
class Config: class Config:
json_schema_extra = { json_schema_extra = {