import"./index.f642553c.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="fa639ccf-a12a-4993-9e03-49cc7bcfa590",a._sentryDebugIdIdentifier="sentry-dbid-fa639ccf-a12a-4993-9e03-49cc7bcfa590")}catch{}})();class h{static async*sendMessage(e,t,o,n,d,f,p){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:n,threadId:o,code:d,executionError:f})});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(;!p();){const c=await r.read();if(c.done)break;yield new TextDecoder().decode(c.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 o=await t.text();throw new Error(o)}}static async vote(e,t,o,n){await fetch("/_editor/api/ai/vote",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({vote:e,question:t,answer:o,context:n})})}}export{h as A};
//# sourceMappingURL=ai.80d34eab.js.map
