import"./index.c80219e2.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[e]="fb18d1e8-edbd-44b8-83b3-77746998b921",o._sentryDebugIdIdentifier="sentry-dbid-fb18d1e8-edbd-44b8-83b3-77746998b921")}catch{}})();class b{static async*sendMessage(e,t,n,a,c,p,y){var i;const s=await fetch("/_editor/api/ai/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:e,runtime:t,langGraphThreadId:a,threadId:n,code:c,executionError:p})});if(!s.ok)throw new Error("Failed to send message");const r=(i=s.body)==null?void 0:i.getReader();if(!r)throw new Error("No response body");for(;!y();){const d=await r.read();if(d.done)break;yield new TextDecoder().decode(d.value)}}static async createThread(){return(await fetch("/_editor/api/ai/thread",{method:"POST"})).json()}static async cancelAllRuns(e){return(await fetch("/_editor/api/ai/cancel-all",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e})})).ok}static async generateProject(e){const t=await fetch("/_editor/api/ai/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e})});if(!t.ok){const n=await t.text();throw new Error(n)}}static async vote(e,t,n,a){await fetch("/_editor/api/ai/vote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({vote:e,question:t,answer:n,context:a})})}}export{b as A};
//# sourceMappingURL=ai.d8e2b1c5.js.map
