fix : execution problem when line start with block tag + dont load tts if disabled

This commit is contained in:
martin legrand
2025-03-28 18:51:03 +01:00
parent 0c7ce90980
commit 0bf813e865
9 changed files with 40 additions and 47 deletions
+3 -7
View File
@@ -161,9 +161,7 @@ class Tools():
if start_pos == -1:
break
line_start = llm_text.rfind('\n', 0, start_pos) + 1
if line_start == 0:
line_start = 0
line_start = llm_text.rfind('\n', 0, start_pos)+1
leading_whitespace = llm_text[line_start:start_pos]
end_pos = llm_text.find(end_tag, start_pos + len(start_tag))
@@ -191,15 +189,13 @@ class Tools():
if __name__ == "__main__":
tool = Tools()
tool.tag = "python"
rt = tool.load_exec_block("""
Got it, let me show you the Python files in the current directory using Python:
```python
rt = tool.load_exec_block("""```python
import os
for file in os.listdir():
if file.endswith('.py'):
print(file)
```
goodbye!
""")
print(rt)