Fold agent chat into live API

This commit is contained in:
Theodore Song
2026-07-16 22:11:59 -04:00
parent d203b10963
commit 14d68062da
3 changed files with 163 additions and 170 deletions
+2 -2
View File
@@ -2268,10 +2268,10 @@ function agentChatPayload(agentId,question,history=[]){
};
}
async function askAgentAI(agentId,question,history=[]){
const r=await fetch("/api/agent-chat",{
const r=await fetch("/api/live",{
method:"POST",
headers:{"Content-Type":"application/json"},
body:JSON.stringify(agentChatPayload(agentId,question,history)),
body:JSON.stringify(Object.assign({action:"agent_chat"},agentChatPayload(agentId,question,history))),
});
const data=await r.json().catch(()=>({}));
if(!r.ok||!data.ok)throw new Error(data.error||"Agent AI chat is not available yet.");