**Add new test script, agent modifications, and SearXNG integration updates**

This commit is contained in:
geoffsee
2025-05-27 19:10:33 -04:00
parent bb99e652f9
commit 29f70146d2
24 changed files with 2538 additions and 38 deletions

43
test-search.ts Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env deno -A
const API_ROOT = "http://localhost:3006";
const sid = crypto.randomUUID();
// -------------------- 1. Create the agent --------------------
const createAgentBody = {
id: sid,
resource: "web-search",
parent: sid,
payload: { input: "What is the capital of France?" },
};
const createRes = await fetch(`${API_ROOT}/api/agents`, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify(createAgentBody),
});
const raw = await createRes.text();
console.log({raw});
const {stream_url: streamId} = JSON.parse(raw);
console.log("Agent created with streamId:", streamId);
// -------------------- 2. Listen to the SSE stream --------------------
const streamUrl = `${API_ROOT}${streamId}`;
const es = new EventSource(streamUrl);
es.onopen = (e) => {
console.log("connected", e);
};
es.onmessage = (e) => {
console.log("⟶", e.data);
};
es.onerror = (e) => {
console.error("SSE error:", e);
es.close();
};