mirror of
https://github.com/cline/cline.git
synced 2025-06-03 03:59:07 +00:00
![]() This commit introduces `parseAssistantMessageV2`, a new function designed to parse assistant message strings containing text and XML-like tool usage tags (`<tool_name>...</tool_name>`, `<param_name>...</param_name>`). Motivation: The original parser (`V1`) used a character-by-character accumulator, which could lead to performance overhead due to repeated string concatenations and checks (`endsWith`). V2 aims to improve parsing efficiency. Implementation Details (V2 vs V1): - V2 iterates through the string using an index and checks for tags using `startsWith` with calculated offsets, avoiding the V1 accumulator. - It tracks start indices for text, tools, and parameters, performing `slice` operations only when a block is completed or the string ends. - Known tool and parameter opening tags are precomputed into Maps for potentially faster lookups. - Special handling for nested tags within `write_to_file`/`new_rule` content parameters is preserved using `indexOf`/`lastIndexOf`. Other Changes: - The original parser implementation has been renamed to `parseAssistantMessageV1`. |
||
---|---|---|
.. | ||
cline-overview.md |