mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-24 12:41:02 +02:00
Remove wayward space
This commit is contained in:
parent
cbd103d251
commit
b0d588fa26
1 changed files with 5 additions and 5 deletions
|
|
@ -145,8 +145,8 @@ class StreamingReActParser:
|
||||||
|
|
||||||
if idx >= 0:
|
if idx >= 0:
|
||||||
# Found thought delimiter
|
# Found thought delimiter
|
||||||
# Discard any content before it
|
# Discard any content before it and strip leading whitespace after delimiter
|
||||||
self.line_buffer = self.line_buffer[idx + len(self.THOUGHT_DELIMITER):]
|
self.line_buffer = self.line_buffer[idx + len(self.THOUGHT_DELIMITER):].lstrip()
|
||||||
self.state = ParserState.THOUGHT
|
self.state = ParserState.THOUGHT
|
||||||
elif len(self.line_buffer) >= self.MAX_DELIMITER_BUFFER:
|
elif len(self.line_buffer) >= self.MAX_DELIMITER_BUFFER:
|
||||||
# Buffer getting too large, probably junk before thought
|
# Buffer getting too large, probably junk before thought
|
||||||
|
|
@ -180,7 +180,7 @@ class StreamingReActParser:
|
||||||
if self.on_thought_chunk:
|
if self.on_thought_chunk:
|
||||||
self.on_thought_chunk(thought_chunk)
|
self.on_thought_chunk(thought_chunk)
|
||||||
|
|
||||||
self.line_buffer = self.line_buffer[next_delimiter_idx + delimiter_len:]
|
self.line_buffer = self.line_buffer[next_delimiter_idx + delimiter_len:].lstrip()
|
||||||
self.state = next_state
|
self.state = next_state
|
||||||
else:
|
else:
|
||||||
# No delimiter found yet
|
# No delimiter found yet
|
||||||
|
|
@ -203,7 +203,7 @@ class StreamingReActParser:
|
||||||
if args_idx >= 0 and (newline_idx < 0 or args_idx < newline_idx):
|
if args_idx >= 0 and (newline_idx < 0 or args_idx < newline_idx):
|
||||||
# Args delimiter found first
|
# Args delimiter found first
|
||||||
self.action_buffer = self.line_buffer[:args_idx].strip().strip('"')
|
self.action_buffer = self.line_buffer[:args_idx].strip().strip('"')
|
||||||
self.line_buffer = self.line_buffer[args_idx + len(self.ARGS_DELIMITER):]
|
self.line_buffer = self.line_buffer[args_idx + len(self.ARGS_DELIMITER):].lstrip()
|
||||||
self.state = ParserState.ARGS
|
self.state = ParserState.ARGS
|
||||||
elif newline_idx >= 0:
|
elif newline_idx >= 0:
|
||||||
# Newline found, action name complete
|
# Newline found, action name complete
|
||||||
|
|
@ -213,7 +213,7 @@ class StreamingReActParser:
|
||||||
# Actually, check if next line has Args:
|
# Actually, check if next line has Args:
|
||||||
if self.line_buffer.lstrip().startswith(self.ARGS_DELIMITER):
|
if self.line_buffer.lstrip().startswith(self.ARGS_DELIMITER):
|
||||||
args_start = self.line_buffer.find(self.ARGS_DELIMITER)
|
args_start = self.line_buffer.find(self.ARGS_DELIMITER)
|
||||||
self.line_buffer = self.line_buffer[args_start + len(self.ARGS_DELIMITER):]
|
self.line_buffer = self.line_buffer[args_start + len(self.ARGS_DELIMITER):].lstrip()
|
||||||
self.state = ParserState.ARGS
|
self.state = ParserState.ARGS
|
||||||
else:
|
else:
|
||||||
# Not enough content yet, keep buffering
|
# Not enough content yet, keep buffering
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue