PageSourceSearch

https://anythingllm-production-143e.up.railway.app/assets/index-99416562.js

js anythingllm-production-143e.up.railway.app collected 2026-10-03 12:11:27 UTC 10,296 bytes, 5 lines download raw bytes

1import{j as e,r as d,Q as D,D as j,k as v,H as E,M as N,S as g,C as F,T as z,u as A,a2 as I,E as H,m as J,a3 as V,s as y}from"../index.js";import{S as B}from"./index-44bf2282.js";/* empty css                 */import{t as C}from"./truncate-355a114a.js";import{M as Q,H as k,D as W}from"./purify-88358a15.js";import{I as q}from"./github-dark-763effb1.js";const G=new Q({html:!0,breaks:!0,highlight:function(t,s){if(s&&k.getLanguage(s))try{return k.highlight(t,{language:s}).value}catch{}return""}}),K=({thought:t})=>{const[s,r]=d.useState(!1);if(!t)return null;const a=t.replace(/<\/?think>/g,"").trim();return a?e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{onClick:()=>r(!s),className:"cursor-pointer flex items-center gap-x-2 text-theme-text-secondary hover:text-theme-text-primary transition-colors mb-2",children:[e.jsx(D,{size:14,weight:"bold",className:`transition-transform ${s?"rotate-180":""}`}),e.jsx("span",{className:"text-xs font-medium",children:"View thoughts"})]}),s&&e.jsx("div",{className:"bg-theme-bg-chat-input rounded-md p-3 border-l-2 border-theme-text-secondary/30",children:e.jsx("div",{className:"text-xs text-theme-text-secondary font-mono whitespace-pre-wrap",children:a})})]}):null};function U(t){const s=[];let r=0;return t.replace(/<think>([^]*?)<\/think>/g,(a,n,c)=>{c>r&&s.push({type:"normal",text:t.slice(r,c)}),s.push({type:"think",text:n}),r=c+a.length}),r<t.length&&s.push({type:"normal",text:t.slice(r)}),s}function X({content:t}){if(!t)return null;const s=U(t);return e.jsx("div",{className:"whitespace-normal",children:s.map((r,a)=>{const n=G.render(r.text);return r.type==="think"?e.jsx(K,{thought:r.text},a):e.jsx("div",{dangerouslySetInnerHTML:{__html:W.sanitize(n)}},a)})})}function Y({chat:t,onDelete:s}){var x,o,u,b;const{isOpen:r,openModal:a,closeModal:n}=j(),{isOpen:c,openModal:l,closeModal:p}=j(),m=async()=>{if(!window.confirm(`Are you sure you want to delete this chat?
2
3This action is irreversible.`))return!1;await g.deleteChat(t.id),s(t.id)};return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:"bg-transparent text-white text-opacity-80 text-xs font-medium border-b border-white/10 h-10",children:[e.jsx("td",{className:"px-6 font-medium whitespace-nowrap text-white",children:t.id}),e.jsx("td",{className:"px-6 font-medium whitespace-nowrap text-white",children:(x=t.user)==null?void 0:x.username}),e.jsx("td",{className:"px-6",children:(o=t.workspace)==null?void 0:o.name}),e.jsx("td",{onClick:a,className:"px-6 border-transparent cursor-pointer transform transition-transform duration-200 hover:scale-105 hover:shadow-lg",children:C(t.prompt,40)}),e.jsx("td",{onClick:l,className:"px-6 cursor-pointer transform transition-transform duration-200 hover:scale-105 hover:shadow-lg",children:C((u=v(t.response,{}))==null?void 0:u.text,40)}),e.jsx("td",{className:"px-6",children:t.createdAt}),e.jsx("td",{className:"px-6 flex items-center gap-x-6 h-full mt-1",children:e.jsx("button",{onClick:m,className:"text-xs font-medium text-white/80 light:text-black/80 hover:light:text-red-500 hover:text-red-300 rounded-lg px-2 py-1 hover:bg-white hover:light:bg-red-50 hover:bg-opacity-10",children:e.jsx(E,{className:"h-5 w-5"})})})]}),e.jsx(N,{isOpen:r,children:e.jsx(M,{text:t.prompt,closeModal:n})}),e.jsx(N,{isOpen:c,children:e.jsx(M,{text:e.jsx(X,{content:(b=v(t.response,{}))==null?void 0:b.text}),closeModal:p})})]})}const M=({text:t,closeModal:s})=>e.jsx("div",{className:"relative w-full md:max-w-2xl max-h-full",children:e.jsxs("div",{className:"w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b rounded-t border-theme-modal-border",children:[e.jsx("h3",{className:"text-xl font-semibold text-white",children:"Viewing Text"}),e.jsx("button",{onClick:s,type:"button",className:"bg-transparent rounded-lg text-sm p-1.5 ml-auto inline-flex items-center bg-sidebar-button hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(F,{className:"text-white text-lg"})})]}),e.jsx("div",{className:"w-full p-6",children:e.jsx("pre",{className:"w-full h-[200px] py-2 px-4 whitespace-pre-line overflow-auto rounded-lg bg-zinc-900 light:bg-theme-bg
3-secondary border border-gray-500 text-white text-sm",children:t})})]})}),S={csv:{name:"CSV",mimeType:"text/csv",fileExtension:"csv",filenameFunc:()=>`anythingllm-chats-${new Date().toLocaleDateString()}`},json:{name:"JSON",mimeType:"application/json",fileExtension:"json",filenameFunc:()=>`anythingllm-chats-${new Date().toLocaleDateString()}`},jsonl:{name:"JSONL",mimeType:"application/jsonl",fileExtension:"jsonl",filenameFunc:()=>`anythingllm-chats-${new Date().toLocaleDateString()}-lines`},jsonAlpaca:{name:"JSON (Alpaca)",mimeType:"application/json",fileExtension:"json",filenameFunc:()=>`anythingllm-chats-${new Date().toLocaleDateString()}-alpaca`}};function le(){const[t,s]=d.useState(!1),r=d.useRef(),a=d.useRef(),n=z(),[c,l]=d.useState(!0),[p,m]=d.useState([]),[x,o]=d.useState(Number(n.get("offset")||0)),[u,b]=d.useState(!1),{t:f}=A(),T=async i=>{const h=await g.exportChats(i,"workspace");if(h){const{name:w,mimeType:P,fileExtension:L,filenameFunc:R}=S[i],$=new Blob([h],{type:P});V.saveAs($,`${R()}.${L}`),y(`Chats exported successfully as ${w}.`,"success")}else y("Failed to export chats.","error")},O=async()=>{if(!window.confirm(`Are you sure you want to clear all chats?
4
5This action is irreversible.`))return!1;await g.deleteChat(-1),m([]),y("Cleared all chats.","success")},_=()=>{s(!t)};return d.useEffect(()=>{function i(h){r.current&&!r.current.contains(h.target)&&!a.current.contains(h.target)&&s(!1)}return document.addEventListener("mousedown",i),()=>{document.removeEventListener("mousedown",i)}},[]),d.useEffect(()=>{async function i(){const{chats:h=[],hasPages:w=!1}=await g.chats(x);m(h),b(w),l(!1)}i()},[x]),e.jsx(I,{children:e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(H,{}),e.jsx("div",{style:{height:J?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:e.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:py-6 py-16",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white/10 border-b-2",children:[e.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[e.jsx("p",{className:"text-lg leading-6 font-bold text-theme-text-primary",children:f("recorded.title")}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{ref:a,onClick:_,className:"flex items-center gap-x-2 px-4 py-1 rounded-lg bg-primary-button hover:light:bg-theme-bg-primary hover:text-theme-text-primary text-xs font-semibold hover:bg-secondary shadow-[0_4px_14px_rgba(0,0,0,0.25)] h-[34px] w-fit",children:[e.jsx(q,{size:18,weight:"bold"}),f("recorded.export"),e.jsx(D,{size:18,weight:"bold"})]}),e.jsx("div",{ref:r,className:`${t?"slide-down":"slide-up hidden"} z-20 w-fit rounded-lg absolute top-full right-0 bg-secondary light:bg-theme-bg-secondary mt-2 shadow-md`,children:e.jsx("div",{className:"py-2",children:Object.entries(S).map(([i,h])=>e.jsx("button",{onClick:()=>{T(i),s(!1)},className:"w-full text-left px-4 py-2 text-white text-sm hover:bg-[#3D4147] light:hover:bg-theme-sidebar-item-hover",children:h.name},i))})})]}),p.length>0&&e.jsxs("button",{onClick:O,className:"flex items-center gap-x-2 px-4 py-1 border hover:border-transparent light:border-theme-sidebar-border border-white/40 text-white/40 light:text-theme-text-secondary rounded-lg bg-transparent hover:light:text-theme-bg-primary hover:text-theme-text-primary text-xs font-semibold hover:bg-red-500 shadow-[0_4px_14px_rgba(0,0,0,0.25)] h-[34px] w-fit",children:[e.jsx(E,{size:18,weight:"bold"}),"Clear Chats"]})]}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary mt-2",children:f("recorded.description")})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx(Z,{loading:c,chats:p,setChats:m,offset:x,setOffset:o,canNext:u,t:f})})]})})]})})}function Z({loading:t,chats:s,setChats:r,offset:a,setOffset:n,canNext:c,t:l}){const p=()=>{n(Math.max(a-1,0))},m=()=>{n(a+1)},x=async o=>{await g.deleteChat(o),r(u=>u.filter(b=>b.id!==o))};return t?e.jsx(B,{height:"80vh",width:"100%",highlightColor:"var(--theme-bg
5-primary)",baseColor:"var(--theme-bg-secondary)",count:1,className:"w-full p-4 rounded-b-2xl rounded-tr-2xl rounded-tl-sm",containerClassName:"flex w-full"}):e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:"w-full text-xs text-left rounded-lg min-w-[640px] border-spacing-0",children:[e.jsx("thead",{className:"text-theme-text-secondary text-xs leading-[18px] font-bold uppercase border-white/10 border-b",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tl-lg",children:l("recorded.table.id")}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:l("recorded.table.by")}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:l("recorded.table.workspace")}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:l("recorded.table.prompt")}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:l("recorded.table.response")}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:l("recorded.table.at")}),e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tr-lg",children:" "})]})}),e.jsx("tbody",{children:!!s&&s.map(o=>e.jsx(Y,{chat:o,onDelete:x},o.id))})]}),e.jsxs("div",{className:"flex w-full justify-between items-center mt-6",children:[e.jsxs("button",{onClick:p,className:"px-4 py-2 rounded-lg border border-theme-text-secondary text-theme-text-secondary text-sm items-center flex gap-x-2 hover:bg-theme-text-secondary hover:text-theme-bg-secondary disabled:invisible",disabled:a===0,children:[" ","Previous Page"]}),e.jsx("button",{onClick:m,className:"px-4 py-2 rounded-lg border border-slate-200 text-slate-200 light:text-theme-text-secondary light:border-theme-sidebar-border text-sm items-center flex gap-x-2 hover:bg-slate-200 hover:text-slate-800 disabled:invisible",disabled:!c,children:"Next Page"})]})]})}export{le as default};

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.