PageSourceSearch

https://lobe-chat-eight-virid-32.vercel.app/_next/static/chunks/48726-3364b1bc58667cb8.js

js lobe-chat-eight-virid-32.vercel.app collected 2026-10-03 07:16:27 UTC 22,059 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[48726],{2119:(e,s,t)=>{t.d(s,{r:()=>a});var n=t(91981),i=t(37287),o=t(19501);let a=(0,n.XT)({links:[(0,n.fu)({headers:async()=>{let{createHeaderWithAuth:e}=await Promise.all([t.e(31210),t.e(44134),t.e(12735),t.e(50575),t.e(76433),t.e(37437),t.e(5882),t.e(9245),t.e(70164),t.e(86476),t.e(46182),t.e(17755),t.e(36850)]).then(t.bind(t,91952));return e()},maxURLLength:2083,transformer:i.Ay,url:(0,o.h)("/trpc/edge")})]})},13902:(e,s,t)=>{t.d(s,{e:()=>w,p:()=>c});var n=t(35700),i=t(36363),o=t(87018),a=t(70164),r=t(84515),d=t(99793);let u=e=>(0,d.h)(o.HA,e.agentMap[i.Ed]),l=e=>s=>(0,d.h)(s.defaultAgentConfig,s.agentMap[e]),c=e=>l(e.activeId)(e),g=e=>{let s=c(e);return(null==s?void 0:s.knowledgeBases)||[]},p=e=>{let s=c(e);return(null==s?void 0:s.files)||[]},S=e=>{let s=c(e);return(null==s?void 0:s.tts)||o.Nm},h=e=>{let s=g(e);return[...p(e).filter(e=>e.enabled).map(e=>({fileType:e.type,id:e.id,name:e.name,type:r.z.File})),...s.filter(e=>e.enabled).map(e=>({id:e.id,name:e.name,type:r.z.KnowledgeBase}))]},y=e=>g(e).length>0,f=e=>p(e).length>0,w={currentAgentConfig:c,currentAgentFiles:p,currentAgentKnowledgeBases:g,currentAgentModel:e=>{let s=c(e);return(null==s?void 0:s.model)||a.UB},currentAgentModelProvider:e=>{let s=c(e);return(null==s?void 0:s.provider)||a.Gr},currentAgentPlugins:e=>{let s=c(e);return(null==s?void 0:s.plugins)||[]},currentAgentSystemRole:e=>c(e).systemRole,currentAgentTTS:S,currentAgentTTSVoice:e=>s=>{var t,i,o;let a;let{voice:r,ttsService:d}=S(s),u=new n.F(e);switch(d){case"openai":a=r.openai||(null===(t=n.F.openaiVoiceOptions)||void 0===t?void 0:t[0].value);break;case"edge":a=r.edge||(null===(i=u.edgeVoiceOptions)||void 0===i?void 0:i[0].value);break;case"microsoft":a=r.microsoft||(null===(o=u.microsoftVoiceOptions)||void 0===o?void 0:o[0].value)}return a||"alloy"},currentEnabledKnowledge:h,currentKnowledgeIds:e=>({fileIds:p(e).filter(e=>e.enabled).map(e=>e.id),knowledgeBaseIds:g(e).filter(e=>e.enabled).map(e=>e.id)}),getAgentConfigById:l,hasEnabledKnowledge:e=>h(e).length>0,hasKnowledge:e=>y(e)||f(e),hasSystemRole:e=>!!c(e).systemRole,inboxAgentConfig:u,inboxAgentModel:e=>u(e).model,isAgentConfigLoading:e=>!e.agentConfigInitMap[e.activeId],isInboxSession:e=>e.activeId===i.Ed}},17520:(e,s,t)=>{t.d(s,{_:()=>B,o:()=>M});var n=t(14),i=t(40523),o=t(99606);let a={activeId:"inbox",agentConfigInitMap:{},agentMap:{},defaultAgentConfig:t(87018).HA,isInboxAgentConfigInit:!1,showAgentSetting:!1};var r=t(51616),d=t.n(r),u=t(53838),l=t(20071),c=t(21152),g=t(36363),p=t(92681),S=t(61205);class h{constructor(){this.createAgentKnowledgeBase=async(e,s,t)=>S.du.agent.createAgentKnowledgeBase.mutate({agentId:e,enabled:t,knowledgeBaseId:s}),this.deleteAgentKnowledgeBase=async(e,s)=>S.du.agent.deleteAgentKnowledgeBase.mutate({agentId:e,knowledgeBaseId:s}),this.toggleKnowledgeBase=async(e,s,t)=>S.du.agent.toggleKnowledgeBase.mutate({agentId:e,enabled:t,knowledgeBaseId:s}),this.createAgentFiles=async(e,s,t)=>S.du.agent.createAgentFiles.mutate({agentId:e,enabled:t,fileIds:s}),this.deleteAgentFile=async(e,s)=>S.du.agent.deleteAgentFile.mutate({agentId:e,fileId:s}),this.toggleFile=async(e,s,t)=>S.du.agent.toggleFile.mutate({agentId:e,enabled:t,fileId:s}),this.getFilesAndKnowledgeBases=async e=>S.du.agent.getKnowledgeBasesAndFiles.query({agentId:e})}}let y=new h;var f=t(60392),w=t(80661),v=t(99793),m=t(13902);let A="FETCH_AGENT_CONFIG",G="FETCH_AGENT_KNOWLEDGE",C=(e,s)=>({addFilesToAgent:async(e,t)=>{let{activeAgentId:n,internal_refreshAgentConfig:i,internal_refreshAgentKnowledge:o}=s();n&&0!==e.length&&(await y.createAgentFiles(n,e,t),await i(s().activeId),await o())},addKnowledgeBaseToAgent:async e=>{let{activeAgentId:t,internal_refreshAgentConfig:n,internal_refreshAgentKnowledge:i}=s();t&&(await y.createAgentKnowledgeBase(t,e,!0),await n(s().activeId),await i())},removeFileFromAgent:async e=>{let{activeAgentId:t,internal_refreshAgentConfig:n,internal_refreshAgentKnowledge:i}=s();t&&(await y.deleteAgentFile(t,e),await n(s().activeId),await i())},removeKnowledgeBaseFromAgent:async e=>{let{activeAgentId:t,internal_refreshAgentConfig:n,internal_refreshAgentKnowledge:i}=s();t&&(await y.deleteAgentKnowledgeBase(t,e),await n(s().activeId),await i())},removePlugin:async e=>{await s().togglePlugin(e,!1)},toggleFile:async(e,t)=>{let{activeAgentId:n,internal_refreshAgentConfig:i}=s();n&&(await y.toggleFile(n,e,t),await i(s().activeId))},toggleKnowledgeBase:async(e,t)=>{let{activeAgentId:n,internal_refreshAgentConfig:i}=s();n&&(await y.toggleKnowledgeBase(n,e,t),await i(s().activeId))},togglePlugin:async(e,t)=>{let n=m.e.currentAgentConfig(s()),i=(0,u.jM)(n,s=>{s.plugins=(0,u.jM)(s.plugins||[],s=>{let n=s.indexOf(e);(void 0!==t?t:-1===n)?-1===n&&s.push(e):-1!==n&&s.splice(n,1)})});await s().updateAgentConfig(i)},updateAgentChatConfig:async e=>{let{activeId:t}=s();t&&await s().updateAgentConfig({chatConfig:e})},updateAgentConfig:async e=>{let{activeId:t}=s();if(!t)return;let n=s().internal_createAbortController("updateAgentConfigSignal");await s().internal_updateAgentConfig(t,e,n.signal)},useFetchAgentConfig:(t,n)=>(0,p.lA)(t?[A,n]:null,e=>{let[,s]=e;return f.m.getSessionConfig(s)},{onSuccess:t=>{s().internal_dispatchAgentMap(n,t,"fetch"),e({activeAgentId:t.id,agentConfigInitMap:{...s().agentConfigInitMap,[n]:!0}},!1,"fetchAgentConfig")}}),useFetchFilesAndKnowledgeBases:()=>(0,p.lA)([G,s().activeAgentId],e=>{let[,s]=e;return y.getFilesAndKnowledgeBases(s)},{fallbackData:[],suspense:!0}
1),useInitInboxAgentStore:(t,n)=>(0,p.Ju)(t?"fetchInboxAgentConfig":null,()=>f.m.getSessionConfig(g.Ed),{onSuccess:t=>{e({defaultAgentConfig:(0,v.h)(s().defaultAgentConfig,n),isInboxAgentConfigInit:!0},!1,"initDefaultAgent"),t&&s().internal_dispatchAgentMap(g.Ed,t,"initInbox")}}),internal_dispatchAgentMap:(t,n,i)=>{let o=(0,u.jM)(s().agentMap,e=>{e[t]?e[t]=(0,v.h)(e[t],n):e[t]=n});d()(s().agentMap,o)||e({agentMap:o},!1,"dispatchAgent"+(i?"/".concat(i):""))},internal_updateAgentConfig:async(e,t,n)=>{let i=m.e.currentAgentModel(s());s().internal_dispatchAgentMap(e,t,"optimistic_updateAgentConfig"),await f.m.updateSessionConfig(e,t,n),await s().internal_refreshAgentConfig(e),i!==t.model&&await w.B.getState().refreshSessions()},internal_refreshAgentConfig:async e=>{await (0,l.j)([A,e])},internal_refreshAgentKnowledge:async()=>{await (0,l.j)([G,s().activeAgentId])},internal_createAbortController:t=>{let n=s()[t];n&&n.abort(c.ve);let i=new AbortController;return e({[t]:i},!1,"internal_createAbortController"),i}}),I=(0,o.t)("agent"),M=(0,i.h)()(I(function(){for(var e=arguments.length,s=Array(e),t=0;t<e;t++)s[t]=arguments[t];return{...a,...C(...s)}}),n.x),B=()=>M.getState()},21578:(e,s,t)=>{let n,i,o;t.d(s,{Ay:()=>r,Ew:()=>i,iU:()=>n,yl:()=>o});var a=t(77079);let r=(0,t(12115).memo)(()=>{let e=a.A.useApp();return n=e.message,o=e.modal,i=e.notification,null})},32176:(e,s,t)=>{t.d(s,{z:()=>l});var n=t(36363),i=t(38944);let o=e=>e.defaultSessions,a=e=>e.sessions,r=e=>s=>i.C.getSessionById(e,a(s)),d=e=>{if(e.activeId)return a(e).find(s=>s.id===e.activeId)},u=e=>e.isSessionsFirstFetchFinished,l={currentSession:d,currentSessionSafe:e=>d(e)||n.W5,customSessionGroups:e=>e.customSessionGroups,defaultSessions:o,getSessionById:r,getSessionMetaById:e=>s=>{let t=r(e)(s);return t?t.meta:{}},hasCustomAgents:e=>o(e).length>0,isInboxSession:e=>e.activeId===n.Ed,isSessionListInit:u,isSomeSessionActive:e=>!!e.activeId&&u(e),pinnedSessions:e=>e.pinnedSessions}},38944:(e,s,t)=>{t.d(s,{C:()=>a});var n=t(12735),i=t(93972),o=t(36363);let a={getAvatar:e=>e.avatar||i.k_,getSessionById:(e,s)=>{let t=s.find(s=>s.id===e);return t||o.W5},getSessionPinned:e=>e.pinned,getTitle:e=>e.title||(0,n.t)("defaultSession",{ns:"common"})}},60392:(e,s,t)=>{t.d(s,{m:()=>I});var n=t(36363),i=t(87018),o=t(96921),a=t(74579),r=t(48191),d=t(46182),u=t(99793);class l{async createSession(e,s){let t=await o.SessionModel.create(e,s);if(!t)throw Error("session create Error");return t.id}async batchCreateSessions(e){return o.SessionModel.batchCreate(e)}async cloneSession(e,s){let t=await o.SessionModel.duplicate(e,s);if(t)return null==t?void 0:t.id}async getGroupedSessions(){return o.SessionModel.queryWithGroups()}async getSessionConfig(e){if(!e||e===n.Ed)return await r.F.getAgentConfig()||i.HA;let s=await o.SessionModel.findById(e);if(!s)throw Error("Session not found");return s.config}async getSessionsByType(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"all";switch(e){case"group":case"agent":case"all":return o.SessionModel.query()}}async getAllAgents(){return o.SessionModel.query()}async countSessions(){return o.SessionModel.count()}async rankSessions(){throw Error("Method not implemented.")}async hasSessions(){return await this.countSessions()!==0}async searchSessions(e){return o.SessionModel.queryByKeyword(e)}async updateSession(e,s){let t="boolean"==typeof s.pinned?+!!s.pinned:void 0,n=await o.SessionModel.findById(e);return o.SessionModel.update(e,(0,u.h)(n,{...s,pinned:t}))}async updateSessionConfig(e,s,t){return e===n.Ed?d.k.getState().updateDefaultAgent({config:s}):o.SessionModel.updateConfig(e,s)}async updateSessionMeta(e,s,t){if(e!==n.Ed)return o.SessionModel.update(e,{meta:s})}async updateSessionChatConfig(e,s,t){return this.updateSessionConfig(e,{chatConfig:s})}async removeSession(e){return o.SessionModel.delete(e)}async removeAllSessions(){return o.SessionModel.clearTable()}async createSessionGroup(e,s){let t=await a.d.create(e,s);if(!t)throw Error("session group create Error");return t.id}async batchCreateSessionGroups(e){return a.d.batchCreate(e)}async removeSessionGroup(e,s){return a.d.delete(e,s)}async updateSessionGroup(e,s){return a.d.update(e,s)}async updateSessionGroupOrder(e){return a.d.updateOrder(e)}async getSessionGroups(){return a.d.query()}async removeSessionGroups(){return a.d.clear()}}var c=t(64091),g=t(53426),p=t(55208),S=t(44778),h=t(5667),y=t(88748);class f{constructor(e,s){this.create=async e=>{let[s]=await this.db.insert(y.B$).values({...e,id:this.genId(),userId:this.userId}).returning();return s},this.delete=async e=>this.db.delete(y.B$).where((0,p.Uo)((0,p.eq)(y.B$.id,e),(0,p.eq)(y.B$.userId,this.userId))),this.deleteAll=async()=>this.db.delete(y.B$).where((0,p.eq)(y.B$.userId,this.userId)),this.query=async()=>this.db.query.sessionGroups.findMany({orderBy:[(0,S.Y)(y.B$.sort),(0,S.i)(y.B$.createdAt)],where:(0,p.eq)(y.B$.userId,this.userId)}),this.findById=async e=>this.db.query.sessionGroups.findFirst({where:(0,p.Uo)((0,p.eq)(y.B$.id,e),(0,p.eq)(y.B$.userId,this.userId))}),this.update=async(e,s)=>this.db.update(y.B$).set({...s,updatedAt:new Date}).where((0,p.Uo)((0,p.eq)(y.B$.id,e),(0,p.eq)(y.B$.userId,this.userId))),this.updateOrder=async e=>{await this.db.transaction(async s=>{let t=e.map(e=>{let{id:t,sort:n}=e;return s.update(y.B$).set({sort:n,updatedAt:new Date}).where((0,p.Uo)((0,p.eq)(y.B$.id,t),(0,p.eq)(y.B$.userId,this.userId)))});await Promise.all(t)})},this.genId=()=>(0,h.ZM)("sessionGroups"),this.userId=s,this.db=e}}var w=t(34020);class v extends w.Q{get sessionModel(){return new g.I(c.s,this.userId)}get sessionGroupModel(){return new f(c.s,this.userId)}constructor(...e){var s;super(...e),s=this,this.hasSessions=async()=>0===await this.countSessions(),this.createSession=async(e,s)=>{let{config:t,group:n,meta:i,...o}=s,a=await this.sessionModel.create({config:{...t,...i},session:{...o,groupId:n},type:e});if(!a)throw Error("session create Error");return a.id},this.batchCreateSessions=async e=>this.sessionModel.batchCreate(e),this.cloneSession=async(e,s)=>{let t=await this.sessionModel.duplicate(e,s);if(t)return null==t?void 0:t.id},this.getGroupedSessions=async()=>
1this.sessionModel.queryWithGroups(),this.getSessionConfig=async e=>{if(e===n.Ed&&!await this.sessionModel.findByIdOrSlug(n.Ed)){var s;let e=(null===(s=window.global_serverConfigStore.getState().serverConfig.defaultAgent)||void 0===s?void 0:s.config)||{};await this.sessionModel.createInbox(e)}let t=await this.sessionModel.findByIdOrSlug(e);if(!t)throw Error("Session not found");return t.agent},this.getSessionsByType=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"all";switch(e){case"group":case"agent":case"all":return s.sessionModel.query()}},this.countSessions=async e=>this.sessionModel.count(e),this.rankSessions=async e=>this.sessionModel.rank(e),this.searchSessions=async e=>this.sessionModel.queryByKeyword(e),this.updateSession=async(e,s)=>this.sessionModel.update(e,{...s,groupId:"default"===s.group?null:s.group}),this.updateSessionConfig=async(e,s)=>{let t=await this.sessionModel.findByIdOrSlug(e);if(t&&s)return this.sessionModel.updateConfig(t.agent.id,s)},this.updateSessionMeta=async(e,s)=>{if(e!==n.Ed)return this.sessionModel.update(e,s)},this.updateSessionChatConfig=async(e,s)=>this.updateSessionConfig(e,{chatConfig:s}),this.removeSession=async e=>this.sessionModel.delete(e),this.removeAllSessions=async()=>this.sessionModel.deleteAll(),this.createSessionGroup=async(e,s)=>{let t=await this.sessionGroupModel.create({name:e,sort:s});if(!t)throw Error("session group create Error");return t.id},this.batchCreateSessionGroups=async e=>({added:0,ids:[],skips:[],success:!0}),this.removeSessionGroup=async e=>this.sessionGroupModel.delete(e),this.updateSessionGroup=async(e,s)=>this.sessionGroupModel.update(e,s),this.updateSessionGroupOrder=async e=>this.sessionGroupModel.updateOrder(e),this.getSessionGroups=async()=>this.sessionGroupModel.query(),this.removeSessionGroups=async()=>this.sessionGroupModel.deleteAll()}}var m=t(61205);class A{constructor(){this.hasSessions=async()=>0===await this.countSessions(),this.createSession=async(e,s)=>{let{config:t,group:n,meta:i,...o}=s;return m.du.session.createSession.mutate({config:{...t,...i},session:{...o,groupId:n},type:e})},this.batchCreateSessions=async e=>{let s=await m.du.session.batchCreateSessions.mutate(e);return console.log(s),s},this.cloneSession=(e,s)=>m.du.session.cloneSession.mutate({id:e,newTitle:s}),this.getGroupedSessions=()=>m.du.session.getGroupedSessions.query(),this.countSessions=async e=>m.du.session.countSessions.query(e),this.rankSessions=async e=>m.du.session.rankSessions.query(e),this.updateSession=(e,s)=>{let{group:t,pinned:n,meta:i,updatedAt:o}=s;return m.du.session.updateSession.mutate({id:e,value:{groupId:"default"===t?null:t,pinned:n,...i,updatedAt:o}})},this.getSessionConfig=async e=>m.du.agent.getAgentConfig.query({sessionId:e}),this.updateSessionConfig=(e,s,t)=>m.du.session.updateSessionConfig.mutate({id:e,value:s},{signal:t}),this.updateSessionMeta=(e,s,t)=>m.du.session.updateSessionConfig.mutate({id:e,value:s},{signal:t}),this.updateSessionChatConfig=(e,s,t)=>m.du.session.updateSessionChatConfig.mutate({id:e,value:s},{signal:t}),this.getSessionsByType=function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0],m.du.session.getSessions.query({})},this.searchSessions=e=>m.du.session.searchSessions.query({keywords:e}),this.removeSession=e=>m.du.session.removeSession.mutate({id:e}),this.removeAllSessions=()=>m.du.session.removeAllSessions.mutate(),this.createSessionGroup=(e,s)=>m.du.sessionGroup.createSessionGroup.mutate({name:e,sort:s}),this.getSessionGroups=()=>m.du.sessionGroup.getSessionGroup.query(),this.batchCreateSessionGroups=e=>Promise.resolve({added:0,ids:[],skips:[],success:!0}),this.removeSessionGroup=(e,s)=>m.du.sessionGroup.removeSessionGroup.mutate({id:e,removeChildren:s}),this.removeSessionGroups=()=>m.du.sessionGroup.removeAllSessionGroups.mutate(),this.updateSessionGroup=(e,s)=>m.du.sessionGroup.updateSessionGroup.mutate({id:e,value:s}),this.updateSessionGroupOrder=e=>m.du.sessionGroup.updateSessionGroupOrder.mutate({sortMap:e})}}var G=t(87358);let C="pglite"===G.env.NEXT_PUBLIC_CLIENT_DB?new v:new l,I="server"===G.env.NEXT_PUBLIC_SERVICE_MODE?new A:C},66749:(e,s,t)=>{t.d(s,{G:()=>d});var n=t(12735),i=t(93972),o=t(99793),a=t(32176);let r=e=>{let s=a.z.isInboxSession(e),t={avatar:s?i.xd:i.k_,backgroundColor:i.z6,description:s?(0,n.t)("inbox.desc",{ns:"chat"}):void 0,title:s?(0,n.t)("inbox.title",{ns:"chat"}):(0,n.t)("defaultSession")},r=a.z.currentSession(e);return(0,o.h)(t,null==r?void 0:r.meta)},d={currentAgentAvatar:e=>
1r(e).avatar,currentAgentBackgroundColor:e=>r(e).backgroundColor,currentAgentDescription:e=>r(e).description,currentAgentMeta:r,currentAgentTitle:e=>r(e).title,getAvatar:e=>e.avatar||i.k_,getDescription:e=>e.description,getTitle:e=>e.title||(0,n.t)("defaultSession",{ns:"common"})}},80661:(e,s,t)=>{t.d(s,{L:()=>O,B:()=>x});var n=t(30504),i=t(14),o=t(40523),a=t(70638),r=t(99606);let d={customSessionGroups:[],sessionGroups:[],activeId:"inbox",defaultSessions:[],isSearching:!1,isSessionsFirstFetchFinished:!1,pinnedSessions:[],searchKeywords:"",sessions:[]};var u=t(51616),l=t.n(u),c=t(12735),g=t(90427),p=t(20071),S=t(21578),h=t(21152),y=t(36363),f=t(92681),w=t(60392),v=t(46182),m=t(72705),A=t(49433),G=t(99793),C=t(96315),I=t(53838);let M=(e,s)=>{switch(s.type){case"addSession":return(0,I.jM)(e,e=>{let{session:t}=s;t&&e.unshift({...t,createdAt:new Date,updatedAt:new Date})});case"removeSession":return(0,I.jM)(e,e=>{let t=e.findIndex(e=>e.id===s.id);-1!==t&&e.splice(t,1)});case"updateSession":return(0,I.jM)(e,e=>{let{value:t,id:n}=s,i=e.findIndex(e=>e.id===n);-1!==i&&(e[i]={...e[i],...t,updatedAt:new Date})});default:return(0,I.jM)(e,()=>{})}};var B=t(32176),b=t(66749);let F=(0,C.K)("session"),_="fetchSessions",E=(e,s)=>({clearSessions:async()=>{await w.m.removeAllSessions(),await s().refreshSessions()},createSession:async function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],{switchSession:n,refreshSessions:i}=s(),o=(0,G.h)(y.W5,m.w0.defaultAgent(v.k.getState())),a=(0,G.h)(o,e),r=await w.m.createSession(A.r.Agent,a);return await i(),t&&n(r),r},duplicateSession:async e=>{let{switchSession:t,refreshSessions:n}=s(),i=B.z.getSessionById(e)(s());if(!i)return;let o=b.G.getTitle(i.meta),a=(0,c.t)("duplicateSession.title",{ns:"chat",title:o}),r="duplicateSession.loading";S.iU.loading({content:(0,c.t)("duplicateSession.loading",{ns:"chat"}),duration:0,key:r});let d=await w.m.cloneSession(e,a);if(!d){S.iU.destroy(r),S.iU.error((0,c.t)("copyFail",{ns:"common"}));return}await n(),S.iU.destroy(r),S.iU.success((0,c.t)("duplicateSession.success",{ns:"chat"})),t(d)},pinSession:async(e,t)=>{await s().internal_updateSession(e,{pinned:t})},removeSession:async e=>{await w.m.removeSession(e),await s().refreshSessions(),e===s().activeId&&s().switchSession(y.Ed)},switchSession:t=>{s().activeId!==t&&e({activeId:t},!1,F("activeSession/".concat(t)))},triggerSessionUpdate:async e=>{await s().internal_updateSession(e,{updatedAt:new Date})},updateSearchKeywords:s=>{e({isSearching:!!s,sessionSearchKeywords:s},!1,F("updateSearchKeywords"))},updateSessionGroupId:async(e,t)=>{await s().internal_updateSession(e,{group:t})},updateSessionMeta:async t=>{if(!B.z.currentSession(s()))return;let{activeId:n,refreshSessions:i}=s(),o=s().signalSessionMeta;o&&o.abort(h.ve);let a=new AbortController;e({signalSessionMeta:a},!1,"updateSessionMetaSignal"),await w.m.updateSessionMeta(n,t,a.signal),await i()},useFetchSessions:(t,n)=>(0,f.lA)(t?[_,n]:null,()=>w.m.getGroupedSessions(),{fallbackData:{sessionGroups:[],sessions:[]},onSuccess:t=>{s().isSessionsFirstFetchFinished&&l()(s().sessions,t.sessions)&&l()(s().sessionGroups,t.sessionGroups)||(s().internal_processSessions(t.sessions,t.sessionGroups,F("useFetchSessions/updateData")),e({isSessionsFirstFetchFinished:!0},!1,F("useFetchSessions/onSuccess",t)))},suspense:!0}),useSearchSessions:e=>(0,g.default)(["searchSessions",e],async()=>e?w.m.searchSessions(e):[],{revalidateOnFocus:!1,revalidateOnMount:!1}),internal_dispatchSessions:e=>{let t=M(s().sessions,e);s().internal_processSessions(t,s().sessionGroups)},internal_updateSession:async(e,t)=>{s().internal_dispatchSessions({type:"updateSession",id:e,value:t}),await w.m.updateSession(e,t),await s().refreshSessions()},internal_processSessions:(s,t)=>{let n=t.map(e=>({...e,children:s.filter(s=>s.group===e.id&&!s.pinned)}));e({customSessionGroups:n,defaultSessions:s.filter(e=>(!e.group||"default"===e.group)&&!e.pinned),pinnedSessions:s.filter(e=>e.pinned),sessionGroups:t,sessions:s},!1,F("processSessions"))},refreshSessions:async()=>{await (0,p.j)([_,!0])}}),q=(e,s)=>{switch(s.type){case"addSessionGroupItem":return[...e,s.item];case"deleteSessionGroupItem":return e.filter(e=>
1e.id!==s.id);case"updateSessionGroupItem":return e.map(e=>e.id===s.id?{...e,...s.item}:e);case"updateSessionGroupOrder":return e.map(e=>{var t;let n=null===(t=s.sortMap.find(s=>s.id===e.id))||void 0===t?void 0:t.sort;return{...e,sort:n}}).sort((e,s)=>(e.sort||0)-(s.sort||0));default:return e}},K=(e,s)=>({addSessionGroup:async e=>{let t=await w.m.createSessionGroup(e);return await s().refreshSessions(),t},clearSessionGroups:async()=>{await w.m.removeSessionGroups(),await s().refreshSessions()},removeSessionGroup:async e=>{await w.m.removeSessionGroup(e),await s().refreshSessions()},updateSessionGroupName:async(e,t)=>{await w.m.updateSessionGroup(e,{name:t}),await s().refreshSessions()},updateSessionGroupSort:async e=>{let t=e.map((e,s)=>({id:e.id,sort:s}));s().internal_dispatchSessionGroups({sortMap:t,type:"updateSessionGroupOrder"}),S.iU.loading({content:(0,c.t)("sessionGroup.sorting",{ns:"chat"}),duration:0,key:"updateSessionGroupSort"}),await w.m.updateSessionGroupOrder(t),S.iU.destroy("updateSessionGroupSort"),S.iU.success((0,c.t)("sessionGroup.sortSuccess",{ns:"chat"})),await s().refreshSessions()},internal_dispatchSessionGroups:e=>{let t=q(s().sessionGroups,e);s().internal_processSessions(s().sessions,t,"updateSessionGroups")}}),k=(0,r.t)("session"),x=(0,o.h)()((0,n.eh)(k(function(){for(var e=arguments.length,s=Array(e),t=0;t<e;t++)s[t]=arguments[t];return{...d,...E(...s),...K(...s)}},{name:"LobeChat_Session"+(a.C?"_DEV":"")})),i.x),O=()=>x.getState()},84515:(e,s,t)=>{t.d(s,{z:()=>n});var n=function(e){return e.File="file",e.KnowledgeBase="knowledgeBase",e}({})}}]);

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.