fix: update placeholder image paths to use a consistent placeholder.jpg across image generation service and tests
This commit is contained in:
parent
c6e7f6bb78
commit
d07f8f05f6
4 changed files with 8 additions and 8 deletions
|
|
@ -74,11 +74,11 @@ class ImageGenerationService:
|
|||
"""
|
||||
if self.is_image_generation_disabled:
|
||||
print("Image generation is disabled. Using placeholder image.")
|
||||
return "/static/images/replaceable_template_image.png"
|
||||
return "/static/images/placeholder.jpg"
|
||||
|
||||
if not self.image_gen_func:
|
||||
print("No image generation function found. Using placeholder image.")
|
||||
return "/static/images/replaceable_template_image.png"
|
||||
return "/static/images/placeholder.jpg"
|
||||
|
||||
image_prompt = prompt.get_image_prompt(
|
||||
with_theme=not self.is_stock_provider_selected()
|
||||
|
|
@ -112,7 +112,7 @@ class ImageGenerationService:
|
|||
|
||||
except Exception as e:
|
||||
print(f"Error generating image: {e}")
|
||||
return "/static/images/replaceable_template_image.png"
|
||||
return "/static/images/placeholder.jpg"
|
||||
|
||||
async def generate_image_openai(
|
||||
self, prompt: str, output_directory: str, model: str, quality: str
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ class TestImageGenerationService:
|
|||
result = await service.generate_image(sample_image_prompt)
|
||||
|
||||
# Should return placeholder
|
||||
assert result == "/static/images/replaceable_template_image.png"
|
||||
assert result == "/static/images/placeholder.jpg"
|
||||
|
||||
asyncio.run(run_test())
|
||||
|
||||
|
|
@ -221,7 +221,7 @@ class TestImageGenerationService:
|
|||
|
||||
result = await service.generate_image(sample_image_prompt)
|
||||
|
||||
assert result == "/static/images/replaceable_template_image.png"
|
||||
assert result == "/static/images/placeholder.jpg"
|
||||
|
||||
asyncio.run(run_test())
|
||||
|
||||
|
|
@ -367,7 +367,7 @@ class TestImageGenerationEndpoint:
|
|||
with patch('api.v1.ppt.endpoints.images.get_images_directory', return_value=mock_images_directory):
|
||||
with patch('api.v1.ppt.endpoints.images.ImageGenerationService') as mock_service_class:
|
||||
mock_service_instance = Mock()
|
||||
mock_service_instance.generate_image = AsyncMock(return_value="/static/images/replaceable_template_image.png")
|
||||
mock_service_instance.generate_image = AsyncMock(return_value="/static/images/placeholder.jpg")
|
||||
mock_service_class.return_value = mock_service_instance
|
||||
|
||||
response = client.get(f"/images/generate?prompt={test_prompt}")
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ def test_slide_to_html_endpoint():
|
|||
|
||||
# Use a placeholder image path (since we can't easily test with real files)
|
||||
test_data = {
|
||||
"image": "/static/images/replaceable_template_image.png",
|
||||
"image": "/static/images/placeholder.jpg",
|
||||
"xml": test_xml
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ def process_slide_add_placeholder_assets(slide: SlideModel):
|
|||
for image_path in image_paths:
|
||||
image_dict = get_dict_at_path(slide.content, image_path)
|
||||
# Use FastAPI static path for placeholder image
|
||||
image_dict["__image_url__"] = "/static/images/replaceable_template_image.png"
|
||||
image_dict["__image_url__"] = "/static/images/placeholder.jpg"
|
||||
set_dict_at_path(slide.content, image_path, image_dict)
|
||||
|
||||
for icon_path in icon_paths:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue