Quantumbraid's picture
download
raw
10.8 kB
(()=>{var a={};a.id=118,a.ids=[118],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},6452:(a,b,c)=>{"use strict";c.d(b,{Os:()=>j,_1:()=>f,b4:()=>h,eA:()=>g,iP:()=>i});var d=c(33873),e=c.n(d);let f=e().resolve("@","..",".."),g=e().join(f,"output"),h=e().join(f,"datasets"),i=e().join(f,"data"),j=e().join(f,"models")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},74366:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>R,patchFetch:()=>Q,routeModule:()=>M,serverHooks:()=>P,workAsyncStorage:()=>N,workUnitAsyncStorage:()=>O});var d={};c.r(d),c.d(d,{POST:()=>L,dynamic:()=>F,maxDuration:()=>G,runtime:()=>E});var e=c(95736),f=c(9117),g=c(4044),h=c(39326),i=c(32324),j=c(261),k=c(54290),l=c(85328),m=c(38928),n=c(46595),o=c(3421),p=c(17679),q=c(41681),r=c(63446),s=c(86439),t=c(51356),u=c(10641),v=c(79646),w=c(33873),x=c.n(w),y=c(29021),z=c.n(y),A=c(6452);new(c(96330)).PrismaClient;let B=x().resolve("@","..","..");x().join(B,"output"),x().join(B,"datasets"),x().join(B,"data"),x().join(B,"models"),process.env.AI_TOOLKIT_QUIET_PATHS||console.log("TOOLKIT_ROOT:",B);let C="win32"===process.platform,D=()=>{let a=[];for(let b of(C?(a.push(x().join(B,".venv","Scripts","python.exe")),a.push(x().join(B,"venv","Scripts","python.exe"))):(a.push(x().join(B,".venv","bin","python")),a.push(x().join(B,"venv","bin","python"))),a))if(z().existsSync(b))return b;return C?"python.exe":"python3"},E="nodejs",F="force-dynamic",G=1200,H=x().join(A._1,"ui_scripts"),I=/^[A-Za-z0-9_][A-Za-z0-9_.-]*\.py$/,J=async a=>{if("string"!=typeof a)return null;let b=a.trim();if(!I.test(b))return null;let c=x().resolve(H,b),d=H.endsWith(x().sep)?H:H+x().sep;if(!c.startsWith(d))return null;try{if(!(await z().promises.stat(c)).isFile())return null}catch{return null}return c},K=a=>{let b=a.trimEnd().split(/\r?\n/);for(let a=b.length-1;a>=0;a--){let c=b[a].trim();if(c){if(c.startsWith("{")||c.startsWith("["))try{return JSON.parse(c)}catch{}break}}return null};async function L(a){let b;try{b=await a.json()}catch{return u.NextResponse.json({error:"Invalid JSON body"},{status:400})}let c=await J(b?.script);if(!c)return u.NextResponse.json({error:"Invalid or unknown script. Must be a *.py file inside ui_scripts/."},{status:400});let d=(a=>{if(null==a)return[];if(Array.isArray(a)){let b=[];for(let c of a)if(null!=c)if("string"!=typeof c&&"number"!=typeof c&&"boolean"!=typeof c)return{error:"args entries must be string|number|boolean"};else b.push(String(c));return b}if("object"==typeof a){let b=[];for(let[c,d]of Object.entries(a)){if(!/^[A-Za-z0-9_-]+$/.test(c))return{error:`invalid arg key: ${c}`};let a=`--${c}`;if(!0===d)b.push(a);else{if(!1===d||null==d)continue;if("string"!=typeof d&&"number"!=typeof d)return{error:`args.${c} must be string|number|boolean`};b.push(a,String(d))}}return b}return{error:"args must be an array or object"}})(b?.args);if(!Array.isArray(d))return u.NextResponse.json({error:d.error},{status:400});if(b?.stream===!0)return((a,b)=>{let c=(0,v.spawn)(D(),["-u",a,...b],{cwd:A._1,env:{...process.env,PYTHONUNBUFFERED:"1",PYTHONIOENCODING:"utf-8"},windowsHide:!0}),d=new TextEncoder,e="",f="",g=!1;return new Response(new ReadableStream({start(a){let b=b=>{a.enqueue(d.encode(JSON.stringify(b)+"\n"))},h=setTimeout(()=>{g=!0,b({type:"error",message:"Script timed out after 20 minutes"}),c.kill("SIGKILL")},12e5);c.stdout.on("data",a=>{let c=a.toString("utf-8");e+=c,b({type:"stdout",data:c})}),c.stderr.on("data",a=>{let c=a.toString("utf-8");f+=c,b({type:"stderr",data:c})}),c.on("error",c=>{clearTimeout(h),b({type:"error",message:c.message}),a.close()}),c.on("close",(c,d)=>{clearTimeout(h),b({type:"exit",exitCode:c,signal:d,ok:!g&&0===c,timedOut:g,result:K(e),stderr:f}),a.close()})},cancel(){c.killed||c.kill("SIGKILL")}}),{headers:{"Content-Type":"application/x-ndjson; charset=utf-8","Cache-Control":"no-cache, no-transform","X-Accel-Buffering":"no"}})})(c,d);let e=await new Promise(a=>{let b=(0,v.spawn)(D(),["-u",c,...d],{cwd:A._1,env:{...process.env,PYTHONUNBUFFERED:"1",PYTHONIOENCODING:"utf-8"},windowsHide:!0}),e="",f="",g=!1,h=setTimeout(()=>{g=!0,b.kill("SIGKILL")},12e5);b.stdout.on("data",a=>{e+=a.toString("utf-8")}),b.stderr.on("data",a=>{f+=a.toString("utf-8")}),b.on("error",b=>{clearTimeout(h),a({ok:!1,exitCode:null,signal:null,stdout:e,stderr:f,result:null,timedOut:g,error:b.message})}),b.on("close",(b,c)=>{clearTimeout(h),a({ok:!g&&0===b,exitCode:b,signal:c,stdout:e,stderr:f,result:K(e),timedOut:g,error:g?"Script timed out after 20 minutes":void 0})})}),f=e.ok?200:e.timedOut?504:500;return u.NextResponse.json(e,{status:f})}let M=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/scripts/route",pathname:"/api/scripts",filename:"route",bundlePath:"app/api/scripts/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/app/ai-toolkit/ui/src/app/api/scripts/route.ts",nextConfigOutput:"",userland:d}),{workAsyncStorage:N,workUnitAsyncStorage:O,serverHooks:P}=M;function Q(){return(0,g.patchFetch)({workAsyncStorage:N,workUnitAsyncStorage:O})}async function R(a,b,c){var d;let e="/api/scripts/route";"/index"===e&&(e="/");let g=await M.prepare(a,b,{srcPage:e,multiZoneDraftMode:!1});if(!g)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:u,params:v,nextConfig:w,isDraftMode:x,prerenderManifest:y,routerServerContext:z,isOnDemandRevalidate:A,revalidateOnlyGenerated:B,resolvedPathname:C}=g,D=(0,j.normalizeAppPath)(e),E=!!(y.dynamicRoutes[D]||y.routes[C]);if(E&&!x){let a=!!y.routes[C],b=y.dynamicRoutes[D];if(b&&!1===b.fallback&&!a)throw new s.NoFallbackError}let F=null;!E||M.isDev||x||(F="/index"===(F=C)?"/":F);let G=!0===M.isDev||!E,H=E&&!G,I=a.method||"GET",J=(0,i.getTracer)(),K=J.getActiveScopeSpan(),L={params:v,prerenderManifest:y,renderOpts:{experimental:{cacheComponents:!!w.experimental.cacheComponents,authInterrupts:!!w.experimental.authInterrupts},supportsDynamicResponse:G,incrementalCache:(0,h.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:null==(d=w.experimental)?void 0:d.cacheLife,isRevalidate:H,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d)=>M.onRequestError(a,b,d,z)},sharedContext:{buildId:u}},N=new k.NodeNextRequest(a),O=new k.NodeNextResponse(b),P=l.NextRequestAdapter.fromNodeNextRequest(N,(0,l.signalFromNodeResponse)(b));try{let d=async c=>M.handle(P,L).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=J.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==m.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${I} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${I} ${a.url}`)}),g=async g=>{var i,j;let k=async({previousCacheEntry:f})=>{try{if(!(0,h.getRequestMeta)(a,"minimalMode")&&A&&B&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let e=await d(g);a.fetchMetrics=L.renderOpts.fetchMetrics;let i=L.renderOpts.pendingWaitUntil;i&&c.waitUntil&&(c.waitUntil(i),i=void 0);let j=L.renderOpts.collectedTags;if(!E)return await (0,o.I)(N,O,e,L.renderOpts.pendingWaitUntil),null;{let a=await e.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(e.headers);j&&(b[r.NEXT_CACHE_TAGS_HEADER]=j),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,d=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=r.INFINITE_CACHE?void 0:L.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:e.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:d}}}}catch(b){throw(null==f?void 0:f.isStale)&&await M.onRequestError(a,b,{routerKind:"App Router",routePath:e,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:H,isOnDemandRevalidate:A})},z),b}},l=await M.handleResponse({req:a,nextConfig:w,cacheKey:F,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:y,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:B,responseGenerator:k,waitUntil:c.waitUntil});if(!E)return null;if((null==l||null==(i=l.value)?void 0:i.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==l||null==(j=l.value)?void 0:j.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});(0,h.getRequestMeta)(a,"minimalMode")||b.setHeader("x-nextjs-cache",A?"REVALIDATED":l.isMiss?"MISS":l.isStale?"STALE":"HIT"),x&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,p.fromNodeOutgoingHttpHeaders)(l.value.headers);return(0,h.getRequestMeta)(a,"minimalMode")&&E||m.delete(r.NEXT_CACHE_TAGS_HEADER),!l.cacheControl||b.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,q.getCacheControlHeader)(l.cacheControl)),await (0,o.I)(N,O,new Response(l.value.body,{headers:m,status:l.value.status||200})),null};K?await g(K):await J.withPropagatedContext(a.headers,()=>J.trace(m.BaseServerSpan.handleRequest,{spanName:`${I} ${a.url}`,kind:i.SpanKind.SERVER,attributes:{"http.method":I,"http.target":a.url}},g))}catch(b){if(b instanceof s.NoFallbackError||await M.onRequestError(a,b,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:H,isOnDemandRevalidate:A})}),E)throw b;return await (0,o.I)(N,O,new Response(null,{status:500})),null}}},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96330:a=>{"use strict";a.exports=require("@prisma/client")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[5873,1692],()=>b(b.s=74366));module.exports=c})();

Xet Storage Details

Size:
10.8 kB
·
Xet hash:
c73b40af95a4c638f3fa5959c289de61661a65ab7520adc252a14d9af2c31cab

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.