Spaces:
Running
Running
Update tests.py
Browse files
tests.py
CHANGED
@@ -205,7 +205,15 @@ def create_code_files(filename: str, code) -> dict:
|
|
205 |
return {"info":"The referenced code files were created successfully."}
|
206 |
|
207 |
else:
|
208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
|
210 |
|
211 |
@mcp.tool()
|
|
|
205 |
return {"info":"The referenced code files were created successfully."}
|
206 |
|
207 |
else:
|
208 |
+
if isinstance(code, dict):
|
209 |
+
with open(os.path.join(destination_dir, filename), 'w', encoding='utf-8') as f:
|
210 |
+
json.dump(code, f, ensure_ascii=False, indent=4)
|
211 |
+
else:
|
212 |
+
f = open(os.path.join(destination_dir, filename), "w")
|
213 |
+
f.write(str(code))
|
214 |
+
f.close()
|
215 |
+
return {"info":"The referenced code files were created successfully."}
|
216 |
+
# return {"info":"The referenced code files already exist. Please rename the file or delete the existing one."}
|
217 |
|
218 |
|
219 |
@mcp.tool()
|