1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2398],{83563:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/settings/ai",function(){return n(9244)}])},77248:function(e,t,n){"use strict";n.d(t,{NZ:function(){return s},Zg:function(){return o},eW:function(){return l},gy:function(){return i},ht:function(){return c},qo:function(){return d},rY:function(){return r}});var a=n(84858);let l=()=>(0,a.SC)("/api/admin/settings/ai"),s=e=>(0,a.SC)("/api/admin/settings/ai",{method:"PUT",body:JSON.stringify(e)}),i=()=>(0,a.SC)("/api/admin/ai-prompts"),r=e=>(0,a.SC)("/api/admin/ai-prompts",{method:"POST",body:JSON.stringify(e)}),d=(e,t)=>(0,a.SC)(`/api/admin/ai-prompts/${e}`,{method:"PATCH",body:JSON.stringify(t)}),o=e=>(0,a.SC)(`/api/admin/ai-prompts/${e}`,{method:"DELETE"}),c=(e,t)=>(0,a.SC)("/api/admin/ai/run",{method:"POST",body:JSON.stringify({key:e,input:t})})},9244:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return x}});var a=n(85893),l=n(67294),s=n(41664),i=n.n(s),r=n(44389),d=n(49759),o=n(32474),c=n(77248);let u=[{key:"settings",label:"Ú©ÙÛØ¯ Ù Ù
دÙ"},{key:"prompts",label:"پراÙ
پتâÙØ§"}];function x(){let[e,t]=(0,l.useState)("settings");return(0,a.jsx)(d.Z,{title:"ÙÙØ´ Ù
صÙÙØ¹Û",breadcrumb:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i(),{href:"/admin",children:"Ø¯Ø§Ø´Ø¨ÙØ±Ø¯"})," / ",(0,a.jsx)(i(),{href:"/admin/settings",children:"ØªÙØ¸ÛÙ
ات"})]}),children:(0,a.jsxs)("div",{className:"flex flex-col gap-y-16",children:[(0,a.jsx)(o.Qm,{tabs:u,value:e,onChange:t}),"settings"===e&&(0,a.jsx)(m,{}),"prompts"===e&&(0,a.jsx)(h,{})]})})}function m(){let{data:e,isLoading:t,mutate:n}=(0,r.u)("ai-settings",c.eW),[s,i]=(0,l.useState)(""),[d,u]=(0,l.useState)(""),[x,m]=(0,l.useState)(!1),[h,p]=(0,l.useState)(null),[g,f]=(0,l.useState)(!1);if(t||!e)return(0,a.jsx)(o.Od,{className:"h-[240px]"});async function j(){m(!0),p(null),f(!1);try{await (0,c.NZ)({apiKey:s||void 0,defaultModel:d.trim()||void 0}),i(""),await n(),f(!0)}catch(e){p(e instanceof Error?e.message:"Ø°Ø®ÛØ±Ù ÙØ´Ø¯")}finally{m(!1)}}return(0,a.jsxs)(o.Zb,{className:"p-20 max-w-[560px]",children:[(0,a.jsxs)("p",{className:"text-12 leading-20 text-gray-6C6A7D mb-16",children:["Ú©ÙÛØ¯ از"," ",(0,a.jsx)("a",{href:"https://openrouter.ai/keys",target:"_blank",rel:"noreferrer",className:"text-primary-dark underline",children:"openrouter.ai"})," ","Ú¯Ø±ÙØªÙ Ù
ÛâØ´ÙØ¯ â ÛÚ© API سازگار با OpenAI ک٠پشت ÛÚ© Ú©ÙÛØ¯Ø ÙØ± Ù
دÙÛ (جÙ
ÛÙØ§ÛØ GPTØ Ú©ÙÙØ¯Ø â¦) را سر٠Ù
ÛâÚ©ÙØ¯. ÙØ§Ù
Ù
Ø¯Ù Ø¨Ø§ÛØ¯ ب٠شکÙ"," ",(0,a.jsx)("code",{dir:"ltr",className:"text-11",children:"google/gemini-2.0-flash-001"})," Ø¨Ø§Ø´Ø¯Ø ÙÙ ÙØ§Ù
خاÙ
Google."]}),(0,a.jsxs)("div",{className:"flex flex-col gap-y-14",children:[(0,a.jsx)(o.gN,{label:"Ú©ÙÛØ¯ API",hint:e.hasApiKey?"Ú©ÙÛØ¯Û Ø°Ø®ÛØ±Ù Ø´Ø¯Ù â Ø¨Ø±Ø§Û تغÛÛØ±Ø Ù
ÙØ¯Ø§Ø± ØªØ§Ø²Ù ÙØ§Ø±Ø¯ Ú©ÙÛØ¯":"ÙÙÙØ² ØªÙØ¸ÛÙ
ÙØ´Ø¯Ù",children:(0,a.jsx)(o.II,{type:"password",value:s,onChange:e=>i(e.target.value),placeholder:e.hasApiKey?"â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢":"sk-or-v1-...",dir:"ltr"})}),(0,a.jsx)(o.gN,{label:"Ù
Ø¯Ù Ù¾ÛØ´âÙØ±Ø¶",children:(0,a.jsx)(o.II,{value:d||e.defaultModel,onChange:e=>u(e.target.value),placeholder:"google/gemini-2.0-flash-001",dir:"ltr"})})]}),!!h&&(0,a.jsx)("p",{className:"mt-14 rounded-10 bg-[#FEE] px-14 py-10 text-13 text-[#C62828]",children:h}),(0,a.jsxs)("div",{className:"mt-20 flex items-center gap-x-10",children:[(0,a.jsx)(o.zx,{disabled:x,onClick:j,children:x?"در ØØ§Ù Ø°Ø®ÛØ±Ùâ¦":"Ø°Ø®ÛØ±Ù"}),g&&(0,a.jsx)("span",{className:"text-12 text-green-600",children:"Ø°Ø®ÛØ±Ù شد"})]})]})}function h(){let{data:e,isLoading:t,mutate:n}=(0,r.u)("ai-prompts",c.gy),[s,i]=(0,l.useState)(null);return t?(0,a.jsx)(o.Od,{className:"h-[240px]"}):(0,a.jsxs)("div",{className:"flex flex-col gap-y-16",children:[(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsxs)(o.zx,{onClick:()=>i("new"),children:[(0,a.jsx)("i",{className:"icon-Plus text-16"})," پراÙ
پت Ø¬Ø¯ÛØ¯"]})}),(0,a.jsxs)(o.Zb,{className:"p-20",children:[(null==e?void 0:e.length)===0&&(0,a.jsx)(o.ub,{text:"پراÙ
Ù¾ØªÛ ØªØ¹Ø±ÛÙ ÙØ´Ø¯Ù"}),(0,a.jsx)("div",{className:"flex flex-col gap-y-10",children:null==e?void 0:e.map(e=>(0,a.jsxs)("button",{onClick:()=>i(e),className:"flex items-center gap-x-10 p-12 rounded-10 border border-gray-E5E5E6 hover:border-primary-main transition text-right",children:[(0,a.jsx)("i",{className:"icon-Settings text-18 text-gray-9B9BAA shrink-0"}),(0,a.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,a.jsx)("span",{className:"block text-13 leading-20 font-m text-black truncate",children:e.label}),(0,a.jsxs)("span",{className:"block text-11 text-gray-9B9BAA truncate",dir:"ltr",children:[e.key,e.model?` \xb7 ${e.model}`:""]})]})]},e.id))})]}),!!s&&(0,a.jsx)(p,{prompt:"new"===s?null:s,onClose:()=>i(null),onSaved:()=>{i(null),n()}})]})}function p(e){let{prompt:t,onClose:n,onSaved:s}=e,[i,r]=(0,l.useState)((null==t?void 0:t.key)??""),[d,u]=(0,l.useState)((null==t?void 0:t.label)??""),[x,m]=(0,l.useState)((null==t?void 0:t.prompt)??""),[h,p]=(0,l.useState)((null==t?void 0:t.model)??""),[g,f]=(0,l.useState)(!1),[j,b]=(0,l.useState)(null);async function y(){f(!0),b(null);try{let e={key:i.trim(),label:d.trim(),prompt:x,model:h.trim()||null};t?await (0,c.qo)(t.id,e):await (0,c.rY)(e),s()}catch(e){b(e instanceof Error?e.message:"Ø°Ø®ÛØ±Ù ÙØ´Ø¯")}finally{f(!1)}}async function N(){t&&window.confirm(`پراÙ
پت \xab${t.label}\xbb ØØ°Ù Ø´ÙØ¯Ø`)&&(await (0,c.Zg)(t.id),s())}return(0,a.jsx)(o.u_,{open:!0,onClose:n,title:t?`ÙÛØ±Ø§ÛØ´ \xab${t.label}\xbb`:"پراÙ
پت Ø¬Ø¯ÛØ¯",width:"max-w-[640px]",children:(0,a.jsxs)("div",{className:"flex flex-col gap-y-12",children:[(0,a.jsxs)("div",{className:"grid md:grid-cols-2 gap-12",children:[(0,a.jsx)(o.gN,{label:"عÙÙØ§Ù",children:(0,a.jsx)(o.II,{value:d,onChange:e=>u(e.target.value),placeholder:"بازÙÙÛØ³Û ØªÙØ¶ÛØØ§Øª"})}),(0,a.jsx)(o.gN,{label:"Ú©ÙÛØ¯",hint:"Ø´ÙØ§Ø³ÙâØ§Û Ú©Ù Ú©Ø¯ از Ø¢Ù Ø§Ø³ØªÙØ§Ø¯Ù Ù
ÛâÚ©ÙØ¯ â ØªØºÛÛØ± ÙØ¯ÙÛØ¯ Ù
گر Ù
Ø·Ù
ئÙÛØ¯",children:(0,a.jsx)(o.II,{value:i,onChange:e=>r(e.target.value),placeholder:"residence_description_rewrite",dir:"ltr"})})]}),(0,a.jsx)(o.gN,{label:"Ù
ت٠پراÙ
پت",hint:"Ø¬Ø§Û {text} با Ù
ØªÙ ÙØ±ÙØ¯Û ÙØ§ÙØ¹Û Ø¬Ø§ÛگزÛÙ Ù
ÛâØ´ÙØ¯",children:(0,a.jsx)("textarea",{value:x,onChange:e=>m(e.target.value),rows:8,className:"w-full rounded-10 border border-gray-E5E5E6 p-12 text-13 leading-22 focus:border-primary-main focus:outline-none"})}),(0,a.jsx)(o.gN,{label:"Ù
د٠(Ø§Ø®ØªÛØ§Ø±Û)",hint:"خاÙÛ Ø¨Ú¯Ø°Ø§Ø±ÛØ¯ تا Ù
Ø¯Ù Ù¾ÛØ´âÙØ±Ø¶ Ø§Ø³ØªÙØ§Ø¯Ù Ø´ÙØ¯",children:(0,a.jsx)(o.II,{value:h,onChange:e=>p(e.target.value),placeholder:"google/gemini-2.0-flash-001",dir:"ltr"})}),!!j&&(0,a.jsx)("p",{className:"text-13 text-[#C62828]",children:j}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[!!t&&(0,a.jsx)(o.zx,{type:"button",variant:"danger",onClick:N,children:"ØØ°Ù"}),(0,a.jsxs)("div",{className:"flex items-center gap-x-10 mr-auto",children:[(0,a.jsx)(o.zx,{type:"button",variant:"secondary",onClick:n,children:"Ø§ÙØµØ±Ø§Ù"}),(0,a.jsx)(o.zx,{disabled:g||!i.trim()||!d.trim()||!x.trim(),onClick:y,children:g?"در ØØ§Ù Ø°Ø®ÛØ±Ù...":"Ø°Ø®ÛØ±Ù"})]})]})]})})}}},function(e){e.O(0,[4389,9759,9774,2888,179],function(){return e(e.s=83563)}),_N_E=e.O()}]);
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.