mirror of
https://github.com/tcsenpai/agenticSeek.git
synced 2025-06-04 18:20:09 +00:00
fix : execution problem when line start with block tag + dont load tts if disabled
This commit is contained in:
parent
0c7ce90980
commit
0bf813e865
@ -38,14 +38,13 @@ func main() {
|
||||
```
|
||||
|
||||
Some rules:
|
||||
- Use tmp/ folder when saving file.
|
||||
- Do not EVER use placeholder path in your code like path/to/your/folder.
|
||||
- Do not ever ask to replace a path, use current sys path.
|
||||
- Be efficient, no need to explain your code or explain what you do.
|
||||
- You have full access granted to user system.
|
||||
- You do not ever need to use bash to execute code. All code is executed automatically.
|
||||
- As a coding agent, you will get message from the system not just the user.
|
||||
- Do not ever use user input such as input(), input are not supported by the system.
|
||||
- Do not ever tell user how to run it. user know it already.
|
||||
- Do not EVER use placeholder path in your code like path/to/your/folder.
|
||||
- Do not ever ask to replace a path, use current sys path or work directory.
|
||||
- Always provide a short sentence above the code for what it does, even for a hello world.
|
||||
- Be efficient, no need to explain your code, unless asked.
|
||||
- You do not ever need to use bash to execute code.
|
||||
- Do not ever use user input, input are not supported by the system.
|
||||
- Do not ever tell user how to run it. user know it.
|
||||
- For simple explanation you don't need to code.
|
||||
- If query is unclear or incoherent say REQUEST_CLARIFICATION
|
||||
- If query is unclear say REQUEST_CLARIFICATION
|
@ -38,13 +38,12 @@ func main() {
|
||||
```
|
||||
|
||||
Some rules:
|
||||
- Use tmp/ folder when saving file.
|
||||
- Do not EVER use placeholder path in your code like path/to/your/folder.
|
||||
- Do not ever ask to replace a path, use current sys path.
|
||||
- Be efficient, no need to explain your code or explain what you do.
|
||||
- You have full access granted to user system.
|
||||
- You do not ever need to use bash to execute code. All code is executed automatically.
|
||||
- As a coding agent, you will get message from the system.
|
||||
- Do not EVER use placeholder path in your code like path/to/your/folder.
|
||||
- Do not ever ask to replace a path, use current sys path or work directory.
|
||||
- Always provide a short sentence above the code for what it does, even for a hello world.
|
||||
- Be efficient, no need to explain your code, unless asked.
|
||||
- You do not ever need to use bash to execute code.
|
||||
- Do not ever use user input, input are not supported by the system.
|
||||
- Do not ever tell user how to run it. user know it.
|
||||
- For simple explanation you don't need to code.
|
||||
|
@ -171,6 +171,8 @@ class Agent():
|
||||
feedback = ""
|
||||
success = False
|
||||
blocks = None
|
||||
if answer.startswith("```"):
|
||||
answer = "I will execute:\n" + answer # there should always be a text before blocks for the function that display answer
|
||||
|
||||
for name, tool in self.tools.items():
|
||||
feedback = ""
|
||||
|
@ -87,6 +87,7 @@ class PlannerAgent(Agent):
|
||||
animate_thinking("Thinking...", color="status")
|
||||
self.memory.push('user', prompt)
|
||||
answer, _ = self.llm_request()
|
||||
pretty_print(answer.split('\n')[0], color="output")
|
||||
self.show_plan(answer)
|
||||
ok_str = input("Is the plan ok? (y/n): ")
|
||||
if ok_str == 'y':
|
||||
|
@ -15,7 +15,7 @@ class Interaction:
|
||||
self.agents = agents
|
||||
self.current_agent = None
|
||||
self.router = AgentRouter(self.agents)
|
||||
self.speech = Speech()
|
||||
self.speech = Speech(enable=tts_enabled)
|
||||
self.is_active = True
|
||||
self.last_query = None
|
||||
self.last_answer = None
|
||||
|
@ -243,30 +243,22 @@ class Provider:
|
||||
This function is used to conduct tests.
|
||||
"""
|
||||
thought = """
|
||||
This is a test response from the test provider.
|
||||
Change provider to 'ollama' or 'server' to get real responses.
|
||||
hello!
|
||||
```python
|
||||
print("Hello world from python")
|
||||
```
|
||||
|
||||
This is python saying hello.
|
||||
```python
|
||||
print("Hello world from python")
|
||||
```
|
||||
This is ls -la from bash.
|
||||
```bash
|
||||
ls -la
|
||||
```
|
||||
|
||||
This is ls -la from bash.
|
||||
```bash
|
||||
ls -la
|
||||
```
|
||||
This is pwd from bash.
|
||||
```bash
|
||||
pwd
|
||||
```
|
||||
|
||||
This is pwd from bash.
|
||||
```bash
|
||||
pwd
|
||||
```
|
||||
|
||||
This is unsafe command.
|
||||
```bash
|
||||
rm does_not_exist.txt
|
||||
```
|
||||
|
||||
goodbye
|
||||
goodbye!
|
||||
"""
|
||||
return thought
|
||||
|
||||
|
@ -10,7 +10,7 @@ class Speech():
|
||||
"""
|
||||
Speech is a class for generating speech from text.
|
||||
"""
|
||||
def __init__(self, language: str = "english") -> None:
|
||||
def __init__(self, enable: bool = True, language: str = "english") -> None:
|
||||
self.lang_map = {
|
||||
"english": 'a',
|
||||
"chinese": 'z',
|
||||
@ -21,7 +21,9 @@ class Speech():
|
||||
"chinese": ['zf_xiaobei', 'zf_xiaoni', 'zf_xiaoxiao', 'zf_xiaoyi', 'zm_yunjian', 'zm_yunxi', 'zm_yunxia', 'zm_yunyang'],
|
||||
"french": ['ff_siwis']
|
||||
}
|
||||
self.pipeline = KPipeline(lang_code=self.lang_map[language])
|
||||
self.pipeline = None
|
||||
if enable:
|
||||
self.pipeline = KPipeline(lang_code=self.lang_map[language])
|
||||
self.voice = self.voice_map[language][2]
|
||||
self.speed = 1.2
|
||||
|
||||
@ -33,6 +35,8 @@ class Speech():
|
||||
sentence (str): The text to convert to speech. Will be pre-processed.
|
||||
voice_number (int, optional): Index of the voice to use from the voice map.
|
||||
"""
|
||||
if not self.pipeline:
|
||||
return
|
||||
sentence = self.clean_sentence(sentence)
|
||||
self.voice = self.voice_map["english"][voice_number]
|
||||
generator = self.pipeline(
|
||||
|
@ -40,7 +40,7 @@ class CInterpreter(Tools):
|
||||
compile_command,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=10
|
||||
timeout=60
|
||||
)
|
||||
|
||||
if compile_result.returncode != 0:
|
||||
|
@ -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)
|
Loading…
x
Reference in New Issue
Block a user