File tree Expand file tree Collapse file tree
astrbot/core/provider/sources Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,13 +63,14 @@ def _truncate_error_text_candidate(cls, text: str) -> str:
6363 return text [: cls ._ERROR_TEXT_CANDIDATE_MAX_CHARS ]
6464
6565 @staticmethod
66- def _deduplicate_self_repeating (value : str | None ) -> str | None :
67- """If string is a self-repeating pattern like 'abcabc' (exactly 2 repetitions),
68- return the base unit. This handles streaming chunk duplication issues.
66+ def _deduplicate_self_repeating (value : str | None , min_length : int = 20 ) -> str | None :
67+ """If string is a self-repeating pattern like 'astr_kb_searchastr_kb_search'
68+ (exactly 2 repetitions, min 20 chars), return the base unit.
69+ This handles streaming chunk duplication issues for tool names/IDs.
6970 Returns None unchanged."""
7071 if value is None :
7172 return None
72- if not value or len (value ) < 4 :
73+ if not value or len (value ) < min_length :
7374 return value
7475 half = len (value ) // 2
7576 if value [:half ] == value [half :]:
You can’t perform that action at this time.
0 commit comments