You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3921],{83921:function(t,e,a){"use strict";a.r(e),a.d(e,{ContextPrompts:function(){return H},MaskAvatar:function(){return A},MaskConfig:function(){return E},MaskPage:function(){return L}});var n=a(57437),s=a(35499),c=a(68454),i=a(6031),o=a.n(i),l=a(72495),r=a(84004),h=a(12154),d=a(58870),m=a(38669),_=a(15592),p=a(56073),x=a(84193),u=a(36177),k=a(61643),g=a(44922),j=a(42882),C=a(65878),f=a(94008),b=a(13894),v=a(59208),y=a(3109),Z=a.n(y),M=a(2265),P=a(92944),N=a(9792),w=a(75591),T=a(73859),S=a(84717),I=a(75504);function A(t){return t.avatar!==k._G?(0,n.jsx)(f.qE,{avatar:t.avatar}):(0,n.jsx)(f.qE,{model:t.model})}function E(t){let[e,a]=(0,M.useState)(!1),c=(0,g.MG)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(H,{context:t.mask.context,updateContext:e=>{let a=t.mask.context.slice();e(a),t.updateMask(t=>t.context=a)}}),(0,n.jsxs)(C.aV,{children:[(0,n.jsx)(C.HC,{title:b.ZP.Mask.Config.Avatar,children:(0,n.jsx)(C.J2,{content:(0,n.jsx)(f.aR,{onEmojiClick:e=>{t.updateMask(t=>t.avatar=e),a(!1)}}),open:e,onClose:()=>a(!1),children:(0,n.jsx)("div",{tabIndex:0,"aria-label":b.ZP.Mask.Config.Avatar,onClick:()=>a(!0),style:{cursor:"pointer"},children:(0,n.jsx)(A,{avatar:t.mask.avatar,model:t.mask.modelConfig.model})})})}),(0,n.jsx)(C.HC,{title:b.ZP.Mask.Config.Name,children:(0,n.jsx)("input",{"aria-label":b.ZP.Mask.Config.Name,type:"text",value:t.mask.name,onInput:e=>t.updateMask(t=>{t.name=e.currentTarget.value})})}),(0,n.jsx)(C.HC,{title:b.ZP.Mask.Config.HideContext.Title,subTitle:b.ZP.Mask.Config.HideContext.SubTitle,children:(0,n.jsx)("input",{"aria-label":b.ZP.Mask.Config.HideContext.Title,type:"checkbox",checked:t.mask.hideContext,onChange:e=>{t.updateMask(t=>{t.hideContext=e.currentTarget.checked})}})}),c.enableArtifacts&&(0,n.jsx)(C.HC,{title:b.ZP.Mask.Config.Artifacts.Title,subTitle:b.ZP.Mask.Config.Artifacts.SubTitle,children:(0,n.jsx)("input",{"aria-label":b.ZP.Mask.Config.Artifacts.Title,type:"checkbox",checked:!1!==t.mask.enableArtifacts,onChange:e=>{t.updateMask(t=>{t.enableArtifacts=e.currentTarget.checked})}})}),c.enableCodeFold&&(0,n.jsx)(C.HC,{title:b.ZP.Mask.Config.CodeFold.Title,subTitle:b.ZP.Mask.Config.CodeFold.SubTitle,children:(0,n.jsx)("input",{"aria-label":b.ZP.Mask.Config.CodeFold.Title,type:"checkbox",checked:!1!==t.mask.enableCodeFold,onChange:e=>{t.updateMask(t=>{t.enableCodeFold=e.currentTarget.checked})}})}),t.shouldSyncFromGlobal?null:(0,n.jsx)(C.HC,{title:b.ZP.Mask.Config.Share.Title,subTitle:b.ZP.Mask.Config.Share.SubTitle,children:(0,n.jsx)(s.h,{aria:b.ZP.Mask.Config.Share.Title,icon:(0,n.jsx)(x.Z,{}),text:b.ZP.Mask.Config.Share.Action,onClick:()=>{let e="".concat(location.protocol,"//").concat(location.host,"/#").concat(w.y$.NewChat,"?mask=").concat(t.mask.id);(0,P.vQ)(e)}})}),t.shouldSyncFromGlobal?(0,n.jsx)(C.HC,{title:b.ZP.Mask.Config.Sync.Title,subTitle:b.ZP.Mask.Config.Sync.SubTitle,children:(0,n.jsx)("input",{"aria-label":b.ZP.Mask.Config.Sync.Title,type:"checkbox",checked:t.mask.syncGlobalConfig,onChange:async e=>{let a=e.currentTarget.checked;a&&await (0,C.i0)(b.ZP.Mask.Config.Sync.Confirm)?t.updateMask(t=>{t.syncGlobalConfig=a,t.modelConfig={...c.modelConfig}}):a||t.updateMask(t=>{t.syncGlobalConfig=a})}})}):null]}),(0,n.jsxs)(C.aV,{children:[(0,n.jsx)(N.j,{modelConfig:{...t.mask.modelConfig},updateConfig:e=>{if(t.readonly)return;let a={...t.mask.modelConfig};e(a),t.updateMask(t=>{t.modelConfig=a,t.syncGlobalConfig=!1})}}),t.extraListItems]})]})}function F(t){let[e,a]=(0,M.useState)(!1);return(0,n.jsxs)("div",{className:Z()["context-prompt-row"],children:[!e&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:Z()["context-drag"],children:(0,n.jsx)(u.Z,{})}),(0,n.jsx)(C.Ph,{value:t.prompt.role,className:Z()["context-role"],onChange:e=>t.update({...t.prompt,role:e.target.value}),children:j.K$.map(t=>(0,n.jsx)("option",{value:t,children:t},t))})]}),(0,n.jsx)(C.II,{value:(0,P.YK)(t.prompt),type:"text",className:Z()["context-content"],rows:e?5:1,onFocus:()=>a(!0),onBlur:()=>{var t,e;a(!1),null===(e=window)||void 0===e||null===(t=e.getSelection())||void 0===t||t.removeAllRanges()},onInput:e=>t.update({...t.prompt,content:e.currentTarget.value})}),!e&&(0,n.jsx)(s.h,{icon:(0,n.jsx)(_.Z,{}),className:Z()["context-delete-button"],onClick:()=>t.remove(),bordered:!0})]})}function H(t){let e=t.context,a=(e,a)=>{t.updateContext(t=>t.splice(a,0,e))},c=e=>{t.updateContext(t=>t.splice(e,1))},i=(e,a)=>{t.updateContext(t=>{let n=(0,P.Bs)(t[e]);if(t[e]=a,n.length>0){let a=[{type:"text",text:(0,P.YK)(t[e])}];for(let t of n)a.push({type:"image_url",image_url:{url:t}});t[e].content=a}})};return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:Z()["context-prompt"],style:{marginBottom:20},children:[(0,n.jsx)(S.Z5,{onDragEnd:a=>{if(!a.destination)return;let n=function(t,e,a){let n=[...t],[s]=n.splice(e,1);return n.splice(a,0,s),n}(e,a.source.index,a.destination.index);t.updateContext(t=>{t.splice(0,t.length,...n)})},children:(0,n.jsx)(S.bK,{droppableId:"context-prompt-list",children:t=>(0,n.jsxs)("div",{ref:t.innerRef,...t.droppableProps,children:[e.map((t,e)=>(0,n.jsx)(S._l,{draggableId:t.id||e.toString(),index:e,children:s=>(0,n.jsxs)("div",{ref:s.innerRef,...s.draggableProps,...s.dragHandleProps,children:[(0,n.jsx)(F,{index:e,prompt:t,update:t=>i(e,t),remove:()=>c(e)}),(0,n.jsx)("div",{className:Z()["context-prompt-insert"],onClick:()=>{a((0,g.tn)({role:"user",content:"",date:new Date().toLocaleString()}),e+1)},children:(0,n.jsx)(d.Z,{})})]})},t.id)),t.placeholder]})})}),0===t.context.length&&(0,n.jsx)("div",{className:Z()["context-prompt-row"],children:(0,n.jsx)(s.h,{icon:(0,n.jsx)(d.Z,{}),text:b.ZP.Context.Add,bordered:!0,className:Z()["context-prompt-button"],onClick:()=>a((0,g.tn)({role:"user",content:"",date:""}),t.context.length)})})]})})}function L(){var t;let e=(0,v.s0)(),a=(0,k.Zy)(),i=(0,g.aK)(),u=a.language,j=a.getAll().filter(t=>!u||t.lang===u),[f,y]=(0,M.useState)([]),[Z,N]=(0,M.useState)(""),S=Z.length>0?f:j,F=t=>{N(t),t.length>0?y(j.filter(e=>e.name.toLowerCase().includes(t.toLowerCase()))):y(j)},[H,L]=(0,M.useState)(),R=null!==(t=a.get(H))&&void 0!==t?t:T.$n.get(H),U=()=>{(0,P.j2)().then(t=>{try{let e=JSON.parse(t);if(Array.isArray(e)){for(let t of e)t.name&&a.create(t);return}e.name&&a.create(e)}catch(t){}})};return(0,n.jsxs)(c.S,{children:[(0,n.jsxs)("div",{className:o()["mask-page"],children:[(0,n.jsxs)("div",{className:"window-header",children:[(0,n.jsxs)("div",{className:"window-header-title",children:[(0,n.jsx)("div",{className:"window-header-main-title",children:b.ZP.Mask.Page.Title}),(0,n.jsx)("div",{className:"window-header-submai-title",children:b.ZP.Mask.Page.SubTitle(j.length)})]}),(0,n.jsxs)("div",{className:"window-actions",children:[(0,n.jsx)("div",{className:"window-action-button",children:(0,n.jsx)(s.h,{icon:(0,n.jsx)(l.Z,{}),bordered:!0,onClick:()=>{(0,P.CP)(JSON.stringify(S.filter(t=>!t.builtin)),w.dJ.Masks)},text:b.ZP.UI.Export})}),(0,n.jsx)("div",{className:"window-action-button",children:(0,n.jsx)(s.h,{icon:(0,n.jsx)(r.Z,{}),text:b.ZP.UI.Import,bordered:!0,onClick:()=>U()})}),(0,n.jsx)("div",{className:"window-action-button",children:(0,n.jsx)(s.h,{icon:(0,n.jsx)(m.Z,{}),bordered:!0,onClick:()=>e(-1)})})]})]}),(0,n.jsxs)("div",{className:o()["mask-page-body"],children:[(0,n.jsxs)("div",{className:o()["mask-filter"],children:[(0,n.jsx)("input",{type:"text",className:o()["search-bar"],placeholder:b.ZP.Mask.Page.Search,autoFocus:!0,onInput:t=>F(t.currentTarget.value)}),(0,n.jsxs)(C.Ph,{className:o()["mask-filter-lang"],value:null!=u?u:b.ZP.Settings.Lang.All,onChange:t=>{let e=t.currentTarget.value;e===b.ZP.Settings.Lang.All?a.setLanguage(void 0):a.setLanguage(e)},children:[(0,n.jsx)("option",{value:b.ZP.Settings.Lang.All,children:b.ZP.Settings.Lang.All},"all"),b.DC.map(t=>(0,n.jsx)("option",{value:t,children:b.nW[t]},t))]}),(0,n.jsx)(s.h,{className:o()["mask-create"],icon:(0,n.jsx)(d.Z,{}),text:b.ZP.Mask.Page.Create,bordered:!0,onClick:()=>{L(a.create().id)}})]}),(0,n.jsx)("div",{children:S.map(t=>(0,n.jsxs)("div",{className:o()["mask-item"],children:[(0,n.jsxs)("div",{className:o()["mask-header"],children:[(0,n.jsx)("div",{className:o()["mask-icon"],children:(0,n.jsx)(A,{avatar:t.avatar,model:t.modelConfig.model})}),(0,n.jsxs)("div",{className:o()["mask-title"],children:[(0,n.jsx)("div",{className:o()["mask-name"],children:t.name}),(0,n.jsx)("div",{className:(0,I.Z)(o()["mask-info"],"one-line"),children:"".concat(b.ZP.Mask.Item.Info(t.context.length)," / ").concat(b.nW[t.lang]," / ").concat(t.modelConfig.model)})]})]}),(0,n.jsxs)("div",{className:o()["mask-actions"],children:[(0,n.jsx)(s.h,{icon:(0,n.jsx)(d.Z,{}),text:b.ZP.Mask.Item.Chat,onClick:()=>{i.newSession(t),e(w.y$.Chat)}}),t.builtin?(0,n.jsx)(s.h,{icon:(0,n.jsx)(p.Z,{}),text:b.ZP.Mask.Item.View,onClick:()=>L(t.id)}):(0,n.jsx)(s.h,{icon:(0,n.jsx)(h.Z,{}),text:b.ZP.Mask.Item.Edit,onClick:()=>L(t.id)}),!t.builtin&&(0,n.jsx)(s.h,{icon:(0,n.jsx)(_.Z,{}),text:b.ZP.Mask.Item.Delete,onClick:async()=>{await (0,C.i0)(b.ZP.Mask.Item.DeleteConfirm)&&a.delete(t.id)}})]})]},t.id))})]})]}),R&&(0,n.jsx)("div",{className:"modal-mask",children:(0,n.jsx)(C.u_,{title:b.ZP.Mask.EditModal.Title(null==R?void 0:R.builtin),onClose:()=>L(void 0),actions:[(0,n.jsx)(s.h,{icon:(0,n.jsx)(l.Z,{}),text:b.ZP.Mask.EditModal.Download,bordered:!0,onClick:()=>(0,P.CP)(JSON.stringify(R),"".concat(R.name,".json"))},"export"),(0,n.jsx)(s.h,{icon:(0,n.jsx)(x.Z,{}),bordered:!0,text:b.ZP.Mask.EditModal.Clone,onClick:()=>{e(w.y$.Masks),a.create(R),L(void 0)}},"copy")],children:(0,n.jsx)(E,{mask:R,updateMask:t=>a.updateMask(H,t),readonly:R.builtin})})})]})}},3109:function(t){t.exports={"attach-images":"chat_attach-images__UtJds","attach-image":"chat_attach-image__5zxeG","attach-image-mask":"chat_attach-image-mask__cOlWM","delete-image":"chat_delete-image__IBtAc","chat-input-actions":"chat_chat-input-actions__mwYC_","chat-input-actions-end":"chat_chat-input-actions-end__gqGc3","chat-input-action":"chat_chat-input-action__DMW7Y","slide-in":"chat_slide-in__nvZgA",text:"chat_text__TkPfN",icon:"chat_icon__Ly3TN","prompt-toast":"chat_prompt-toast___VCUf","prompt-toast-inner":"chat_prompt-toast-inner__f17E6","slide-in-from-top":"chat_slide-in-from-top__Q0KCt","prompt-toast-content":"chat_prompt-toast-content__9sp_w","section-title":"chat_section-title__BiPko","section-title-action":"chat_section-title-action__bmruw","context-prompt":"chat_context-prompt__cbach","context-prompt-insert":"chat_context-prompt-insert__UmNJi","context-prompt-row":"chat_context-prompt-row__3Kbix","context-drag":"chat_context-drag__BX7lh","context-role":"chat_context-role__7_IR9","context-content":"chat_context-content__sNXUy","context-delete-button":"chat_context-delete-button__C_BmS","context-prompt-button":"chat_context-prompt-button__AoPsw","memory-prompt":"chat_memory-prompt__vOzcn","memory-prompt-content":"chat_memory-prompt-content__kUVKj","clear-context":"chat_clear-context__ke8Iw","clear-context-tips":"chat_clear-context-tips__L1A_i","clear-context-revert-btn":"chat_clear-context-revert-btn___Wna1",chat:"chat_chat__ZebHg","chat-body":"chat_chat-body__QFv5x","chat-body-main-title":"chat_chat-body-main-title__jUL6h","chat-body-title":"chat_chat-body-title__d2ItC","chat-message":"chat_chat-message__dg8rL","chat-message-user":"chat_chat-message-user__ZtTEj","chat-message-header":"chat_chat-message-header__Dny_K","chat-message-actions":"chat_chat-message-actions__H90hg","chat-model-name":"chat_chat-model-name__U4gmR","chat-message-container":"chat_chat-message-container__O_X8_","chat-message-edit":"chat_chat-message-edit__h58of","chat-message-avatar":"chat_chat-message-avatar__3QeMq","chat-message-status":"chat_chat-message-status__zc9Ad","chat-message-tools":"chat_chat-message-tools__YMVVa","chat-message-tool":"chat_chat-message-tool__Rjc5q","chat-message-item":"chat_chat-message-item__dKqMl","chat-message-audio":"chat_chat-message-audio__Rbvwc","chat-message-item-image":"chat_chat-message-item-image__2jbb0","chat-message-item-images":"chat_chat-message-item-images__EtEM4","chat-message-item-image-multi":"chat_chat-message-item-image-multi__DOIxY","chat-message-action-date":"chat_chat-message-action-date__RsXTn","chat-input-panel":"chat_chat-input-panel__rO72m","prompt-hints":"chat_prompt-hints__VT_Oi","prompt-hint":"chat_prompt-hint__2616t","hint-title":"chat_hint-title__E53ZK","hint-content":"chat_hint-content__y2yj4","prompt-hint-selected":"chat_prompt-hint-selected__o3vYi","chat-input-panel-inner":"chat_chat-input-panel-inner___IQHi","chat-input-panel-inner-attach":"chat_chat-input-panel-inner-attach__mZheu","chat-input":"chat_chat-input__PQ_oF","chat-input-send":"chat_chat-input-send__GFQZo","shortcut-key-container":"chat_shortcut-key-container__nYZUJ","shortcut-key-grid":"chat_shortcut-key-grid__VmUMG","shortcut-key-item":"chat_shortcut-key-item__diQqm","shortcut-key-title":"chat_shortcut-key-title__nauQT","shortcut-key-keys":"chat_shortcut-key-keys__vW8SN","shortcut-key":"chat_shortcut-key__DtMUQ","chat-main":"chat_chat-main__i_Cp2","chat-body-container":"chat_chat-body-container__6ZZad","chat-side-panel":"chat_chat-side-panel__YrWNL","chat-side-panel-show":"chat_chat-side-panel-show__cl5MF"}},6031:function(t){t.exports={"mask-page":"mask_mask-page__ou14k","mask-page-body":"mask_mask-page-body__kBXsJ","mask-filter":"mask_mask-filter__OdpU3","slide-in":"mask_slide-in__unpXH","search-bar":"mask_search-bar__7_Msn","mask-filter-lang":"mask_mask-filter-lang__mRxyv","mask-create":"mask_mask-create__BjAzk","mask-item":"mask_mask-item__dinia","mask-header":"mask_mask-header__RXJXI","mask-icon":"mask_mask-icon__wO1ER","mask-title":"mask_mask-title__IDEbR","mask-name":"mask_mask-name__77Rjh","mask-info":"mask_mask-info__2gtiu","mask-actions":"mask_mask-actions__rsWn_","slide-in-from-top":"mask_slide-in-from-top__DOEYB"}}}]); |