Skip to content

Custom Video: explicit chart placement control - #42

Merged
lnanology merged 1 commit into
mainfrom
feature/video-chart-placement
Sep 7, 2026
Merged

Custom Video: explicit chart placement control#42
lnanology merged 1 commit into
mainfrom
feature/video-chart-placement

Conversation

@lnanology

Copy link
Copy Markdown
Owner

AJ's upgrade #4 request ("1-4可以全做", slide count/chart placement control). Slide COUNT was already explicitly controllable via admin. html's videoChatSlides dropdown (num_slides param) -- this adds control over WHERE chart slide(s) land among the body slots, which was previously always hardcoded to the front regardless of what the admin asked for.

  • _detect_chart_placement(): reads an explicit instruction from the topic text -- "chart at the end"/圖表放最後 -> end, "chart in the middle"/圖表放中間 -> middle, "chart on slide N"/第N張slide (only when the word chart/圖 is also present, so a plain "make it 3 slides" doesn't misfire) -> that overall slide position. Defaults to "start" -- the exact pre-existing behavior -- when nothing explicit is said.
  • generate_custom_video()'s body_kinds/body_payloads construction now places chart slots per that instruction (clamped so all chart slides always fit on-screen, even for a wildly out-of-range slide number), then builds each body slide's payload by walking body_kinds in order instead of assuming charts are a fixed leading prefix.

Verified: py_compile, unit tests for _detect_chart_placement (start/ end/middle/index detection incl. Chinese keywords, and the "slide N" guard not misfiring without the word chart/圖 present), 7 end-to-end generate_custom_video() integration scenarios (default/start, end, middle, exact index, index clamped high, index clamped low, and placement being a no-op when no ticker/chart was detected at all), backend boot (66 routes, unchanged).

Depends on feature/video-indicator-charts -> feature/video-multi-chart- slides -> feature/video-ai-background-image (branched from the first, merge in that order).

AJ's upgrade #4 request ("1-4可以全做", slide count/chart placement
control). Slide COUNT was already explicitly controllable via admin.
html's videoChatSlides dropdown (num_slides param) -- this adds control
over WHERE chart slide(s) land among the body slots, which was
previously always hardcoded to the front regardless of what the admin
asked for.

- _detect_chart_placement(): reads an explicit instruction from the
  topic text -- "chart at the end"/圖表放最後 -> end, "chart in the
  middle"/圖表放中間 -> middle, "chart on slide N"/第N張slide (only
  when the word chart/圖 is also present, so a plain "make it 3
  slides" doesn't misfire) -> that overall slide position. Defaults to
  "start" -- the exact pre-existing behavior -- when nothing explicit
  is said.
- generate_custom_video()'s body_kinds/body_payloads construction now
  places chart slots per that instruction (clamped so all chart slides
  always fit on-screen, even for a wildly out-of-range slide number),
  then builds each body slide's payload by walking body_kinds in order
  instead of assuming charts are a fixed leading prefix.

Verified: py_compile, unit tests for _detect_chart_placement (start/
end/middle/index detection incl. Chinese keywords, and the "slide N"
guard not misfiring without the word chart/圖 present), 7 end-to-end
generate_custom_video() integration scenarios (default/start, end,
middle, exact index, index clamped high, index clamped low, and
placement being a no-op when no ticker/chart was detected at all),
backend boot (66 routes, unchanged).

Depends on feature/video-indicator-charts -> feature/video-multi-chart-
slides -> feature/video-ai-background-image (branched from the first,
merge in that order).
@vercel

vercel Bot commented Sep 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
finlab-ai Ready Ready Preview Sep 7, 2026 2:35am UTC

@lnanology
lnanology merged commit a440ebe into main Sep 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant