From 540e3de5cad3d57c72bb9e7b6d5563848a56fd49 Mon Sep 17 00:00:00 2001 From: kapilvus Date: Tue, 23 Jun 2026 00:28:50 +0530 Subject: [PATCH] fix(api): expose match_materials_to_script in /terms endpoint feat commit 552f056 added match_materials_to_script to VideoParams and wired it through task.py, but VideoTermsParams was not updated and the /terms controller still calls generate_terms() without match_script_order. As a result the /terms REST endpoint always generates relevance-ordered terms, even when callers set match_materials_to_script=true, and the chronological prompt branch in generate_terms() is never reachable through the API. Add match_materials_to_script: bool = False to VideoTermsParams and pass it as match_script_order to generate_terms() in the controller. Default is False so existing callers are unaffected. --- app/controllers/v1/llm.py | 1 + app/models/schema.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/v1/llm.py b/app/controllers/v1/llm.py index 41f6cfb084..68d7bb77fd 100644 --- a/app/controllers/v1/llm.py +++ b/app/controllers/v1/llm.py @@ -44,6 +44,7 @@ def generate_video_terms(request: Request, body: VideoTermsRequest): video_subject=body.video_subject, video_script=body.video_script, amount=body.amount, + match_script_order=body.match_materials_to_script, ) response = {"video_terms": video_terms} return utils.get_response(200, response) diff --git a/app/models/schema.py b/app/models/schema.py index 7b5ee915af..33443f391f 100644 --- a/app/models/schema.py +++ b/app/models/schema.py @@ -168,7 +168,8 @@ class VideoTermsParams: { "video_subject": "", "video_script": "", - "amount": 5 + "amount": 5, + "match_materials_to_script": false } """ @@ -177,6 +178,7 @@ class VideoTermsParams: "春天的花海,如诗如画般展现在眼前。万物复苏的季节里,大地披上了一袭绚丽多彩的盛装。金黄的迎春、粉嫩的樱花、洁白的梨花、艳丽的郁金香……" ) amount: Optional[int] = 5 + match_materials_to_script: bool = False class VideoSocialMetadataParams: