(()=>{var a={};a.id=115,a.ids=[115],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")},5262:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>i,dynamic:()=>j});var e=c(23211),f=c(75430),g=a([f]);f=(g.then?(await g)():g)[0];let j="force-dynamic";function h(a){return a.replace(/(好的，作为顶级\s*AI\s*图像提示词工程专家.*?[。！!])[\s\r\n]*[-*~_]{3,}[\s\r\n]*(###\s*(?:🖼️\s*)?深度图像拆解分析)/gi,"$1\n$2")}async function i(a){try{let b,{image:c,mimeType:d,provider:g,modelId:i}=await a.json();if(!c||!d)return e.NextResponse.json({error:"image and mimeType are required"},{status:400});let j=c.trim();if(j.startsWith("data:")){let a=j.indexOf(",");-1!==a&&(j=j.substring(a+1))}j=j.replace(/\s/g,"");try{if(b=Buffer.from(j,"base64"),0===b.length)return e.NextResponse.json({error:"Image data decoded to empty buffer — the base64 payload may be corrupt."},{status:400});j=b.toString("base64")}catch{return e.NextResponse.json({error:"Failed to decode base64 image data."},{status:400})}let k=d.toLowerCase().trim().split(";")[0].trim();"image/jpg"===k&&(k="image/jpeg");let l=b;255===l[0]&&216===l[1]&&255===l[2]?k="image/jpeg":137===l[0]&&80===l[1]&&78===l[2]&&71===l[3]?k="image/png":71===l[0]&&73===l[1]&&70===l[2]?k="image/gif":82===l[0]&&73===l[1]&&70===l[2]&&70===l[3]&&87===l[8]&&69===l[9]&&66===l[10]&&80===l[11]?k="image/webp":66===l[0]&&77===l[1]?k="image/bmp":["image/jpeg","image/png","image/gif","image/webp","image/bmp"].includes(k)||(console.warn(`[describe-image] Unknown image magic bytes 0x${l[0]?.toString(16)} 0x${l[1]?.toString(16)} 0x${l[2]?.toString(16)} and unsupported mimeType "${k}", defaulting to image/jpeg`),k="image/jpeg"),console.log(`[describe-image] buffer=${b.length}B, detectedMime=${k}, first4=0x${l[0]?.toString(16)}${l[1]?.toString(16)}${l[2]?.toString(16)}${l[3]?.toString(16)}, base64Len=${j.length}`);let m=f.AuthStorage.create(),n=f.ModelRegistry.create(m),o=g?g.toLowerCase().trim():"",p=i?i.trim():"",q="",r="",s={"Content-Type":"application/json"},t=!1,u=g&&i?n.find(g,i):void 0;if(u){let a=await n.getApiKeyAndHeaders(u);if(!a.ok)return e.NextResponse.json({error:`无法解析模型认证: ${a.error}`},{status:400});r=`${u.baseUrl}/chat/completions`,a.apiKey&&(q=a.apiKey,s.Authorization=`Bearer ${q}`),a.headers&&(s={...s,...a.headers}),p=u.id,o=u.provider,("google"===o.toLowerCase()||"gemini"===o.toLowerCase())&&(t=!0)}else{if(o){let a=m.get(o);if(a?.key)q=a.key;else for(let a of[`${o.toUpperCase()}_API_KEY`,`${o.toUpperCase().replace("-","_")}_API_KEY`])if(process.env[a]){q=process.env[a];break}}if((o.includes("xiaomi-token-plan")||o.includes("mimo")||o.includes("lingya"))&&process.env.LINGYA_API_KEY&&(q=process.env.LINGYA_API_KEY),!q){let a=m.get("openai");if(a?.key)q=a.key,o="openai",p="gpt-4o-mini";else{let a=m.get("anthropic");a?.key&&(q=a.key,o="anthropic",p="claude-3-5-sonnet-20241022")}}if(!q&&(process.env.OPENAI_API_KEY?(q=process.env.OPENAI_API_KEY,o="openai",p="gpt-4o-mini"):process.env.ANTHROPIC_API_KEY?(q=process.env.ANTHROPIC_API_KEY,o="anthropic",p="claude-3-5-sonnet-20241022"):(process.env.GEMINI_API_KEY||process.env.GOOGLE_API_KEY)&&(q=process.env.GEMINI_API_KEY||process.env.GOOGLE_API_KEY||"",o="google",p="gemini-1.5-flash")),!q)return e.NextResponse.json({error:"未配置可用视觉模型的 API 密钥（OpenAI 或 Anthropic）。请先在侧边栏底部的 Models 中配置 API Key，或在系统环境变量中设置 OPENAI_API_KEY。"},{status:400});s.Authorization=`Bearer ${q}`,r="https://api.openai.com/v1/chat/completions","openrouter"===o?r="https://openrouter.ai/api/v1/chat/completions":o.includes("xiaomi-token-plan")||o.includes("mimo")||o.includes("lingya")?r=process.env.LINGYA_API_URL?`${process.env.LINGYA_API_URL}/chat/completions`:"https://token-plan.api.xiaomi.net/v1/chat/completions":("google"===o||"gemini"===o)&&(t=!0)}let v=`请作为顶级的 AI 图像提示词工程专家（Img2Prompt Expert），为我深度拆解我所上传的这张图片。

请严格按照以下精细化结构对图片进行拆解分析：

1. 核心主体 (core_subject): 画面里主要有什么人或物、在做什么、神态表情如何。
2. 服装/材质 (clothing): 主体的衣着打扮、配饰、或者核心物体的表面材质与细节。
3. 具体地点 (location): 画面所处的具体环境、城市、地标或空间场所。
4. 画面背景 (background): 主体身后的远景、天际线、陪衬元素及空间的左右布局。
5. 光照与色彩 (lighting): 光源方向（如逆光、侧光）、光效类型、色调基调与色彩氛围。
6. 艺术风格 (style): 是什么画风或视觉流派（如：电影感写实摄影、新海诚动漫风、3D渲染、极简主义 UI、胶片摄影等），以及具体的镜头和构图方式（如中景、大光圈虚化、垂直构图）。

---

## 🛠️ 【最终直调用 Prompt】
请根据上述分析，直接组合出可直接复制的流利中文 Prompt。请使用纯英文自然语言或短语（用逗号隔开），以便我直接复制粘贴：`;if(t){let a=await fetch(`https://generativelanguage.googleapis.com/v1beta/models/${p}:generateContent?key=${q}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contents:[{parts:[{text:v},{inlineData:{mimeType:k,data:j}}]}],generationConfig:{maxOutputTokens:1e3}})});if(!a.ok){let b=await a.json();throw Error(`Gemini API returned status ${a.status}: ${JSON.stringify(b)}`)}let b=await a.json(),c=h(b.candidates?.[0]?.content?.parts?.[0]?.text?.trim()||"");return e.NextResponse.json({description:c})}if("anthropic"===o){let a=await fetch("https://api.anthropic.com/v1/messages",{method:"POST",headers:{"x-api-key":q,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:p||"claude-3-5-sonnet-20241022",max_tokens:1e3,messages:[{role:"user",content:[{type:"image",source:{type:"base64",media_type:k,data:j}},{type:"text",text:v}]}]})});if(!a.ok){let b=await a.json();throw Error(`Anthropic API returned status ${a.status}: ${JSON.stringify(b)}`)}let b=await a.json(),c=h(b.content?.[0]?.text?.trim()||"");return e.NextResponse.json({description:c})}{let a=`data:${k};base64,${j}`;p&&p.toLowerCase().includes("mimo")&&p.toLowerCase().includes("flash")&&(p="mimo-v2-omni");let b={model:p,messages:[{role:"user",content:[{type:"text",text:v},{type:"image_url",image_url:{url:a}}]}],max_tokens:1e3};console.log(`[describe-image] Sending to: ${r}`),console.log(`[describe-image] model: ${p}, provider: ${o}`),console.log(`[describe-image] imageUrl prefix: ${a.substring(0,60)}...`),console.log(`[describe-image] headers (keys): ${Object.keys(s).join(", ")}`);let c=await fetch(r,{method:"POST",headers:s,body:JSON.stringify(b)});if(!c.ok){let a=await c.json();throw Error(`${o.toUpperCase()} API returned status ${c.status}: ${JSON.stringify(a)}`)}let d=await c.json(),f=d.choices?.[0]?.message,g=f?.content?.trim()||"";if(!g&&f){let a=f.reasoning_content?.trim()||f.thinking_content?.trim()||f.thinking?.trim()||"";if(a){let b=a.split(/\n\n+/).map(a=>a.trim()).filter(Boolean),c=["不对","等等","可能","但是我","然而我","让我","先得","首先得","再想"];for(let a=b.length-1;a>=0;a--){let d=b[a],e=c.some(a=>d.startsWith(a));if(d.length>=40&&!e){g=d;break}}g||(g=a)}}return e.NextResponse.json({description:h(g)})}}catch(a){return console.error("Error in describe-image API:",a),e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},32035:(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(5262),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/agent/describe-image/route",pathname:"/api/agent/describe-image",filename:"route",bundlePath:"app/api/agent/describe-image/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"D:\\Pi-Web\\pi-web-src\\app\\api\\agent\\describe-image\\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/agent/describe-image/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")},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:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[741,813],()=>b(b.s=32035));module.exports=c})();