Spaces:
Running
Running
Update index.html
Browse files- index.html +39 -0
index.html
CHANGED
@@ -820,5 +820,44 @@
|
|
820 |
initializeAgent();
|
821 |
});
|
822 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
823 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=privateuserh/ctm-vbeta1-03" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
824 |
</html>
|
|
|
820 |
initializeAgent();
|
821 |
});
|
822 |
</script>
|
823 |
+
|
824 |
+
<script>
|
825 |
+
const workerUrl = "https://ctmresearchagent.aiagents.workers.dev/"; // Replace with your Cloudflare Worker URL
|
826 |
+
|
827 |
+
async function handleSubmit(event) {
|
828 |
+
event.preventDefault();
|
829 |
+
const query = document.getElementById("researchQuery").value;
|
830 |
+
const result = document.getElementById("resultDisplay").innerText; // Assuming result is displayed here
|
831 |
+
|
832 |
+
if (query && result) {
|
833 |
+
await fetch(`${workerUrl}/api/research`, {
|
834 |
+
method: "POST",
|
835 |
+
headers: { "Content-Type": "application/json" },
|
836 |
+
body: JSON.stringify({ query, result }),
|
837 |
+
});
|
838 |
+
}
|
839 |
+
}
|
840 |
+
|
841 |
+
async function loadResearchLogs() {
|
842 |
+
const response = await fetch(`${workerUrl}/api/research`);
|
843 |
+
const logs = await response.json();
|
844 |
+
const logsContainer = document.getElementById("past-research-container"); // Add a container for logs in your HTML
|
845 |
+
logsContainer.innerHTML = logs
|
846 |
+
.map(
|
847 |
+
(log) => `
|
848 |
+
<div>
|
849 |
+
<p><b>Query:</b> ${log.query}</p>
|
850 |
+
<p><b>Result:</b> ${log.result}</p>
|
851 |
+
<p><small>${new Date(log.timestamp).toLocaleString()}</small></p>
|
852 |
+
</div>
|
853 |
+
<hr>
|
854 |
+
`
|
855 |
+
)
|
856 |
+
.join("");
|
857 |
+
}
|
858 |
+
|
859 |
+
document.getElementById("submitButton").addEventListener("click", handleSubmit);
|
860 |
+
window.addEventListener("load", loadResearchLogs);
|
861 |
+
</script>
|
862 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=privateuserh/ctm-vbeta1-03" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
863 |
</html>
|