Files
2026-05-13 14:20:41 +00:00

1 line
11 KiB
JavaScript

(()=>{var e={};e.id=681,e.ids=[681],e.modules={2934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},4580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},5869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},6108:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GlobalError:()=>o.a,__next_app__:()=>u,originalPathname:()=>c,pages:()=>p,routeModule:()=>x,tree:()=>d}),r(2712),r(1506),r(5866);var i=r(3191),n=r(8716),a=r(7922),o=r.n(a),s=r(5231),l={};for(let e in s)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(l[e]=()=>s[e]);r.d(t,l);let d=["",{children:["prompt",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(r.bind(r,2712)),"/opt/uno-click/site/app/prompt/page.tsx"]}]},{}]},{layout:[()=>Promise.resolve().then(r.bind(r,1506)),"/opt/uno-click/site/app/layout.tsx"],"not-found":[()=>Promise.resolve().then(r.t.bind(r,5866,23)),"next/dist/client/components/not-found-error"]}],p=["/opt/uno-click/site/app/prompt/page.tsx"],c="/prompt/page",u={require:r,loadChunk:()=>Promise.resolve()},x=new i.AppPageRouteModule({definition:{kind:n.x.APP_PAGE,page:"/prompt/page",pathname:"/prompt",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:d}})},4199:()=>{},313:(e,t,r)=>{Promise.resolve().then(r.bind(r,7338))},9682:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,2994,23)),Promise.resolve().then(r.t.bind(r,6114,23)),Promise.resolve().then(r.t.bind(r,9727,23)),Promise.resolve().then(r.t.bind(r,9671,23)),Promise.resolve().then(r.t.bind(r,1868,23)),Promise.resolve().then(r.t.bind(r,4759,23))},7338:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>s});var i=r(326),n=r(7577),a=r(5047);function o(){let e=(0,a.useRouter)(),t=(0,a.useSearchParams)().get("scenario")||"nano-banana",r={"nano-banana":{name:"Nano Banana",desc:"Генерация изображений по промпту",icon:"\uD83C\uDFA8",class:"blue",stepId:"1"},"demo-scenario":{name:"Demo Scenario",desc:"Тестовый сценарий с подтверждением",icon:"\uD83E\uDDEA",class:"green",stepId:"collect-input"}},o=r[t]||r["nano-banana"],[s,d]=(0,n.useState)(""),[p,c]=(0,n.useState)(null),[u,x]=(0,n.useState)(null),[g,m]=(0,n.useState)(""),[f,h]=(0,n.useState)(!1),[b,y]=(0,n.useState)(""),[v,j]=(0,n.useState)(""),P=(0,n.useRef)(null),S=(0,n.useRef)(null);async function w(e,t,r){let i=new FormData;i.append("file",e),i.append("generationUuid",t),i.append("generationStepId",r);let n=await fetch("/api/upload/image",{method:"POST",headers:{"x-csrf-token":v},body:i,credentials:"same-origin"}),a=await n.json();if(!n.ok)throw Error(a.message||"Ошибка загрузки файла");return a.data.s3Key}async function k(r){r.preventDefault(),h(!0),m(""),y("Запуск сценария...");try{let r;let i=await fetch(`/api/scenario/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json","x-csrf-token":v},credentials:"same-origin",body:JSON.stringify({})}),n=await i.json();if(!i.ok)throw Error(n.message||"Ошибка запуска сценария");let a=n.generationUuid;if(p){y("Загрузка файла...");let e=await fetch(`/api/scenario/${t}/step/${o.stepId}/record`,{method:"POST",headers:{"Content-Type":"application/json","x-csrf-token":v},credentials:"same-origin",body:JSON.stringify({prompt:s})}),i=(await e.json()).stepRecordId;r=await w(p,a,i)}let l={prompt:s};r&&(l.imageKey=r),y("Генерация...");let d=await fetch(`/api/scenario/${t}/step/${o.stepId}`,{method:"POST",headers:{"Content-Type":"application/json","x-csrf-token":v},credentials:"same-origin",body:JSON.stringify(l)}),c=await d.json();if(!d.ok)throw Error(c.message||"Ошибка выполнения шага");e.push(`/result?generationUuid=${a}`)}catch(e){m(e instanceof Error?e.message:"Неизвестная ошибка"),h(!1),y("")}}return i.jsx("div",{style:l.page,children:(0,i.jsxs)("div",{style:l.container,children:[(0,i.jsxs)("div",{style:l.header,children:[i.jsx("h1",{style:l.headerTitle,children:"Создание"}),i.jsx("button",{onClick:()=>e.push("/dashboard"),style:l.btnSmall,children:"Назад"})]}),(0,i.jsxs)("div",{style:l.card,children:[(0,i.jsxs)("div",{style:l.scenarioInfo,children:[i.jsx("div",{style:{...l.scenarioIcon,...l[o.class]},children:o.icon}),(0,i.jsxs)("div",{children:[i.jsx("div",{style:l.scenarioName,children:o.name}),i.jsx("div",{style:l.scenarioDesc,children:o.desc})]})]}),g&&i.jsx("div",{style:l.error,children:g}),(0,i.jsxs)("form",{onSubmit:k,children:[(0,i.jsxs)("div",{style:l.formGroup,children:[i.jsx("label",{htmlFor:"prompt",style:l.label,children:"Опишите, что хотите создать"}),i.jsx("textarea",{id:"prompt",value:s,onChange:e=>d(e.target.value),required:!0,placeholder:"Например: кот в космосе, цифровая иллюстрация, яркие цвета...",style:l.textarea})]}),(0,i.jsxs)("div",{style:l.formGroup,children:[i.jsx("label",{style:l.label,children:"Изображение (опционально)"}),(0,i.jsxs)("div",{ref:S,style:l.fileUpload,onClick:()=>P.current?.click(),children:[i.jsx("input",{ref:P,type:"file",accept:"image/jpeg,image/jpg,image/png,image/gif,image/webp",onChange:function(e){e.target.files?.length&&function(e){if(!["image/jpeg","image/jpg","image/png","image/gif","image/webp"].includes(e.type)){m("Недопустимый тип файла. Разрешены: JPEG, PNG, GIF, WebP");return}if(e.size>10485760){m("Файл слишком большой. Максимум: 10MB");return}c(e);let t=new FileReader;t.onload=e=>x(e.target?.result),t.readAsDataURL(e),m("")}(e.target.files[0])},style:{display:"none"}}),(0,i.jsxs)("div",{style:l.fileUploadLabel,children:[i.jsx("div",{style:l.fileUploadIcon,children:"\uD83D\uDCC1"}),i.jsx("div",{style:l.fileUploadText,children:"Нажмите для загрузки или перетащите файл"}),i.jsx("div",{style:{...l.fileUploadText,fontSize:"12px",color:"#999",marginTop:"4px"},children:"JPEG, PNG, GIF, WebP до 10MB"})]})]}),u&&(0,i.jsxs)("div",{style:l.filePreview,children:[i.jsx("img",{src:u,alt:"Preview",style:l.previewImg}),(0,i.jsxs)("div",{style:l.filePreviewInfo,children:[i.jsx("div",{style:l.filePreviewName,children:p?.name}),i.jsx("div",{children:p&&function(e){if(0===e)return"0 Bytes";let t=Math.floor(Math.log(e)/Math.log(1024));return Math.round(e/Math.pow(1024,t)*100)/100+" "+["Bytes","KB","MB","GB"][t]}(p.size)})]}),i.jsx("button",{type:"button",onClick:function(){c(null),x(null),P.current&&(P.current.value="")},style:l.fileRemove,children:"\xd7"})]})]}),i.jsx("button",{type:"submit",disabled:f,style:{...l.btnPrimary,...f?l.btnDisabled:{}},children:f?"Запуск...":"Создать"})]}),b&&(0,i.jsxs)("div",{style:l.status,children:[i.jsx("span",{style:l.spinner}),i.jsx("span",{children:b})]})]})]})})}function s(){return i.jsx(n.Suspense,{fallback:i.jsx("div",{style:l.page,children:i.jsx("div",{style:l.container,children:i.jsx("div",{style:l.emptyState,children:"Загрузка..."})})}),children:i.jsx(o,{})})}let l={page:{minHeight:"100vh",padding:"40px 20px",background:"#f5f5f5"},container:{maxWidth:"600px",margin:"0 auto"},emptyState:{textAlign:"center",padding:"60px 20px",color:"#666"},header:{background:"white",padding:"20px 30px",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.1)",marginBottom:"20px",display:"flex",justifyContent:"space-between",alignItems:"center"},headerTitle:{fontSize:"20px",fontWeight:600,color:"#333"},btnSmall:{background:"none",border:"1px solid #ddd",padding:"8px 16px",borderRadius:"6px",cursor:"pointer",fontSize:"14px",color:"#666"},card:{background:"white",padding:"30px",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.1)"},scenarioInfo:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"24px",padding:"16px",background:"#f8f9fa",borderRadius:"6px"},scenarioIcon:{width:"40px",height:"40px",borderRadius:"8px",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"20px"},blue:{background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)"},green:{background:"linear-gradient(135deg, #11998e 0%, #38ef7d 100%)"},scenarioName:{fontWeight:600,color:"#333"},scenarioDesc:{fontSize:"13px",color:"#666"},formGroup:{marginBottom:"20px"},label:{display:"block",marginBottom:"8px",fontSize:"14px",color:"#333",fontWeight:500},textarea:{width:"100%",padding:"14px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",fontFamily:"inherit",resize:"vertical",minHeight:"120px"},fileUpload:{border:"2px dashed #ddd",borderRadius:"6px",padding:"20px",textAlign:"center",cursor:"pointer",transition:"all 0.2s",marginBottom:"10px"},fileUploadLabel:{display:"block",cursor:"pointer"},fileUploadIcon:{fontSize:"32px",marginBottom:"8px"},fileUploadText:{fontSize:"14px",color:"#666"},filePreview:{display:"flex",alignItems:"center",gap:"10px",marginTop:"10px",padding:"10px",background:"#f8f9fa",borderRadius:"6px"},previewImg:{maxWidth:"80px",maxHeight:"80px",borderRadius:"4px",objectFit:"cover"},filePreviewInfo:{flex:1,fontSize:"13px",color:"#666"},filePreviewName:{fontWeight:500,color:"#333",marginBottom:"4px"},fileRemove:{background:"none",border:"none",color:"#dc3545",cursor:"pointer",fontSize:"18px",padding:"4px 8px"},btnPrimary:{padding:"12px 24px",background:"#007bff",color:"white",border:"none",borderRadius:"6px",fontSize:"14px",fontWeight:500,cursor:"pointer",width:"100%"},btnDisabled:{background:"#ccc",cursor:"not-allowed"},error:{background:"#fee",color:"#c00",padding:"12px",borderRadius:"6px",marginBottom:"20px",fontSize:"14px"},status:{textAlign:"center",padding:"20px",color:"#666"},spinner:{display:"inline-block",width:"20px",height:"20px",border:"2px solid #ddd",borderTopColor:"#007bff",borderRadius:"50%",animation:"spin 1s linear infinite",marginRight:"10px",verticalAlign:"middle"}}},5047:(e,t,r)=>{"use strict";var i=r(7389);r.o(i,"useRouter")&&r.d(t,{useRouter:function(){return i.useRouter}}),r.o(i,"useSearchParams")&&r.d(t,{useSearchParams:function(){return i.useSearchParams}})},1506:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a,metadata:()=>n});var i=r(9510);r(7272);let n={title:"Uno Click",description:"Uno Click - платформа для генерации контента"};function a({children:e}){return i.jsx("html",{lang:"ru",children:i.jsx("body",{children:e})})}},2712:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>i});let i=(0,r(8570).createProxy)(String.raw`/opt/uno-click/site/app/prompt/page.tsx#default`)},7272:()=>{}};var t=require("../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),i=t.X(0,[819],()=>r(6108));module.exports=i})();