Fix: gemini cv model chat issue. (#10799)

### What problem does this PR solve?

#10787
#10781

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu
2025-10-27 11:43:56 +08:00
committed by GitHub
parent ff34c4232e
commit 3bd0b99495
2 changed files with 10 additions and 10 deletions

View File

@ -755,7 +755,7 @@ async def run_toc_from_text(chunks, chat_mdl, callback=None):
# Merge structure and content (by index)
prune = len(toc_with_levels) > 512
max_lvl = sorted([t.get("level", "0") for t in toc_with_levels])[-1]
max_lvl = sorted([t.get("level", "0") for t in toc_with_levels if isinstance(t, dict)])[-1]
merged = []
for _ , (toc_item, src_item) in enumerate(zip(toc_with_levels, filtered)):
if prune and toc_item.get("level", "0") >= max_lvl: