André Oliveira
commited on
Commit
·
07b4f45
1
Parent(s):
4c375c8
added clear cache tool
Browse files
app.py
CHANGED
|
@@ -23,7 +23,7 @@ def call_api(endpoint: str, payload: dict) -> str:
|
|
| 23 |
return str(e)
|
| 24 |
|
| 25 |
|
| 26 |
-
|
| 27 |
"""
|
| 28 |
🧹 Clear Cache MCP Tool
|
| 29 |
Deletes all files and directories inside docs_path on the server.
|
|
@@ -39,7 +39,7 @@ def call_api(endpoint: str, payload: dict) -> str:
|
|
| 39 |
r.raise_for_status()
|
| 40 |
return r.json()
|
| 41 |
except Exception as e:
|
| 42 |
-
return {"error": str(e)}
|
| 43 |
|
| 44 |
|
| 45 |
def upload_docs_tool(files, docs_path="data/docs"):
|
|
@@ -218,14 +218,14 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 218 |
gr.Markdown("---")
|
| 219 |
|
| 220 |
# Clear Cache
|
| 221 |
-
|
| 222 |
gr.Markdown("## Clear Cache")
|
| 223 |
gr.Markdown("🧹 Deletes all files and directories inside docs_path on the server.")
|
| 224 |
clear_path = gr.Textbox(value=DEFAULT_UPLOAD_PATH, label="Docs Path to Clear")
|
| 225 |
clear_btn = gr.Button("Clear Cache", variant="primary")
|
| 226 |
clear_out = gr.JSON(label="Response")
|
| 227 |
clear_btn.click(clear_cache_tool, inputs=[clear_path], outputs=clear_out)
|
| 228 |
-
gr.Markdown("---")
|
| 229 |
|
| 230 |
if __name__ == "__main__":
|
| 231 |
|
|
|
|
| 23 |
return str(e)
|
| 24 |
|
| 25 |
|
| 26 |
+
def clear_cache_tool(docs_path="data/docs"):
|
| 27 |
"""
|
| 28 |
🧹 Clear Cache MCP Tool
|
| 29 |
Deletes all files and directories inside docs_path on the server.
|
|
|
|
| 39 |
r.raise_for_status()
|
| 40 |
return r.json()
|
| 41 |
except Exception as e:
|
| 42 |
+
return {"error": str(e)}
|
| 43 |
|
| 44 |
|
| 45 |
def upload_docs_tool(files, docs_path="data/docs"):
|
|
|
|
| 218 |
gr.Markdown("---")
|
| 219 |
|
| 220 |
# Clear Cache
|
| 221 |
+
with gr.Column():
|
| 222 |
gr.Markdown("## Clear Cache")
|
| 223 |
gr.Markdown("🧹 Deletes all files and directories inside docs_path on the server.")
|
| 224 |
clear_path = gr.Textbox(value=DEFAULT_UPLOAD_PATH, label="Docs Path to Clear")
|
| 225 |
clear_btn = gr.Button("Clear Cache", variant="primary")
|
| 226 |
clear_out = gr.JSON(label="Response")
|
| 227 |
clear_btn.click(clear_cache_tool, inputs=[clear_path], outputs=clear_out)
|
| 228 |
+
gr.Markdown("---")
|
| 229 |
|
| 230 |
if __name__ == "__main__":
|
| 231 |
|