Spaces:
Runtime error
Runtime error
Update tools/orchestrator.py
Browse files- tools/orchestrator.py +7 -7
tools/orchestrator.py
CHANGED
@@ -7,7 +7,7 @@ import time
|
|
7 |
from model_logic import call_model_stream, MODELS_BY_PROVIDER, get_default_model_display_name_for_provider
|
8 |
from memory_logic import retrieve_memories_semantic, retrieve_rules_semantic
|
9 |
from tools.websearch import search_and_scrape_duckduckgo, scrape_url
|
10 |
-
from tools.space_builder import create_huggingface_space, update_huggingface_space_file,
|
11 |
import prompts
|
12 |
from utils import format_insights_for_prompt
|
13 |
|
@@ -77,29 +77,29 @@ def orchestrate_and_respond(user_input: str, provider_name: str, model_display_n
|
|
77 |
context_str = f"Tool Result (Create Space): {result.get('result') or result.get('error', 'Unknown outcome')}"
|
78 |
else:
|
79 |
context_str = "Tool Failed: Missing parameters for create_huggingface_space. Required: " + ", ".join(params)
|
80 |
-
elif action_type == "
|
81 |
params = ["owner", "space_name"]
|
82 |
if all(p in action_input for p in params):
|
83 |
yield "status", "[Tool: Listing files...]"
|
84 |
-
result =
|
85 |
if "error" in result:
|
86 |
context_str = f"Tool Result (List Files): Error - {result['error']}"
|
87 |
else:
|
88 |
files_str = "\n- ".join(result.get("files", []))
|
89 |
context_str = f"Tool Result (List Files):\nStatus: {result.get('status', 'OK')}\nFiles:\n- {files_str}"
|
90 |
else:
|
91 |
-
context_str = "Tool Failed: Missing parameters for
|
92 |
-
elif action_type == "
|
93 |
params = ["owner", "space_name", "file_path"]
|
94 |
if all(p in action_input for p in params):
|
95 |
yield "status", "[Tool: Reading file content...]"
|
96 |
-
result =
|
97 |
if "error" in result:
|
98 |
context_str = f"Tool Result (Get Content): Error - {result['error']}"
|
99 |
else:
|
100 |
context_str = f"Tool Result (Get Content for '{action_input['file_path']}'):\nStatus: {result.get('status', 'OK')}\n```\n{result.get('content', '')}\n```"
|
101 |
else:
|
102 |
-
context_str = "Tool Failed: Missing parameters for
|
103 |
elif action_type == "update_huggingface_space_file":
|
104 |
params = ["owner", "space_name", "file_path", "new_content", "commit_message"]
|
105 |
if all(p in action_input for p in params):
|
|
|
7 |
from model_logic import call_model_stream, MODELS_BY_PROVIDER, get_default_model_display_name_for_provider
|
8 |
from memory_logic import retrieve_memories_semantic, retrieve_rules_semantic
|
9 |
from tools.websearch import search_and_scrape_duckduckgo, scrape_url
|
10 |
+
from tools.space_builder import create_huggingface_space, update_huggingface_space_file, list_huggingface_space_files, get_huggingface_space_file_content
|
11 |
import prompts
|
12 |
from utils import format_insights_for_prompt
|
13 |
|
|
|
77 |
context_str = f"Tool Result (Create Space): {result.get('result') or result.get('error', 'Unknown outcome')}"
|
78 |
else:
|
79 |
context_str = "Tool Failed: Missing parameters for create_huggingface_space. Required: " + ", ".join(params)
|
80 |
+
elif action_type == "list_huggingface_space_files":
|
81 |
params = ["owner", "space_name"]
|
82 |
if all(p in action_input for p in params):
|
83 |
yield "status", "[Tool: Listing files...]"
|
84 |
+
result = list_huggingface_space_files(**action_input)
|
85 |
if "error" in result:
|
86 |
context_str = f"Tool Result (List Files): Error - {result['error']}"
|
87 |
else:
|
88 |
files_str = "\n- ".join(result.get("files", []))
|
89 |
context_str = f"Tool Result (List Files):\nStatus: {result.get('status', 'OK')}\nFiles:\n- {files_str}"
|
90 |
else:
|
91 |
+
context_str = "Tool Failed: Missing parameters for list_huggingface_space_files. Required: " + ", ".join(params)
|
92 |
+
elif action_type == "get_huggingface_space_file_content":
|
93 |
params = ["owner", "space_name", "file_path"]
|
94 |
if all(p in action_input for p in params):
|
95 |
yield "status", "[Tool: Reading file content...]"
|
96 |
+
result = get_huggingface_space_file_content(**action_input)
|
97 |
if "error" in result:
|
98 |
context_str = f"Tool Result (Get Content): Error - {result['error']}"
|
99 |
else:
|
100 |
context_str = f"Tool Result (Get Content for '{action_input['file_path']}'):\nStatus: {result.get('status', 'OK')}\n```\n{result.get('content', '')}\n```"
|
101 |
else:
|
102 |
+
context_str = "Tool Failed: Missing parameters for get_huggingface_space_file_content. Required: " + ", ".join(params)
|
103 |
elif action_type == "update_huggingface_space_file":
|
104 |
params = ["owner", "space_name", "file_path", "new_content", "commit_message"]
|
105 |
if all(p in action_input for p in params):
|