fix(server-release): 修复 select_images P1.5 表格关联图片 UnboundLocalError
P1.5 处理表格 images_json 时引用了 P1 块内的变量 s,
但两者在独立的 if 分支中,s 未定义导致 UnboundLocalError。
改用 ctx.get("score", 0) 获取当前切片分数。
This commit is contained in:
@@ -1650,7 +1650,8 @@ def select_images(contexts: List[Dict], query: str) -> List[Dict]:
|
|||||||
existing_ids = {img['id'] for img in scored_images}
|
existing_ids = {img['id'] for img in scored_images}
|
||||||
if img_id and img_id not in existing_ids:
|
if img_id and img_id not in existing_ids:
|
||||||
# 为关联图片计算分数(继承主表格分数,略低)
|
# 为关联图片计算分数(继承主表格分数,略低)
|
||||||
assoc_score = s - 1.0 if s >= MIN_SCORE else MIN_SCORE - 1.0
|
ctx_score = ctx.get("score", 0)
|
||||||
|
assoc_score = ctx_score - 1.0 if ctx_score >= MIN_SCORE else MIN_SCORE - 1.0
|
||||||
if assoc_score >= MIN_SCORE:
|
if assoc_score >= MIN_SCORE:
|
||||||
scored_images.append({
|
scored_images.append({
|
||||||
'score': assoc_score,
|
'score': assoc_score,
|
||||||
|
|||||||
Reference in New Issue
Block a user