PageSourceSearch

https://aetheriumai.vercel.app/assets/index-chunk6.js

js aetheriumai.vercel.app collected 2026-10-03 06:11:33 UTC 3,082 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-chunk10.js","assets/index.js","assets/asset.css","assets/index-chunk.js","assets/index-chunk8.js"])))=>i.map(i=>d[i]);
2import{b as p,_ as w}from"./index.js";import{a as d,u as a,c as T,C as _,d as f,b as x,i as y,f as k}from"./index-chunk.js";import"./index-chunk8.js";async function E(o,n){if(!d.getState().settings.enableAiResponse)return;const i=o[o.length-1];if(!i)throw new Error("No messages provided for chat generation");const t=a.getState();try{const e=Object.keys(t.response).length+1;t.setResponse({...t.response,[e]:""});const s=g=>{const c=a.getState().response;a.getState().setResponse({...c,[e]:g})},r=await G({input:i.content,onUpdate:s,shouldCheckCanRespond:n}),l=a.getState().response;l[-e]=r,delete l[e],a.getState().setResponse(l)}catch(e){throw p(`Text generation failed: ${e instanceof Error?e.message:"Unknown error"}`),e}}async function G({input:o,onUpdate:n,shouldCheckCanRespond:i=!1}){let t;try{if(a.getState().textGenerationState==="interrupted")return"";a.getState().textGenerationState!=="loadingModel"&&a.getState().setTextGenerationState("preparingToGenerate");const e=i?({loaded:S,total:m})=>a.getState().setModelLoadingProgress(Math.round(S/m*100)):void 0,{wllama:s,model:r}=await M(e);if(t=s,a.getState().textGenerationState==="interrupted")return"";a.getState().setTextGenerationState("preparingToGenerate"),await T();let l="";const g=(S,m,h,{abortSignal:u})=>{if(a.getState().textGenerationState==="interrupted")throw u(),new _("Chat generation interrupted");a.getState().textGenerationState!=="generating"&&a.getState().setTextGenerationState("generating"),l=I(r,h,u,n),f.getState().incrementTotalTokenUsage(1)};if(a.getState().textGenerationState==="interrupted")return"";const c=x.encode(o).length;return f.getState().incrementTotalTokenUsage(c),await s.createChatCompletion(r.getMessages(o,y(r.shouldIncludeUrlsOnPrompt)),{nPredict:k/2,stopTokens:r.stopTokens,sampling:r.getSampling(),onNewToken:g}),l}catch(e){throw p(`Wllama generation failed: ${e instanceof Error?e.message:"Unknown error"}`),e}finally{t&&await t.exit().catch(e=>{p(`Failed to cleanup Wllama instance: ${e instanceof Error?e.message:"Unknown error"}`)})}}async function M(o){const{initializeWllama:n,wllamaModels:i}=await w(async()=>{const{initializeWllama:s,wllamaModels:r}=await import("./index-chunk10.js");return{initializeWllama:s,wllamaModels:r}},__vite__mapDeps([0,1,2,3,4])),t=i[d.getState().settings.wllamaModelId];return a.getState().setModelSizeInMegabytes(t.fileSizeInMegabytes),{wllama:await n(t.hfRepoId,t.hfFilePath,{wllama:{suppressNativeLog:!0,allowOffline:!0},model:{n_threads:d.getState().settings.cpuThreads,n_ctx:t.contextSize,cache_type_k:t.cacheTypeK,cache_type_v:t.cacheTypeV,embeddings:!1,progressCallback:o}}),model:t}}function I(o,n,i,t){if(!o.stopStrings?.length)return t(n),n;const e=o.stopStrings.findIndex(s=>n.slice(-(s.length*2)).includes(s));if(e!==-1){i();const s=n.slice(0,-o.stopStrings[e].length);return t(s),s}return t(n),n}export{E as generateTextWithWllama};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.