@zwbigi/ink-xy 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +4 -3
- package/.next/build-manifest.json +2 -2
- package/.next/routes-manifest.json +6 -0
- package/.next/server/app/_global-error/page.js +2 -2
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +2 -2
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/agent/[id]/events/route.js +2 -2
- package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/route.js +1 -1
- package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/describe-image/route.js +1 -1
- package/.next/server/app/api/agent/describe-image/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/new/route.js +1 -1
- package/.next/server/app/api/agent/new/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/parse-characters/route.js +43 -0
- package/.next/server/app/api/agent/parse-characters/route.js.nft.json +1 -0
- package/.next/server/app/api/agent/parse-characters/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/all-providers/route.js +1 -1
- package/.next/server/app/api/auth/all-providers/route.js.nft.json +1 -1
- package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
- package/.next/server/app/api/auth/api-key/[provider]/route.js.nft.json +1 -1
- package/.next/server/app/api/auth/login/[provider]/route.js +1 -1
- package/.next/server/app/api/auth/login/[provider]/route.js.nft.json +1 -1
- package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
- package/.next/server/app/api/auth/logout/[provider]/route.js.nft.json +1 -1
- package/.next/server/app/api/auth/providers/route.js +1 -1
- package/.next/server/app/api/auth/providers/route.js.nft.json +1 -1
- package/.next/server/app/api/default-cwd/route.js +1 -1
- package/.next/server/app/api/files/[...path]/route.js +3 -3
- package/.next/server/app/api/files/[...path]/route.js.nft.json +1 -1
- package/.next/server/app/api/gem-xy/[id]/route.js +1 -1
- package/.next/server/app/api/gem-xy/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/gem-xy/route.js +1 -1
- package/.next/server/app/api/gem-xy/route.js.nft.json +1 -1
- package/.next/server/app/api/home/route.js +1 -1
- package/.next/server/app/api/inkos/route.js +1 -1
- package/.next/server/app/api/inkos/route.js.nft.json +1 -1
- package/.next/server/app/api/models/route.js +1 -1
- package/.next/server/app/api/models/route.js.nft.json +1 -1
- package/.next/server/app/api/models-config/route.js +1 -1
- package/.next/server/app/api/models-config/route.js.nft.json +1 -1
- package/.next/server/app/api/register-cwd/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/context/route.js +2 -2
- package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/lock/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/lock/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/new/route.js +1 -1
- package/.next/server/app/api/sessions/route.js +1 -1
- package/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/install/route.js +1 -1
- package/.next/server/app/api/skills/install/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/route.js +1 -1
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/search/route.js +1 -1
- package/.next/server/app/api/skills/search/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/synthesize/route.js +1 -1
- package/.next/server/app/api/tts/synthesize/route.js.nft.json +1 -1
- package/.next/server/app/favicon.ico/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +2 -2
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/page.js +64 -29
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +4 -3
- package/.next/server/chunks/162.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/static/Y5hk_NhnX1o3afMM2Tt5-/_buildManifest.js +1 -0
- package/.next/static/chunks/app/_global-error/page-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/events/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/agent/describe-image/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/agent/new/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/agent/parse-characters/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/auth/all-providers/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/auth/login/[provider]/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/auth/providers/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/default-cwd/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/files/[...path]/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/gem-xy/[id]/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/gem-xy/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/home/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/inkos/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/models/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/models-config/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/register-cwd/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/context/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/lock/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/sessions/new/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/sessions/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/skills/install/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/skills/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/skills/search/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/api/tts/synthesize/route-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/app/page-3c94fbcf268ba682.js +202 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-63ec4518ba538b61.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-63ec4518ba538b61.js +1 -0
- package/.next/trace +4 -4
- package/.next/trace-build +1 -1
- package/.next/types/app/api/agent/parse-characters/route.ts +351 -0
- package/.next/types/routes.d.ts +2 -1
- package/.next/types/validator.ts +9 -0
- package/inkos/packages/cli/dist/index.js +2 -2
- package/inkos/packages/core/dist/pipeline/runner.js +2 -2
- package/inkos/packages/core/dist/pipeline/runner.js.map +1 -1
- package/inkos/packages/core/src/pipeline/runner.ts +2 -2
- package/package.json +1 -1
- package/.next/static/_dVc8qn-Ll1d6faCafbmD/_buildManifest.js +0 -1
- package/.next/static/chunks/app/_global-error/page-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/events/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/agent/describe-image/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/agent/new/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/auth/all-providers/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/auth/login/[provider]/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/auth/providers/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/default-cwd/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/files/[...path]/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/gem-xy/[id]/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/gem-xy/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/home/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/inkos/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/models/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/models-config/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/register-cwd/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/context/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/lock/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/sessions/new/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/sessions/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/skills/install/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/skills/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/skills/search/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/api/tts/synthesize/route-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/app/page-fbf66e00e4553a09.js +0 -167
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-7f5e7bebe7a745ed.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-7f5e7bebe7a745ed.js +0 -1
- /package/.next/static/{_dVc8qn-Ll1d6faCafbmD → Y5hk_NhnX1o3afMM2Tt5-}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var a={};a.id=360,a.ids=[360],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")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},20622:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(99719),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/tts/synthesize/route",pathname:"/api/tts/synthesize",filename:"route",bundlePath:"app/api/tts/synthesize/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"E:\\ink-xY\\app\\api\\tts\\synthesize\\route.ts",nextConfigOutput:"",userland:v}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/tts/synthesize/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,params:v,nextConfig:w,parsedUrl:x,isDraftMode:y,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,resolvedPathname:E,clientReferenceManifest:F,serverActionsManifest:G}=e,H=(0,k.normalizeAppPath)(d),I=!!(A.dynamicRoutes[H]||A.routes[E]),J=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,x,!1):b.end("This page could not be found"),null);if(I&&!y){let a=!!A.routes[E],b=A.dynamicRoutes[H];if(b&&!1===b.fallback&&!a){if(w.adapterPath)return await J();throw new t.NoFallbackError}}let K=null;!I||z.isDev||y||(K=E,K="/index"===K?"/":K);let L=!0===z.isDev||!I,M=I&&!L;G&&F&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:F,serverActionsManifest:G});let N=a.method||"GET",O=(0,i.getTracer)(),P=O.getActiveScopeSpan(),Q=!!(null==B?void 0:B.isWrappedByNextServer),R=!!(0,h.getRequestMeta)(a,"minimalMode"),S=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,w,A,R);null==S||S.resetRequestCache(),globalThis.__incrementalCache=S;let T={params:v,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts},cacheComponents:!!w.cacheComponents,supportsDynamicResponse:L,incrementalCache:S,cacheLifeProfiles:w.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,B)},sharedContext:{buildId:g}},U=new l.NodeNextRequest(a),V=new l.NodeNextResponse(b),W=m.NextRequestAdapter.fromNodeNextRequest(U,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(W,T).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=O.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${N} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${N} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!R&&C&&D&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=T.renderOpts.fetchMetrics;let h=T.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=T.renderOpts.collectedTags;if(!I)return await (0,p.I)(U,V,d,T.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==T.renderOpts.collectedRevalidate&&!(T.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&T.renderOpts.collectedRevalidate,e=void 0===T.renderOpts.collectedExpire||T.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:T.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:M,isOnDemandRevalidate:C})},!1,B),b}},k=await z.handleResponse({req:a,nextConfig:w,cacheKey:K,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:R});if(!I)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});R||b.setHeader("x-nextjs-cache",C?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),y&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return R&&I||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(U,V,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};Q&&P?await h(P):(e=O.getActiveScopeSpan(),await O.withPropagatedContext(a.headers,()=>O.trace(n.BaseServerSpan.handleRequest,{spanName:`${N} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":N,"http.target":a.url}},h),void 0,!Q))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:M,isOnDemandRevalidate:C})},!1,B),I)throw b;return await (0,p.I)(U,V,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},21820:a=>{"use strict";a.exports=require("os")},23582:(a,b,c)=>{"use strict";var d=c(21820),e=c(33873),f=c(29021);let g=(0,d.homedir)(),h=(0,e.join)(g,".ink","agent"),i=(0,e.join)(g,".pi","agent");process.env.PI_CODING_AGENT_DIR||(process.env.PI_CODING_AGENT_DIR=h);try{if((0,f.existsSync)(i)){for(let a of((0,f.existsSync)(h)||(0,f.mkdirSync)(h,{recursive:!0}),["models.json","auth.json","settings.json","fetched-models-cache.json","gem_xy.json","locked-sessions.json"])){let b=(0,e.join)(i,a),c=(0,e.join)(h,a);if((0,f.existsSync)(b)&&function(a){try{if(!(0,f.existsSync)(a))return!0;let b=(0,f.readFileSync)(a,"utf8").trim();if(!b||"{}"===b||'{\n "providers": {}\n}'===b)return!0;let c=JSON.parse(b);if(0===Object.keys(c).length||c.providers&&0===Object.keys(c.providers).length)return!0;return!1}catch{return!0}}(c))try{(0,f.writeFileSync)(c,(0,f.readFileSync)(b)),console.log(`[env-init] Migrated config file ${a} from .pi/agent to .ink/agent`)}catch(b){console.error(`[env-init] Failed to migrate config file ${a}:`,b)}}for(let a of["sessions","skills","bin"]){let b=(0,e.join)(i,a),c=(0,e.join)(h,a);if((0,f.existsSync)(b))try{!function a(b,c){if((0,f.existsSync)(b))for(let d of((0,f.existsSync)(c)||(0,f.mkdirSync)(c,{recursive:!0}),(0,f.readdirSync)(b,{withFileTypes:!0}))){let g=(0,e.join)(b,d.name),h=(0,e.join)(c,d.name);if(d.isDirectory())a(g,h);else try{(0,f.existsSync)(h)||(0,f.writeFileSync)(h,(0,f.readFileSync)(g))}catch(a){console.error(`[env-init] Failed to copy file ${g} to ${h}:`,a)}}}(b,c),console.log(`[env-init] Migrated directory ${a} from .pi/agent to .ink/agent`)}catch(b){console.error(`[env-init] Failed to migrate directory ${a}:`,b)}}let a=(0,e.join)(g,".pi");if((0,f.existsSync)(a))try{let b=a+".bak",c=b,d=1;for(;(0,f.existsSync)(c);)c=`${b}_${d}`,d++;(0,f.renameSync)(a,c),console.log(`[env-init] Renamed old config dir ${a} to ${c}`)}catch(a){console.error("[env-init] Failed to rename old config dir:",a)}}}catch(a){console.error("[env-init] Migration failed:",a)}},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")},53021:(a,b,c)=>{"use strict";function d(a){if(!a)return"";let b=a,c="\x3c!-- PI_FILE_ATTACHMENTS_START --\x3e",d="\x3c!-- PI_FILE_ATTACHMENTS_END --\x3e";if(b.includes(c)){let a=b.indexOf(c),e=b.indexOf(d);b=-1!==e&&e>a?b.substring(0,a)+b.substring(e+d.length):b.substring(0,a)}return(b=(b=(b=b.replace(/📄\s*\[已上传文件到工作区\][\s\S]*/g,"")).replace(/^[-\*\s•]*temp\/[^\r\n]*/gim,"")).replace(/^📄\s*\[已上传文件到工作区\][^\r\n]*/gim,"")).trim()}c.d(b,{tH:()=>d})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{},99719:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>i,dynamic:()=>j}),c(23582);var e=c(23211),f=c(75430),g=c(53021),h=a([f]);f=(h.then?(await h)():h)[0];let j="force-dynamic";async function i(a){let b,c,d="",h="mimo_default",i="mimo-v2.5-tts",j="mimo-v2.5-tts",k="mimo_default",l="https://token-plan-cn.xiaomimimo.com/v1";try{let l=await a.json();if(d=(0,g.tH)(l.text),b=l.style,void 0!==l.voice&&(h=l.voice),void 0!==l.modelId&&(i=l.modelId),c=l.voiceDesignPrompt,j=i,k=h,!d)return e.NextResponse.json({error:"Text is required for speech synthesis"},{status:400});let m=f.AuthStorage.create(),n=f.ModelRegistry.create(m),o="",p="https://token-plan-cn.xiaomimimo.com/v1",q=n.getAvailable().find(a=>a.id===i)||n.getAll().find(a=>a.id===i);if(q){let a=await n.getApiKeyAndHeaders(q);a.ok&&a.apiKey&&(o=a.apiKey),q.baseUrl&&(p=q.baseUrl)}if(!o){let a=m.get("mimo"),b=m.get("lingya"),c=m.get("xiaomi-token-plan"),d=m.get("xiaomi-token-plan-cn");(o=a?.key||b?.key||c?.key||d?.key||"")||(o=process.env.LINGYA_API_KEY||process.env.OPENAI_API_KEY||""),o===process.env.LINGYA_API_KEY&&process.env.LINGYA_API_URL?p=process.env.LINGYA_API_URL:d?.key&&o===d.key?p="https://token-plan-cn.xiaomimimo.com/v1":c?.key&&o===c.key&&(p="https://token-plan.api.xiaomi.net/v1")}if(!o)return e.NextResponse.json({error:"未检测到 MiMo/Lingya/Xiaomi API Key,请先在侧边栏底部的 Models 中配置 API Key,或在系统环境变量中设置 LINGYA_API_KEY。"},{status:400});i.toLowerCase().includes("voicedesign")||i.toLowerCase().includes("design");let r=i.toLowerCase().includes("voiceclone")||i.toLowerCase().includes("clone");j=i,k=h,r&&(h&&h.startsWith("data:")?(h.startsWith("data:audio/webm;")||h.startsWith("data:audio/ogg;")||h.startsWith("data:audio/m4a;")||h.startsWith("data:audio/webm,"))&&(console.log("[tts-synthesize] Translating unsupported browser audio format to wav header for MiMo compatibility."),k=h.replace(/^data:audio\/[^;]+;/,"data:audio/wav;")):(console.log("[tts-synthesize] Voice clone selected but voice parameter is not a DataURL. Falling back to standard mimo-v2.5-tts."),j="mimo-v2.5-tts",k="mimo_default"));let s=j.toLowerCase().includes("voicedesign")||j.toLowerCase().includes("design"),t="";if(s){let a=c?.trim()||"A warm natural conversational voice",d=b?.trim()?`, in this style: ${b}`:"";t=`${a}${d}`.trim()}else t=b?.trim()?`Speak in this style: ${b}`:"speak naturally in a warm conversational tone.";let u={model:j,messages:[{role:"user",content:t},{role:"assistant",content:d}],audio:{}};s||(u.audio.voice=k);let v=`${p}/chat/completions`;console.log(`[tts-synthesize] Sending request to endpoint: ${v}`),console.log("[tts-synthesize] Request Body:",JSON.stringify(u,null,2));let w=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify(u)});if(!w.ok){let a=await w.json().catch(()=>({}));console.error("[tts-synthesize] Xiaomi API error response:",JSON.stringify(a));let b=a.error?.message||a.error||JSON.stringify(a),c=a.error?.param?` (参数错误字段: ${a.error.param})`:"";return e.NextResponse.json({error:`Xiaomi TTS API 返回错误 (HTTP ${w.status}): ${b}${c}`},{status:w.status})}let x=await w.json(),y=x.choices?.[0]?.message?.audio?.data;if(!y)return console.error("[tts-synthesize] Response is missing audio data:",JSON.stringify(x)),e.NextResponse.json({error:"小米 API 响应中缺少 audio.data 字段,请确认使用的是 mimo-v2.5-tts 模型。"},{status:500});return e.NextResponse.json({audioUrl:`data:audio/mp3;base64,${y}`})}catch(a){return console.error("[tts-synthesize] Unexpected error:",a),e.NextResponse.json({error:`TTS 接口出错: ${String(a)}`,debug:{modelId:i,finalModelId:void 0!==j?j:void 0,voice:void 0!==h?h:void 0,finalVoice:void 0!==k&&k?k.startsWith("data:")?`DataURL(${k.length}B)`:k:void 0,baseUrl:void 0!==l?l:void 0,endpoint:void 0!==l?`${l}/chat/completions`:void 0,hasApiKey:!1,apiKeyPrefix:void 0,errorStack:a?.stack||String(a),errorCause:a?.cause?String(a.cause):a?.message||String(a)}},{status:500})}}d()}catch(a){d(a)}})}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[741,813],()=>b(b.s=20622));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=360,a.ids=[360],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")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{"use strict";a.exports=require("os")},23582:(a,b,c)=>{"use strict";var d=c(21820),e=c(33873),f=c(29021);let g=(0,d.homedir)(),h=(0,e.join)(g,".ink","agent"),i=(0,e.join)(g,".pi","agent");process.env.PI_CODING_AGENT_DIR||(process.env.PI_CODING_AGENT_DIR=h);try{if((0,f.existsSync)(i)){for(let a of((0,f.existsSync)(h)||(0,f.mkdirSync)(h,{recursive:!0}),["models.json","auth.json","settings.json","fetched-models-cache.json","gem_xy.json","locked-sessions.json"])){let b=(0,e.join)(i,a),c=(0,e.join)(h,a);if((0,f.existsSync)(b)&&function(a){try{if(!(0,f.existsSync)(a))return!0;let b=(0,f.readFileSync)(a,"utf8").trim();if(!b||"{}"===b||'{\n "providers": {}\n}'===b)return!0;let c=JSON.parse(b);if(0===Object.keys(c).length||c.providers&&0===Object.keys(c.providers).length)return!0;return!1}catch{return!0}}(c))try{(0,f.writeFileSync)(c,(0,f.readFileSync)(b)),console.log(`[env-init] Migrated config file ${a} from .pi/agent to .ink/agent`)}catch(b){console.error(`[env-init] Failed to migrate config file ${a}:`,b)}}for(let a of["sessions","skills","bin"]){let b=(0,e.join)(i,a),c=(0,e.join)(h,a);if((0,f.existsSync)(b))try{!function a(b,c){if((0,f.existsSync)(b))for(let d of((0,f.existsSync)(c)||(0,f.mkdirSync)(c,{recursive:!0}),(0,f.readdirSync)(b,{withFileTypes:!0}))){let g=(0,e.join)(b,d.name),h=(0,e.join)(c,d.name);if(d.isDirectory())a(g,h);else try{(0,f.existsSync)(h)||(0,f.writeFileSync)(h,(0,f.readFileSync)(g))}catch(a){console.error(`[env-init] Failed to copy file ${g} to ${h}:`,a)}}}(b,c),console.log(`[env-init] Migrated directory ${a} from .pi/agent to .ink/agent`)}catch(b){console.error(`[env-init] Failed to migrate directory ${a}:`,b)}}let a=(0,e.join)(g,".pi");if((0,f.existsSync)(a))try{let b=a+".bak",c=b,d=1;for(;(0,f.existsSync)(c);)c=`${b}_${d}`,d++;(0,f.renameSync)(a,c),console.log(`[env-init] Renamed old config dir ${a} to ${c}`)}catch(a){console.error("[env-init] Failed to rename old config dir:",a)}}}catch(a){console.error("[env-init] Migration failed:",a)}},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")},34372:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(99719),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/tts/synthesize/route",pathname:"/api/tts/synthesize",filename:"route",bundlePath:"app/api/tts/synthesize/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"E:\\ink-xY\\app\\api\\tts\\synthesize\\route.ts",nextConfigOutput:"",userland:v}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/tts/synthesize/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,params:v,nextConfig:w,parsedUrl:x,isDraftMode:y,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,resolvedPathname:E,clientReferenceManifest:F,serverActionsManifest:G}=e,H=(0,k.normalizeAppPath)(d),I=!!(A.dynamicRoutes[H]||A.routes[E]),J=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,x,!1):b.end("This page could not be found"),null);if(I&&!y){let a=!!A.routes[E],b=A.dynamicRoutes[H];if(b&&!1===b.fallback&&!a){if(w.adapterPath)return await J();throw new t.NoFallbackError}}let K=null;!I||z.isDev||y||(K=E,K="/index"===K?"/":K);let L=!0===z.isDev||!I,M=I&&!L;G&&F&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:F,serverActionsManifest:G});let N=a.method||"GET",O=(0,i.getTracer)(),P=O.getActiveScopeSpan(),Q=!!(null==B?void 0:B.isWrappedByNextServer),R=!!(0,h.getRequestMeta)(a,"minimalMode"),S=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,w,A,R);null==S||S.resetRequestCache(),globalThis.__incrementalCache=S;let T={params:v,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts},cacheComponents:!!w.cacheComponents,supportsDynamicResponse:L,incrementalCache:S,cacheLifeProfiles:w.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,B)},sharedContext:{buildId:g}},U=new l.NodeNextRequest(a),V=new l.NodeNextResponse(b),W=m.NextRequestAdapter.fromNodeNextRequest(U,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(W,T).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=O.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${N} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${N} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!R&&C&&D&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=T.renderOpts.fetchMetrics;let h=T.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=T.renderOpts.collectedTags;if(!I)return await (0,p.I)(U,V,d,T.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==T.renderOpts.collectedRevalidate&&!(T.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&T.renderOpts.collectedRevalidate,e=void 0===T.renderOpts.collectedExpire||T.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:T.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:M,isOnDemandRevalidate:C})},!1,B),b}},k=await z.handleResponse({req:a,nextConfig:w,cacheKey:K,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:R});if(!I)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});R||b.setHeader("x-nextjs-cache",C?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),y&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return R&&I||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(U,V,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};Q&&P?await h(P):(e=O.getActiveScopeSpan(),await O.withPropagatedContext(a.headers,()=>O.trace(n.BaseServerSpan.handleRequest,{spanName:`${N} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":N,"http.target":a.url}},h),void 0,!Q))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:M,isOnDemandRevalidate:C})},!1,B),I)throw b;return await (0,p.I)(U,V,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},53021:(a,b,c)=>{"use strict";function d(a){if(!a)return"";let b=a,c="\x3c!-- PI_FILE_ATTACHMENTS_START --\x3e",d="\x3c!-- PI_FILE_ATTACHMENTS_END --\x3e";if(b.includes(c)){let a=b.indexOf(c),e=b.indexOf(d);b=-1!==e&&e>a?b.substring(0,a)+b.substring(e+d.length):b.substring(0,a)}return(b=(b=(b=b.replace(/📄\s*\[已上传文件到工作区\][\s\S]*/g,"")).replace(/^[-\*\s•]*temp\/[^\r\n]*/gim,"")).replace(/^📄\s*\[已上传文件到工作区\][^\r\n]*/gim,"")).trim()}c.d(b,{tH:()=>d})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{},99719:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>i,dynamic:()=>j}),c(23582);var e=c(23211),f=c(75430),g=c(53021),h=a([f]);f=(h.then?(await h)():h)[0];let j="force-dynamic";async function i(a){let b,c,d="",h="mimo_default",i="mimo-v2.5-tts",j="mimo-v2.5-tts",k="mimo_default",l="https://token-plan-cn.xiaomimimo.com/v1";try{let l=await a.json();if(d=(0,g.tH)(l.text),b=l.style,void 0!==l.voice&&(h=l.voice),void 0!==l.modelId&&(i=l.modelId),c=l.voiceDesignPrompt,j=i,k=h,!d)return e.NextResponse.json({error:"Text is required for speech synthesis"},{status:400});let m=f.AuthStorage.create(),n=f.ModelRegistry.create(m),o="",p="https://token-plan-cn.xiaomimimo.com/v1",q=n.getAvailable().find(a=>a.id===i)||n.getAll().find(a=>a.id===i);if(q){let a=await n.getApiKeyAndHeaders(q);a.ok&&a.apiKey&&(o=a.apiKey),q.baseUrl&&(p=q.baseUrl)}if(!o){let a=m.get("mimo"),b=m.get("lingya"),c=m.get("xiaomi-token-plan"),d=m.get("xiaomi-token-plan-cn");(o=a?.key||b?.key||c?.key||d?.key||"")||(o=process.env.LINGYA_API_KEY||process.env.OPENAI_API_KEY||""),o===process.env.LINGYA_API_KEY&&process.env.LINGYA_API_URL?p=process.env.LINGYA_API_URL:d?.key&&o===d.key?p="https://token-plan-cn.xiaomimimo.com/v1":c?.key&&o===c.key&&(p="https://token-plan.api.xiaomi.net/v1")}if(!o)return e.NextResponse.json({error:"未检测到 MiMo/Lingya/Xiaomi API Key,请先在侧边栏底部的 Models 中配置 API Key,或在系统环境变量中设置 LINGYA_API_KEY。"},{status:400});i.toLowerCase().includes("voicedesign")||i.toLowerCase().includes("design");let r=i.toLowerCase().includes("voiceclone")||i.toLowerCase().includes("clone");j=i,k=h,r&&(h&&h.startsWith("data:")?(h.startsWith("data:audio/webm;")||h.startsWith("data:audio/ogg;")||h.startsWith("data:audio/m4a;")||h.startsWith("data:audio/webm,"))&&(console.log("[tts-synthesize] Translating unsupported browser audio format to wav header for MiMo compatibility."),k=h.replace(/^data:audio\/[^;]+;/,"data:audio/wav;")):(console.log("[tts-synthesize] Voice clone selected but voice parameter is not a DataURL. Falling back to standard mimo-v2.5-tts."),j="mimo-v2.5-tts",k="mimo_default"));let s=j.toLowerCase().includes("voicedesign")||j.toLowerCase().includes("design"),t="";if(s){let a=c?.trim()||"A warm natural conversational voice",d=b?.trim()?`, in this style: ${b}`:"";t=`${a}${d}`.trim()}else t=b?.trim()?`Speak in this style: ${b}`:"speak naturally in a warm conversational tone.";let u={model:j,messages:[{role:"user",content:t},{role:"assistant",content:d}],audio:{}};s||(u.audio.voice=k);let v=`${p}/chat/completions`;console.log(`[tts-synthesize] Sending request to endpoint: ${v}`),console.log("[tts-synthesize] Request Body:",JSON.stringify(u,null,2));let w=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify(u)});if(!w.ok){let a=await w.json().catch(()=>({}));console.error("[tts-synthesize] Xiaomi API error response:",JSON.stringify(a));let b=a.error?.message||a.error||JSON.stringify(a),c=a.error?.param?` (参数错误字段: ${a.error.param})`:"";return e.NextResponse.json({error:`Xiaomi TTS API 返回错误 (HTTP ${w.status}): ${b}${c}`},{status:w.status})}let x=await w.json(),y=x.choices?.[0]?.message?.audio?.data;if(!y)return console.error("[tts-synthesize] Response is missing audio data:",JSON.stringify(x)),e.NextResponse.json({error:"小米 API 响应中缺少 audio.data 字段,请确认使用的是 mimo-v2.5-tts 模型。"},{status:500});return e.NextResponse.json({audioUrl:`data:audio/mp3;base64,${y}`})}catch(a){return console.error("[tts-synthesize] Unexpected error:",a),e.NextResponse.json({error:`TTS 接口出错: ${String(a)}`,debug:{modelId:i,finalModelId:void 0!==j?j:void 0,voice:void 0!==h?h:void 0,finalVoice:void 0!==k&&k?k.startsWith("data:")?`DataURL(${k.length}B)`:k:void 0,baseUrl:void 0!==l?l:void 0,endpoint:void 0!==l?`${l}/chat/completions`:void 0,hasApiKey:!1,apiKeyPrefix:void 0,errorStack:a?.stack||String(a),errorCause:a?.cause?String(a.cause):a?.message||String(a)}},{status:500})}}d()}catch(a){d(a)}})}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[741,813],()=>b(b.s=34372));module.exports=c})();
|