Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/services/row_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def get_cname(code):
f"Genre: {get_gname(g_id)} + Keyword: {normalize_keyword(kw_name)}"
)
if not title:
title = f"{get_gname(g_id)} {normalize_keyword(kw_name)}"
title = f"{normalize_keyword(kw_name)} {get_gname(g_id)}"
# keyword and genre can have same name sometimes, remove if so
title = " ".join(dict.fromkeys(title.split()))

Expand All @@ -129,7 +129,7 @@ def get_cname(code):
if c_adj:
title = await gemini_service.generate_content_async(f"Genre: {get_gname(g_id)} + Country: {c_adj}")
if not title:
title = f"{get_gname(g_id)} {c_adj}"
title = f"{c_adj} {get_gname(g_id)}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the keyword + genre title generation (lines 111-113), you should also handle potential duplicate words here. While it's unlikely for a country adjective and a genre name to be identical, adding the deduplication logic would make the code more robust and consistent. This also improves readability by separating the title creation from the deduplication.

                    title = f"{c_adj} {get_gname(g_id)}"
                    title = " ".join(dict.fromkeys(title.split()))

rows.append(
RowDefinition(
title=title,
Expand All @@ -152,7 +152,7 @@ def get_cname(code):
decade_str = str(decade_start)[2:] + "s" # "90s"
title = await gemini_service.generate_content_async(f"Genre: {get_gname(g_id)} + Era: {decade_str}")
if not title:
title = f"{get_gname(g_id)} {decade_str}"
title = f"{decade_str} {get_gname(g_id)}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the keyword + genre title generation (lines 111-113), you should also handle potential duplicate words here. While it's highly unlikely for a decade string and a genre name to be identical, adding this deduplication logic improves robustness and consistency. This also improves readability by separating the title creation from the deduplication.

                    title = f"{decade_str} {get_gname(g_id)}"
                    title = " ".join(dict.fromkeys(title.split()))

rows.append(
RowDefinition(
title=title,
Expand Down