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
2.5 KiB
JavaScript
1 line
2.5 KiB
JavaScript
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3957,2386],{10432:function(e,t,a){a.r(t),a.d(t,{ChatItem:function(){return C},ChatList:function(){return f}});var n=a(57437),s=a(15592),i=a(71869),l=a.n(i),c=a(84717),r=a(44922),d=a(13894),o=a(59208),h=a(75591),m=a(83921),u=a(2265),x=a(65878),p=a(92944),v=a(75504);function C(e){let t=(0,u.useRef)(null);(0,u.useEffect)(()=>{if(e.selected&&t.current){var a;null===(a=t.current)||void 0===a||a.scrollIntoView({block:"center"})}},[e.selected]);let{pathname:a}=(0,o.TH)();return(0,n.jsx)(c._l,{draggableId:"".concat(e.id),index:e.index,children:i=>(0,n.jsxs)("div",{className:(0,v.Z)(l()["chat-item"],{[l()["chat-item-selected"]]:e.selected&&(a===h.y$.Chat||a===h.y$.Home)}),onClick:e.onClick,ref:e=>{t.current=e,i.innerRef(e)},...i.draggableProps,...i.dragHandleProps,title:"".concat(e.title,"\n").concat(d.ZP.ChatItem.ChatItemCount(e.count)),children:[e.narrow?(0,n.jsxs)("div",{className:l()["chat-item-narrow"],children:[(0,n.jsx)("div",{className:(0,v.Z)(l()["chat-item-avatar"],"no-dark"),children:(0,n.jsx)(m.MaskAvatar,{avatar:e.mask.avatar,model:e.mask.modelConfig.model})}),(0,n.jsx)("div",{className:l()["chat-item-narrow-count"],children:e.count})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:l()["chat-item-title"],children:e.title}),(0,n.jsxs)("div",{className:l()["chat-item-info"],children:[(0,n.jsx)("div",{className:l()["chat-item-count"],children:d.ZP.ChatItem.ChatItemCount(e.count)}),(0,n.jsx)("div",{className:l()["chat-item-date"],children:e.time})]})]}),(0,n.jsx)("div",{className:l()["chat-item-delete"],onClickCapture:t=>{var a;null===(a=e.onDelete)||void 0===a||a.call(e),t.preventDefault(),t.stopPropagation()},children:(0,n.jsx)(s.Z,{})})]})})}function f(e){let[t,a,s,i]=(0,r.aK)(e=>[e.sessions,e.currentSessionIndex,e.selectSession,e.moveSession]),m=(0,r.aK)(),u=(0,o.s0)(),v=(0,p.S0)();return(0,n.jsx)(c.Z5,{onDragEnd:e=>{let{destination:t,source:a}=e;t&&(t.droppableId!==a.droppableId||t.index!==a.index)&&i(a.index,t.index)},children:(0,n.jsx)(c.bK,{droppableId:"chat-list",children:i=>(0,n.jsxs)("div",{className:l()["chat-list"],ref:i.innerRef,...i.droppableProps,children:[t.map((t,i)=>(0,n.jsx)(C,{title:t.topic,time:new Date(t.lastUpdate).toLocaleString(),count:t.messages.length,id:t.id,index:i,selected:i===a,onClick:()=>{u(h.y$.Chat),s(i)},onDelete:async()=>{(!e.narrow&&!v||await (0,x.i0)(d.ZP.Home.DeleteChat))&&m.deleteSession(i)},narrow:e.narrow,mask:t.mask},t.id)),i.placeholder]})})})}}}]); |