import"./index.b466b20d.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]="3edcb85f-bf59-421c-90f0-3cfe0a8f6e48",a._sentryDebugIdIdentifier="sentry-dbid-3edcb85f-bf59-421c-90f0-3cfe0a8f6e48")}catch{}})();class f{static async*sendMessage(e,t,o,n){var i;const s=await fetch("/_editor/api/ai/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:e,runtime:t,threadId:o})});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(;!n();){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 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{f as A};
//# sourceMappingURL=ai.bc7c8933.js.map
