Fix nursery.start_soon. Close #5575 (#5591)

### What problem does this PR solve?

Fix nursery.start_soon. Close #5575

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Zhichang Yu
2025-03-04 14:46:54 +08:00
committed by GitHub
parent afe9269534
commit 4d6484b03e
4 changed files with 9 additions and 9 deletions

View File

@ -93,13 +93,13 @@ class MindMapExtractor(Extractor):
for i in range(len(sections)):
section_cnt = num_tokens_from_string(sections[i])
if cnt + section_cnt >= token_count and texts:
nursery.start_soon(self._process_document, "".join(texts), prompt_variables, res)
nursery.start_soon(lambda: self._process_document("".join(texts), prompt_variables, res))
texts = []
cnt = 0
texts.append(sections[i])
cnt += section_cnt
if texts:
nursery.start_soon(self._process_document, "".join(texts), prompt_variables, res)
nursery.start_soon(lambda: self._process_document("".join(texts), prompt_variables, res))
if not res:
return MindMapResult(output={"id": "root", "children": []})
merge_json = reduce(self._merge, res)