feat: adds placeholder image and icons while generating
This commit is contained in:
parent
0a23016d65
commit
0d1de4a28e
3 changed files with 26 additions and 2 deletions
|
|
@ -40,7 +40,10 @@ from utils.llm_calls.generate_presentation_structure import (
|
|||
from utils.llm_calls.generate_slide_content import (
|
||||
get_slide_content_from_type_and_outline,
|
||||
)
|
||||
from utils.process_slides import process_slide_and_fetch_assets
|
||||
from utils.process_slides import (
|
||||
process_slide_add_placeholder_assets,
|
||||
process_slide_and_fetch_assets,
|
||||
)
|
||||
from utils.randomizers import get_random_uuid
|
||||
|
||||
|
||||
|
|
@ -226,6 +229,9 @@ async def stream_presentation(
|
|||
)
|
||||
slides.append(slide)
|
||||
|
||||
# This will mutate slide and add placeholder assets
|
||||
process_slide_add_placeholder_assets(slide)
|
||||
|
||||
# This will mutate slide
|
||||
async_assets_generation_tasks.append(
|
||||
process_slide_and_fetch_assets(
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@ system_prompt = """
|
|||
- Only use markdown to highlight important points.
|
||||
- Make sure to follow language guidelines.
|
||||
- Speaker note should be normal text, not markdown.
|
||||
**Strictly follow the max and min character limit for every property in the slide.**
|
||||
- Strictly follow the max and min character limit for every property in the slide.
|
||||
- Never ever go over the max character limit. Limit your narration to make sure you never go over the max character limit.
|
||||
- Number of items should not be more than max number of items specified in slide schema. If you have to put multiple points then merge them to obey max numebr of items.
|
||||
|
||||
# Image and Icon Output Format
|
||||
image: {
|
||||
|
|
|
|||
|
|
@ -170,3 +170,19 @@ async def process_old_and_new_slides_and_fetch_assets(
|
|||
set_dict_at_path(new_slide_content, new_icon_dict_paths[i], new_icon_dict)
|
||||
|
||||
return new_assets
|
||||
|
||||
|
||||
def process_slide_add_placeholder_assets(slide: SlideModel):
|
||||
|
||||
image_paths = get_dict_paths_with_key(slide.content, "__image_prompt__")
|
||||
icon_paths = get_dict_paths_with_key(slide.content, "__icon_query__")
|
||||
|
||||
for image_path in image_paths:
|
||||
image_dict = get_dict_at_path(slide.content, image_path)
|
||||
image_dict["__image_url__"] = "/static/images/placeholder.jpg"
|
||||
set_dict_at_path(slide.content, image_path, image_dict)
|
||||
|
||||
for icon_path in icon_paths:
|
||||
icon_dict = get_dict_at_path(slide.content, icon_path)
|
||||
icon_dict["__icon_url__"] = "/static/icons/placeholder.png"
|
||||
set_dict_at_path(slide.content, icon_path, icon_dict)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue