diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index 84da3ae458ec1de42c4a19d6737e4367fd5944a5..700706f27108842cba7c5e081ab48f534fbf2542 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -9,7 +9,13 @@ export interface ApiOptions { function getToken(): string | null { if (typeof window === 'undefined') return null - return localStorage.getItem('nexus_token') + const ls = localStorage.getItem('nexus_token') + if (ls) return ls + try { + const m = document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/) + if (m) return decodeURIComponent(m[1]) + } catch {} + return null } function setCookie(name: string, value: string, days: number) { diff --git a/opencode.json b/opencode.json new file mode 100644 index 0000000000000000000000000000000000000000..dc3f7dfd70b344e8beebadd5201d8fb55ebf3573 --- /dev/null +++ b/opencode.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://opencode.ai/config.json", + "provider": { + "mygateway": { + "npm": "@ai-sdk/openai-compatible", + "name": "My Custom Proxy", + "options": { + "baseURL": "https://opencode.ai/zen/v1" + }, + "models": { + "minimax-m3-free": { + "name": "Zen Minimax M3 Free" + }, + "mimo-v2.5-free": { + "name": "Zen Mimo V2.5 Free" + } + } + } + } +} \ No newline at end of file diff --git a/static/404.html b/static/404.html index 825c88d8d8839deca080cc67f2792bb35592cdf1..2e875ba83f686a28c6f1d3d52eaac99f6a299ede 100644 --- a/static/404.html +++ b/static/404.html @@ -1 +1 @@ -NexusAI Gateway
Continue to sign in →
Continue to sign in →
\ No newline at end of file +NexusAI Gateway
Continue to sign in →
Continue to sign in →
\ No newline at end of file diff --git a/static/_next/static/6VYU5qR-4gYg0L7vwEHSN/_buildManifest.js b/static/_next/static/7SRs9Ntci43nzMnYnHM1A/_buildManifest.js similarity index 100% rename from static/_next/static/6VYU5qR-4gYg0L7vwEHSN/_buildManifest.js rename to static/_next/static/7SRs9Ntci43nzMnYnHM1A/_buildManifest.js diff --git a/static/_next/static/6VYU5qR-4gYg0L7vwEHSN/_ssgManifest.js b/static/_next/static/7SRs9Ntci43nzMnYnHM1A/_ssgManifest.js similarity index 100% rename from static/_next/static/6VYU5qR-4gYg0L7vwEHSN/_ssgManifest.js rename to static/_next/static/7SRs9Ntci43nzMnYnHM1A/_ssgManifest.js diff --git a/static/_next/static/_Q04VcFqEdiU4KDVIuAXo/_buildManifest.js b/static/_next/static/_Q04VcFqEdiU4KDVIuAXo/_buildManifest.js deleted file mode 100644 index f3d3b544106965023ca8a339f7f3983c5285731f..0000000000000000000000000000000000000000 --- a/static/_next/static/_Q04VcFqEdiU4KDVIuAXo/_buildManifest.js +++ /dev/null @@ -1 +0,0 @@ -self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/_error":["static/chunks/pages/_error-7ce03bcf1df914ce.js"],sortedPages:["/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/static/_next/static/_Q04VcFqEdiU4KDVIuAXo/_ssgManifest.js b/static/_next/static/_Q04VcFqEdiU4KDVIuAXo/_ssgManifest.js deleted file mode 100644 index 5b3ff592fd46c8736892a12864fdf3fed8775202..0000000000000000000000000000000000000000 --- a/static/_next/static/_Q04VcFqEdiU4KDVIuAXo/_ssgManifest.js +++ /dev/null @@ -1 +0,0 @@ -self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB() \ No newline at end of file diff --git a/static/_next/static/chunks/2117-1052cb5180af1179.js b/static/_next/static/chunks/2117-1052cb5180af1179.js deleted file mode 100644 index 3fa0c4019905cb0e24446198c1680aca0b6de3d3..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/2117-1052cb5180af1179.js +++ /dev/null @@ -1,2 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2117],{5157:function(e,t){"use strict";function n(){return""}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getDeploymentIdQueryOrEmptyString",{enumerable:!0,get:function(){return n}})},1572:function(){"trimStart"in String.prototype||(String.prototype.trimStart=String.prototype.trimLeft),"trimEnd"in String.prototype||(String.prototype.trimEnd=String.prototype.trimRight),"description"in Symbol.prototype||Object.defineProperty(Symbol.prototype,"description",{configurable:!0,get:function(){var e=/\((.*)\)/.exec(this.toString());return e?e[1]:void 0}}),Array.prototype.flat||(Array.prototype.flat=function(e,t){return t=this.concat.apply([],this),e>1&&t.some(Array.isArray)?t.flat(e-1):t},Array.prototype.flatMap=function(e,t){return this.map(e,t).flat()}),Promise.prototype.finally||(Promise.prototype.finally=function(e){if("function"!=typeof e)return this.then(e,e);var t=this.constructor||Promise;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){throw n})})}),Object.fromEntries||(Object.fromEntries=function(e){return Array.from(e).reduce(function(e,t){return e[t[0]]=t[1],e},{})}),Array.prototype.at||(Array.prototype.at=function(e){var t=Math.trunc(e)||0;if(t<0&&(t+=this.length),!(t<0||t>=this.length))return this[t]}),Object.hasOwn||(Object.hasOwn=function(e,t){if(null==e)throw TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(e),t)}),"canParse"in URL||(URL.canParse=function(e,t){try{return new URL(e,t),!0}catch(e){return!1}})},1634:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addBasePath",{enumerable:!0,get:function(){return u}});let r=n(8498),o=n(8521);function u(e,t){return(0,o.normalizePathTrailingSlash)((0,r.addPathPrefix)(e,""))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},5266:function(e,t){"use strict";function n(e){var t,n;t=self.__next_s,n=()=>{e()},t&&t.length?t.reduce((e,t)=>{let[n,r]=t;return e.then(()=>new Promise((e,t)=>{let o=document.createElement("script");if(r)for(let e in r)"children"!==e&&o.setAttribute(e,r[e]);n?(o.src=n,o.onload=()=>e(),o.onerror=t):r&&(o.innerHTML=r.children,setTimeout(e)),document.head.appendChild(o)}))},Promise.resolve()).catch(e=>{console.error(e)}).then(()=>{n()}):n()}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"appBootstrap",{enumerable:!0,get:function(){return n}}),window.next={version:"14.2.35",appDir:!0},("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3079:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"callServer",{enumerable:!0,get:function(){return o}});let r=n(2846);async function o(e,t){let n=(0,r.getServerActionDispatcher)();if(!n)throw Error("Invariant: missing action dispatcher.");return new Promise((r,o)=>{n({actionId:e,actionArgs:t,resolve:r,reject:o})})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},2304:function(e,t,n){"use strict";let r,o;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"hydrate",{enumerable:!0,get:function(){return x}});let u=n(7043),l=n(3099),a=n(7437);n(1572);let i=u._(n(4040)),c=l._(n(2265)),s=n(6671),f=n(8701),d=u._(n(1404)),p=n(3079),h=n(9721),y=n(2103);n(647);let _=window.console.error;window.console.error=function(){for(var e=arguments.length,t=Array(e),n=0;n{if((0,h.isNextRouterError)(e.error)){e.preventDefault();return}});let v=document,b=new TextEncoder,g=!1,m=!1,R=null;function P(e){if(0===e[0])r=[];else if(1===e[0]){if(!r)throw Error("Unexpected server data: missing bootstrap script.");o?o.enqueue(b.encode(e[1])):r.push(e[1])}else 2===e[0]&&(R=e[1])}let j=function(){o&&!m&&(o.close(),m=!0,r=void 0),g=!0};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",j,!1):j();let O=self.__next_f=self.__next_f||[];O.forEach(P),O.push=P;let E=new ReadableStream({start(e){r&&(r.forEach(t=>{e.enqueue(b.encode(t))}),g&&!m&&(e.close(),m=!0,r=void 0)),o=e}}),S=(0,s.createFromReadableStream)(E,{callServer:p.callServer});function w(){return(0,c.use)(S)}let M=c.default.StrictMode;function T(e){let{children:t}=e;return t}function x(){let e=(0,y.createMutableActionQueue)(),t=(0,a.jsx)(M,{children:(0,a.jsx)(f.HeadManagerContext.Provider,{value:{appDir:!0},children:(0,a.jsx)(y.ActionQueueContext.Provider,{value:e,children:(0,a.jsx)(T,{children:(0,a.jsx)(w,{})})})})}),n=window.__next_root_layout_missing_tags,r=!!(null==n?void 0:n.length),o={onRecoverableError:d.default};"__next_error__"===document.documentElement.id||r?i.default.createRoot(v,o).render(t):c.default.startTransition(()=>i.default.hydrateRoot(v,t,{...o,formState:R}))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4278:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(9506),(0,n(5266).appBootstrap)(()=>{let{hydrate:e}=n(2304);n(2846),n(4707),e()}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},9506:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(5157);{let e=n.u;n.u=function(){for(var t=arguments.length,n=Array(t),r=0;r(l(function(){var e;let t=document.getElementsByName(u)[0];if(null==t?void 0:null==(e=t.shadowRoot)?void 0:e.childNodes[0])return t.shadowRoot.childNodes[0];{let e=document.createElement(u);e.style.cssText="position:absolute";let t=document.createElement("div");return t.ariaLive="assertive",t.id="__next-route-announcer__",t.role="alert",t.style.cssText="position:absolute;border:0;height:1px;margin:-1px;padding:0;width:1px;clip:rect(0 0 0 0);overflow:hidden;white-space:nowrap;word-wrap:normal",e.attachShadow({mode:"open"}).appendChild(t),document.body.appendChild(e),t}}()),()=>{let e=document.getElementsByTagName(u)[0];(null==e?void 0:e.isConnected)&&document.body.removeChild(e)}),[]);let[a,i]=(0,r.useState)(""),c=(0,r.useRef)();return(0,r.useEffect)(()=>{let e="";if(document.title)e=document.title;else{let t=document.querySelector("h1");t&&(e=t.innerText||t.textContent||"")}void 0!==c.current&&c.current!==e&&i(e),c.current=e},[t]),n?(0,o.createPortal)(a,n):null}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6866:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ACTION:function(){return r},FLIGHT_PARAMETERS:function(){return i},NEXT_DID_POSTPONE_HEADER:function(){return s},NEXT_ROUTER_PREFETCH_HEADER:function(){return u},NEXT_ROUTER_STATE_TREE:function(){return o},NEXT_RSC_UNION_QUERY:function(){return c},NEXT_URL:function(){return l},RSC_CONTENT_TYPE_HEADER:function(){return a},RSC_HEADER:function(){return n}});let n="RSC",r="Next-Action",o="Next-Router-State-Tree",u="Next-Router-Prefetch",l="Next-Url",a="text/x-component",i=[[n],[o],[u]],c="_rsc",s="x-nextjs-postponed";("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},2846:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{createEmptyCacheNode:function(){return C},default:function(){return I},getServerActionDispatcher:function(){return S},urlToUrlWithoutFlightMarker:function(){return M}});let r=n(3099),o=n(7437),u=r._(n(2265)),l=n(1956),a=n(4673),i=n(3456),c=n(9060),s=n(7744),f=n(1060),d=n(2952),p=n(6146),h=n(1634),y=n(6495),_=n(4123),v=n(9320),b=n(8137),g=n(6866),m=n(5076),R=n(1283),P=n(4541),j="undefined"==typeof window,O=j?null:new Map,E=null;function S(){return E}let w={};function M(e){let t=new URL(e,location.origin);if(t.searchParams.delete(g.NEXT_RSC_UNION_QUERY),t.pathname.endsWith(".txt")){let{pathname:e}=t,n=e.endsWith("/index.txt")?10:4;t.pathname=e.slice(0,-n)}return t}function T(e){return e.origin!==window.location.origin}function x(e){let{appRouterState:t,sync:n}=e;return(0,u.useInsertionEffect)(()=>{let{tree:e,pushRef:r,canonicalUrl:o}=t,u={...r.preserveCustomHistoryState?window.history.state:{},__NA:!0,__PRIVATE_NEXTJS_INTERNALS_TREE:e};r.pendingPush&&(0,i.createHrefFromUrl)(new URL(window.location.href))!==o?(r.pendingPush=!1,window.history.pushState(u,"",o)):window.history.replaceState(u,"",o),n(t)},[t,n]),null}function C(){return{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null}}function A(e){null==e&&(e={});let t=window.history.state,n=null==t?void 0:t.__NA;n&&(e.__NA=n);let r=null==t?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE;return r&&(e.__PRIVATE_NEXTJS_INTERNALS_TREE=r),e}function N(e){let{headCacheNode:t}=e,n=null!==t?t.head:null,r=null!==t?t.prefetchHead:null,o=null!==r?r:n;return(0,u.useDeferredValue)(n,o)}function D(e){let t,{buildId:n,initialHead:r,initialTree:i,urlParts:f,initialSeedData:g,couldBeIntercepted:S,assetPrefix:M,missingSlots:C}=e,D=(0,u.useMemo)(()=>(0,d.createInitialRouterState)({buildId:n,initialSeedData:g,urlParts:f,initialTree:i,initialParallelRoutes:O,location:j?null:window.location,initialHead:r,couldBeIntercepted:S}),[n,g,f,i,r,S]),[I,U,k]=(0,s.useReducerWithReduxDevtools)(D);(0,u.useEffect)(()=>{O=null},[]);let{canonicalUrl:F}=(0,s.useUnwrapState)(I),{searchParams:L,pathname:H}=(0,u.useMemo)(()=>{let e=new URL(F,"undefined"==typeof window?"http://n":window.location.href);return{searchParams:e.searchParams,pathname:(0,R.hasBasePath)(e.pathname)?(0,m.removeBasePath)(e.pathname):e.pathname}},[F]),G=(0,u.useCallback)(e=>{let{previousTree:t,serverResponse:n}=e;(0,u.startTransition)(()=>{U({type:a.ACTION_SERVER_PATCH,previousTree:t,serverResponse:n})})},[U]),$=(0,u.useCallback)((e,t,n)=>{let r=new URL((0,h.addBasePath)(e),location.href);return U({type:a.ACTION_NAVIGATE,url:r,isExternalUrl:T(r),locationSearch:location.search,shouldScroll:null==n||n,navigateType:t})},[U]);E=(0,u.useCallback)(e=>{(0,u.startTransition)(()=>{U({...e,type:a.ACTION_SERVER_ACTION})})},[U]);let z=(0,u.useMemo)(()=>({back:()=>window.history.back(),forward:()=>window.history.forward(),prefetch:(e,t)=>{let n;if(!(0,p.isBot)(window.navigator.userAgent)){try{n=new URL((0,h.addBasePath)(e),window.location.href)}catch(t){throw Error("Cannot prefetch '"+e+"' because it cannot be converted to a URL.")}T(n)||(0,u.startTransition)(()=>{var e;U({type:a.ACTION_PREFETCH,url:n,kind:null!=(e=null==t?void 0:t.kind)?e:a.PrefetchKind.FULL})})}},replace:(e,t)=>{void 0===t&&(t={}),(0,u.startTransition)(()=>{var n;$(e,"replace",null==(n=t.scroll)||n)})},push:(e,t)=>{void 0===t&&(t={}),(0,u.startTransition)(()=>{var n;$(e,"push",null==(n=t.scroll)||n)})},refresh:()=>{(0,u.startTransition)(()=>{U({type:a.ACTION_REFRESH,origin:window.location.origin})})},fastRefresh:()=>{throw Error("fastRefresh can only be used in development mode. Please use refresh instead.")}}),[U,$]);(0,u.useEffect)(()=>{window.next&&(window.next.router=z)},[z]),(0,u.useEffect)(()=>{function e(e){var t;e.persisted&&(null==(t=window.history.state)?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE)&&(w.pendingMpaPath=void 0,U({type:a.ACTION_RESTORE,url:new URL(window.location.href),tree:window.history.state.__PRIVATE_NEXTJS_INTERNALS_TREE}))}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}},[U]);let{pushRef:B}=(0,s.useUnwrapState)(I);if(B.mpaNavigation){if(w.pendingMpaPath!==F){let e=window.location;B.pendingPush?e.assign(F):e.replace(F),w.pendingMpaPath=F}(0,u.use)(b.unresolvedThenable)}(0,u.useEffect)(()=>{let e=window.history.pushState.bind(window.history),t=window.history.replaceState.bind(window.history),n=e=>{var t;let n=window.location.href,r=null==(t=window.history.state)?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE;(0,u.startTransition)(()=>{U({type:a.ACTION_RESTORE,url:new URL(null!=e?e:n,n),tree:r})})};window.history.pushState=function(t,r,o){return(null==t?void 0:t.__NA)||(null==t?void 0:t._N)||(t=A(t),o&&n(o)),e(t,r,o)},window.history.replaceState=function(e,r,o){return(null==e?void 0:e.__NA)||(null==e?void 0:e._N)||(e=A(e),o&&n(o)),t(e,r,o)};let r=e=>{let{state:t}=e;if(t){if(!t.__NA){window.location.reload();return}(0,u.startTransition)(()=>{U({type:a.ACTION_RESTORE,url:new URL(window.location.href),tree:t.__PRIVATE_NEXTJS_INTERNALS_TREE})})}};return window.addEventListener("popstate",r),()=>{window.history.pushState=e,window.history.replaceState=t,window.removeEventListener("popstate",r)}},[U]);let{cache:W,tree:K,nextUrl:V,focusAndScrollRef:Y}=(0,s.useUnwrapState)(I),X=(0,u.useMemo)(()=>(0,v.findHeadInCache)(W,K[1]),[W,K]),q=(0,u.useMemo)(()=>(function e(t,n){for(let r of(void 0===n&&(n={}),Object.values(t[1]))){let t=r[0],o=Array.isArray(t),u=o?t[1]:t;!u||u.startsWith(P.PAGE_SEGMENT_KEY)||(o&&("c"===t[2]||"oc"===t[2])?n[t[0]]=t[1].split("/"):o&&(n[t[0]]=t[1]),n=e(r,n))}return n})(K),[K]);if(null!==X){let[e,n]=X;t=(0,o.jsx)(N,{headCacheNode:e},n)}else t=null;let J=(0,o.jsxs)(_.RedirectBoundary,{children:[t,W.rsc,(0,o.jsx)(y.AppRouterAnnouncer,{tree:K})]});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(x,{appRouterState:(0,s.useUnwrapState)(I),sync:k}),(0,o.jsx)(c.PathParamsContext.Provider,{value:q,children:(0,o.jsx)(c.PathnameContext.Provider,{value:H,children:(0,o.jsx)(c.SearchParamsContext.Provider,{value:L,children:(0,o.jsx)(l.GlobalLayoutRouterContext.Provider,{value:{buildId:n,changeByServerResponse:G,tree:K,focusAndScrollRef:Y,nextUrl:V},children:(0,o.jsx)(l.AppRouterContext.Provider,{value:z,children:(0,o.jsx)(l.LayoutRouterContext.Provider,{value:{childNodes:W.parallelRoutes,tree:K,url:F,loading:W.loading},children:J})})})})})})]})}function I(e){let{globalErrorComponent:t,...n}=e;return(0,o.jsx)(f.ErrorBoundary,{errorComponent:t,children:(0,o.jsx)(D,{...n})})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6149:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"bailoutToClientRendering",{enumerable:!0,get:function(){return u}});let r=n(8993),o=n(1845);function u(e){let t=o.staticGenerationAsyncStorage.getStore();if((null==t||!t.forceStatic)&&(null==t?void 0:t.isStaticGeneration))throw new r.BailoutToCSRError(e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},9107:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ClientPageRoot",{enumerable:!0,get:function(){return u}});let r=n(7437),o=n(4535);function u(e){let{Component:t,props:n}=e;return n.searchParams=(0,o.createDynamicallyTrackedSearchParams)(n.searchParams||{}),(0,r.jsx)(t,{...n})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},1060:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ErrorBoundary:function(){return h},ErrorBoundaryHandler:function(){return f},GlobalError:function(){return d},default:function(){return p}});let r=n(7043),o=n(7437),u=r._(n(2265)),l=n(5475),a=n(9721),i=n(1845),c={error:{fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},text:{fontSize:"14px",fontWeight:400,lineHeight:"28px",margin:"0 8px"}};function s(e){let{error:t}=e,n=i.staticGenerationAsyncStorage.getStore();if((null==n?void 0:n.isRevalidate)||(null==n?void 0:n.isStaticGeneration))throw console.error(t),t;return null}class f extends u.default.Component{static getDerivedStateFromError(e){if((0,a.isNextRouterError)(e))throw e;return{error:e}}static getDerivedStateFromProps(e,t){return e.pathname!==t.previousPathname&&t.error?{error:null,previousPathname:e.pathname}:{error:t.error,previousPathname:e.pathname}}render(){return this.state.error?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s,{error:this.state.error}),this.props.errorStyles,this.props.errorScripts,(0,o.jsx)(this.props.errorComponent,{error:this.state.error,reset:this.reset})]}):this.props.children}constructor(e){super(e),this.reset=()=>{this.setState({error:null})},this.state={error:null,previousPathname:this.props.pathname}}}function d(e){let{error:t}=e,n=null==t?void 0:t.digest;return(0,o.jsxs)("html",{id:"__next_error__",children:[(0,o.jsx)("head",{}),(0,o.jsxs)("body",{children:[(0,o.jsx)(s,{error:t}),(0,o.jsx)("div",{style:c.error,children:(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{style:c.text,children:"Application error: a "+(n?"server":"client")+"-side exception has occurred (see the "+(n?"server logs":"browser console")+" for more information)."}),n?(0,o.jsx)("p",{style:c.text,children:"Digest: "+n}):null]})})]})]})}let p=d;function h(e){let{errorComponent:t,errorStyles:n,errorScripts:r,children:u}=e,a=(0,l.usePathname)();return t?(0,o.jsx)(f,{pathname:a,errorComponent:t,errorStyles:n,errorScripts:r,children:u}):(0,o.jsx)(o.Fragment,{children:u})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6177:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{DynamicServerError:function(){return r},isDynamicServerError:function(){return o}});let n="DYNAMIC_SERVER_USAGE";class r extends Error{constructor(e){super("Dynamic server usage: "+e),this.description=e,this.digest=n}}function o(e){return"object"==typeof e&&null!==e&&"digest"in e&&"string"==typeof e.digest&&e.digest===n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},9721:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isNextRouterError",{enumerable:!0,get:function(){return u}});let r=n(8200),o=n(8968);function u(e){return e&&e.digest&&((0,o.isRedirectError)(e)||(0,r.isNotFoundError)(e))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4707:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return E}});let r=n(7043),o=n(3099),u=n(7437),l=o._(n(2265)),a=r._(n(4887)),i=n(1956),c=n(4848),s=n(8137),f=n(1060),d=n(6015),p=n(7092),h=n(4123),y=n(80),_=n(3171),v=n(8505),b=n(8077),g=["bottom","height","left","right","top","width","x","y"];function m(e,t){let n=e.getBoundingClientRect();return n.top>=0&&n.top<=t}class R extends l.default.Component{componentDidMount(){this.handlePotentialScroll()}componentDidUpdate(){this.props.focusAndScrollRef.apply&&this.handlePotentialScroll()}render(){return this.props.children}constructor(...e){super(...e),this.handlePotentialScroll=()=>{let{focusAndScrollRef:e,segmentPath:t}=this.props;if(e.apply){var n;if(0!==e.segmentPaths.length&&!e.segmentPaths.some(e=>t.every((t,n)=>(0,d.matchSegment)(t,e[n]))))return;let r=null,o=e.hashFragment;if(o&&(r="top"===o?document.body:null!=(n=document.getElementById(o))?n:document.getElementsByName(o)[0]),r||(r="undefined"==typeof window?null:a.default.findDOMNode(this)),!(r instanceof Element))return;for(;!(r instanceof HTMLElement)||function(e){if(["sticky","fixed"].includes(getComputedStyle(e).position))return!0;let t=e.getBoundingClientRect();return g.every(e=>0===t[e])}(r);){if(null===r.nextElementSibling)return;r=r.nextElementSibling}e.apply=!1,e.hashFragment=null,e.segmentPaths=[],(0,p.handleSmoothScroll)(()=>{if(o){r.scrollIntoView();return}let e=document.documentElement,t=e.clientHeight;!m(r,t)&&(e.scrollTop=0,m(r,t)||r.scrollIntoView())},{dontForceLayout:!0,onlyHashChange:e.onlyHashChange}),e.onlyHashChange=!1,r.focus()}}}}function P(e){let{segmentPath:t,children:n}=e,r=(0,l.useContext)(i.GlobalLayoutRouterContext);if(!r)throw Error("invariant global layout router not mounted");return(0,u.jsx)(R,{segmentPath:t,focusAndScrollRef:r.focusAndScrollRef,children:n})}function j(e){let{parallelRouterKey:t,url:n,childNodes:r,segmentPath:o,tree:a,cacheKey:f}=e,p=(0,l.useContext)(i.GlobalLayoutRouterContext);if(!p)throw Error("invariant global layout router not mounted");let{buildId:h,changeByServerResponse:y,tree:_}=p,v=r.get(f);if(void 0===v){let e={lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null};v=e,r.set(f,e)}let g=null!==v.prefetchRsc?v.prefetchRsc:v.rsc,m=(0,l.useDeferredValue)(v.rsc,g),R="object"==typeof m&&null!==m&&"function"==typeof m.then?(0,l.use)(m):m;if(!R){let e=v.lazyData;if(null===e){let t=function e(t,n){if(t){let[r,o]=t,u=2===t.length;if((0,d.matchSegment)(n[0],r)&&n[1].hasOwnProperty(o)){if(u){let t=e(void 0,n[1][o]);return[n[0],{...n[1],[o]:[t[0],t[1],t[2],"refetch"]}]}return[n[0],{...n[1],[o]:e(t.slice(2),n[1][o])}]}}return n}(["",...o],_),r=(0,b.hasInterceptionRouteInCurrentTree)(_);v.lazyData=e=(0,c.fetchServerResponse)(new URL(n,location.origin),t,r?p.nextUrl:null,h),v.lazyDataResolved=!1}let t=(0,l.use)(e);v.lazyDataResolved||(setTimeout(()=>{(0,l.startTransition)(()=>{y({previousTree:_,serverResponse:t})})}),v.lazyDataResolved=!0),(0,l.use)(s.unresolvedThenable)}return(0,u.jsx)(i.LayoutRouterContext.Provider,{value:{tree:a[1][t],childNodes:v.parallelRoutes,url:n,loading:v.loading},children:R})}function O(e){let{children:t,hasLoading:n,loading:r,loadingStyles:o,loadingScripts:a}=e;return n?(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(u.Fragment,{children:[o,a,r]}),children:t}):(0,u.jsx)(u.Fragment,{children:t})}function E(e){let{parallelRouterKey:t,segmentPath:n,error:r,errorStyles:o,errorScripts:a,templateStyles:c,templateScripts:s,template:d,notFound:p,notFoundStyles:b}=e,g=(0,l.useContext)(i.LayoutRouterContext);if(!g)throw Error("invariant expected layout router to be mounted");let{childNodes:m,tree:R,url:E,loading:S}=g,w=m.get(t);w||(w=new Map,m.set(t,w));let M=R[1][t][0],T=(0,_.getSegmentValue)(M),x=[M];return(0,u.jsx)(u.Fragment,{children:x.map(e=>{let l=(0,_.getSegmentValue)(e),g=(0,v.createRouterCacheKey)(e);return(0,u.jsxs)(i.TemplateContext.Provider,{value:(0,u.jsx)(P,{segmentPath:n,children:(0,u.jsx)(f.ErrorBoundary,{errorComponent:r,errorStyles:o,errorScripts:a,children:(0,u.jsx)(O,{hasLoading:!!S,loading:null==S?void 0:S[0],loadingStyles:null==S?void 0:S[1],loadingScripts:null==S?void 0:S[2],children:(0,u.jsx)(y.NotFoundBoundary,{notFound:p,notFoundStyles:b,children:(0,u.jsx)(h.RedirectBoundary,{children:(0,u.jsx)(j,{parallelRouterKey:t,url:E,tree:R,childNodes:w,segmentPath:n,cacheKey:g,isActive:T===l})})})})})}),children:[c,s,d]},(0,v.createRouterCacheKey)(e,!0))})})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6015:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{canSegmentBeOverridden:function(){return u},matchSegment:function(){return o}});let r=n(7417),o=(e,t)=>"string"==typeof e?"string"==typeof t&&e===t:"string"!=typeof t&&e[0]===t[0]&&e[1]===t[1],u=(e,t)=>{var n;return!Array.isArray(e)&&!!Array.isArray(t)&&(null==(n=(0,r.getSegmentParam)(e))?void 0:n.param)===t[0]};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},5475:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ReadonlyURLSearchParams:function(){return i.ReadonlyURLSearchParams},RedirectType:function(){return i.RedirectType},ServerInsertedHTMLContext:function(){return c.ServerInsertedHTMLContext},notFound:function(){return i.notFound},permanentRedirect:function(){return i.permanentRedirect},redirect:function(){return i.redirect},useParams:function(){return p},usePathname:function(){return f},useRouter:function(){return d},useSearchParams:function(){return s},useSelectedLayoutSegment:function(){return y},useSelectedLayoutSegments:function(){return h},useServerInsertedHTML:function(){return c.useServerInsertedHTML}});let r=n(2265),o=n(1956),u=n(9060),l=n(3171),a=n(4541),i=n(2646),c=n(5501);function s(){let e=(0,r.useContext)(u.SearchParamsContext),t=(0,r.useMemo)(()=>e?new i.ReadonlyURLSearchParams(e):null,[e]);if("undefined"==typeof window){let{bailoutToClientRendering:e}=n(6149);e("useSearchParams()")}return t}function f(){return(0,r.useContext)(u.PathnameContext)}function d(){let e=(0,r.useContext)(o.AppRouterContext);if(null===e)throw Error("invariant expected app router to be mounted");return e}function p(){return(0,r.useContext)(u.PathParamsContext)}function h(e){void 0===e&&(e="children");let t=(0,r.useContext)(o.LayoutRouterContext);return t?function e(t,n,r,o){let u;if(void 0===r&&(r=!0),void 0===o&&(o=[]),r)u=t[1][n];else{var i;let e=t[1];u=null!=(i=e.children)?i:Object.values(e)[0]}if(!u)return o;let c=u[0],s=(0,l.getSegmentValue)(c);return!s||s.startsWith(a.PAGE_SEGMENT_KEY)?o:(o.push(s),e(u,n,!1,o))}(t.tree,e):null}function y(e){void 0===e&&(e="children");let t=h(e);if(!t||0===t.length)return null;let n="children"===e?t[0]:t[t.length-1];return n===a.DEFAULT_SEGMENT_KEY?null:n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},2646:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ReadonlyURLSearchParams:function(){return l},RedirectType:function(){return r.RedirectType},notFound:function(){return o.notFound},permanentRedirect:function(){return r.permanentRedirect},redirect:function(){return r.redirect}});let r=n(8968),o=n(8200);class u extends Error{constructor(){super("Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams")}}class l extends URLSearchParams{append(){throw new u}delete(){throw new u}set(){throw new u}sort(){throw new u}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},80:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"NotFoundBoundary",{enumerable:!0,get:function(){return s}});let r=n(3099),o=n(7437),u=r._(n(2265)),l=n(5475),a=n(8200);n(1765);let i=n(1956);class c extends u.default.Component{componentDidCatch(){}static getDerivedStateFromError(e){if((0,a.isNotFoundError)(e))return{notFoundTriggered:!0};throw e}static getDerivedStateFromProps(e,t){return e.pathname!==t.previousPathname&&t.notFoundTriggered?{notFoundTriggered:!1,previousPathname:e.pathname}:{notFoundTriggered:t.notFoundTriggered,previousPathname:e.pathname}}render(){return this.state.notFoundTriggered?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("meta",{name:"robots",content:"noindex"}),!1,this.props.notFoundStyles,this.props.notFound]}):this.props.children}constructor(e){super(e),this.state={notFoundTriggered:!!e.asNotFound,previousPathname:e.pathname}}}function s(e){let{notFound:t,notFoundStyles:n,asNotFound:r,children:a}=e,s=(0,l.usePathname)(),f=(0,u.useContext)(i.MissingSlotContext);return t?(0,o.jsx)(c,{pathname:s,notFound:t,notFoundStyles:n,asNotFound:r,missingSlots:f,children:a}):(0,o.jsx)(o.Fragment,{children:a})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},8200:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{isNotFoundError:function(){return o},notFound:function(){return r}});let n="NEXT_NOT_FOUND";function r(){let e=Error(n);throw e.digest=n,e}function o(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},9744:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PromiseQueue",{enumerable:!0,get:function(){return c}});let r=n(2522),o=n(675);var u=o._("_maxConcurrency"),l=o._("_runningCount"),a=o._("_queue"),i=o._("_processNext");class c{enqueue(e){let t,n;let o=new Promise((e,r)=>{t=e,n=r}),u=async()=>{try{r._(this,l)[l]++;let n=await e();t(n)}catch(e){n(e)}finally{r._(this,l)[l]--,r._(this,i)[i]()}};return r._(this,a)[a].push({promiseFn:o,task:u}),r._(this,i)[i](),o}bump(e){let t=r._(this,a)[a].findIndex(t=>t.promiseFn===e);if(t>-1){let e=r._(this,a)[a].splice(t,1)[0];r._(this,a)[a].unshift(e),r._(this,i)[i](!0)}}constructor(e=5){Object.defineProperty(this,i,{value:s}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,a,{writable:!0,value:void 0}),r._(this,u)[u]=e,r._(this,l)[l]=0,r._(this,a)[a]=[]}}function s(e){if(void 0===e&&(e=!1),(r._(this,l)[l]0){var t;null==(t=r._(this,a)[a].shift())||t.task()}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4123:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{RedirectBoundary:function(){return s},RedirectErrorBoundary:function(){return c}});let r=n(3099),o=n(7437),u=r._(n(2265)),l=n(5475),a=n(8968);function i(e){let{redirect:t,reset:n,redirectType:r}=e,o=(0,l.useRouter)();return(0,u.useEffect)(()=>{u.default.startTransition(()=>{r===a.RedirectType.push?o.push(t,{}):o.replace(t,{}),n()})},[t,r,n,o]),null}class c extends u.default.Component{static getDerivedStateFromError(e){if((0,a.isRedirectError)(e))return{redirect:(0,a.getURLFromRedirectError)(e),redirectType:(0,a.getRedirectTypeFromError)(e)};throw e}render(){let{redirect:e,redirectType:t}=this.state;return null!==e&&null!==t?(0,o.jsx)(i,{redirect:e,redirectType:t,reset:()=>this.setState({redirect:null})}):this.props.children}constructor(e){super(e),this.state={redirect:null,redirectType:null}}}function s(e){let{children:t}=e,n=(0,l.useRouter)();return(0,o.jsx)(c,{router:n,children:t})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},5001:function(e,t){"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RedirectStatusCode",{enumerable:!0,get:function(){return n}}),(r=n||(n={}))[r.SeeOther=303]="SeeOther",r[r.TemporaryRedirect=307]="TemporaryRedirect",r[r.PermanentRedirect=308]="PermanentRedirect",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},8968:function(e,t,n){"use strict";var r,o;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{RedirectType:function(){return r},getRedirectError:function(){return c},getRedirectStatusCodeFromError:function(){return y},getRedirectTypeFromError:function(){return h},getURLFromRedirectError:function(){return p},isRedirectError:function(){return d},permanentRedirect:function(){return f},redirect:function(){return s}});let u=n(544),l=n(295),a=n(5001),i="NEXT_REDIRECT";function c(e,t,n){void 0===n&&(n=a.RedirectStatusCode.TemporaryRedirect);let r=Error(i);r.digest=i+";"+t+";"+e+";"+n+";";let o=u.requestAsyncStorage.getStore();return o&&(r.mutableCookies=o.mutableCookies),r}function s(e,t){void 0===t&&(t="replace");let n=l.actionAsyncStorage.getStore();throw c(e,t,(null==n?void 0:n.isAction)?a.RedirectStatusCode.SeeOther:a.RedirectStatusCode.TemporaryRedirect)}function f(e,t){void 0===t&&(t="replace");let n=l.actionAsyncStorage.getStore();throw c(e,t,(null==n?void 0:n.isAction)?a.RedirectStatusCode.SeeOther:a.RedirectStatusCode.PermanentRedirect)}function d(e){if("object"!=typeof e||null===e||!("digest"in e)||"string"!=typeof e.digest)return!1;let[t,n,r,o]=e.digest.split(";",4),u=Number(o);return t===i&&("replace"===n||"push"===n)&&"string"==typeof r&&!isNaN(u)&&u in a.RedirectStatusCode}function p(e){return d(e)?e.digest.split(";",3)[2]:null}function h(e){if(!d(e))throw Error("Not a redirect error");return e.digest.split(";",2)[1]}function y(e){if(!d(e))throw Error("Not a redirect error");return Number(e.digest.split(";",4)[3])}(o=r||(r={})).push="push",o.replace="replace",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6423:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let r=n(3099),o=n(7437),u=r._(n(2265)),l=n(1956);function a(){let e=(0,u.useContext)(l.TemplateContext);return(0,o.jsx)(o.Fragment,{children:e})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},544:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{getExpectedRequestStore:function(){return o},requestAsyncStorage:function(){return r.requestAsyncStorage}});let r=n(9134);function o(e){let t=r.requestAsyncStorage.getStore();if(t)return t;throw Error("`"+e+"` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context")}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},2356:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"applyFlightData",{enumerable:!0,get:function(){return u}});let r=n(7420),o=n(2576);function u(e,t,n,u){let[l,a,i]=n.slice(-3);if(null===a)return!1;if(3===n.length){let n=a[2],o=a[3];t.loading=o,t.rsc=n,t.prefetchRsc=null,(0,r.fillLazyItemsTillLeafWithHead)(t,e,l,a,i,u)}else t.rsc=e.rsc,t.prefetchRsc=e.prefetchRsc,t.parallelRoutes=new Map(e.parallelRoutes),t.loading=e.loading,(0,o.fillCacheWithNewSubTreeData)(t,e,n,u);return!0}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},1935:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"applyRouterStatePatchToTree",{enumerable:!0,get:function(){return function e(t,n,r,a){let i;let[c,s,f,d,p]=n;if(1===t.length){let e=l(n,r,t);return(0,u.addRefreshMarkerToActiveParallelSegments)(e,a),e}let[h,y]=t;if(!(0,o.matchSegment)(h,c))return null;if(2===t.length)i=l(s[y],r,t);else if(null===(i=e(t.slice(2),s[y],r,a)))return null;let _=[t[0],{...s,[y]:i},f,d];return p&&(_[4]=!0),(0,u.addRefreshMarkerToActiveParallelSegments)(_,a),_}}});let r=n(4541),o=n(6015),u=n(232);function l(e,t,n){let[u,a]=e,[i,c]=t;if(i===r.DEFAULT_SEGMENT_KEY&&u!==r.DEFAULT_SEGMENT_KEY)return e;if((0,o.matchSegment)(u,i)){let t={};for(let e in a)void 0!==c[e]?t[e]=l(a[e],c[e],n):t[e]=a[e];for(let e in c)t[e]||(t[e]=c[e]);let r=[u,t];return e[2]&&(r[2]=e[2]),e[3]&&(r[3]=e[3]),e[4]&&(r[4]=e[4]),r}return t}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},5556:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"clearCacheNodeDataForSegmentPath",{enumerable:!0,get:function(){return function e(t,n,o){let u=o.length<=2,[l,a]=o,i=(0,r.createRouterCacheKey)(a),c=n.parallelRoutes.get(l),s=t.parallelRoutes.get(l);s&&s!==c||(s=new Map(c),t.parallelRoutes.set(l,s));let f=null==c?void 0:c.get(i),d=s.get(i);if(u){d&&d.lazyData&&d!==f||s.set(i,{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null});return}if(!d||!f){d||s.set(i,{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null});return}return d===f&&(d={lazyData:d.lazyData,rsc:d.rsc,prefetchRsc:d.prefetchRsc,head:d.head,prefetchHead:d.prefetchHead,parallelRoutes:new Map(d.parallelRoutes),lazyDataResolved:d.lazyDataResolved,loading:d.loading},s.set(i,d)),e(d,f,o.slice(2))}}});let r=n(8505);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},5410:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{computeChangedPath:function(){return s},extractPathFromFlightRouterState:function(){return c}});let r=n(1182),o=n(4541),u=n(6015),l=e=>"/"===e[0]?e.slice(1):e,a=e=>"string"==typeof e?"children"===e?"":e:e[1];function i(e){return e.reduce((e,t)=>""===(t=l(t))||(0,o.isGroupSegment)(t)?e:e+"/"+t,"")||"/"}function c(e){var t;let n=Array.isArray(e[0])?e[0][1]:e[0];if(n===o.DEFAULT_SEGMENT_KEY||r.INTERCEPTION_ROUTE_MARKERS.some(e=>n.startsWith(e)))return;if(n.startsWith(o.PAGE_SEGMENT_KEY))return"";let u=[a(n)],l=null!=(t=e[1])?t:{},s=l.children?c(l.children):void 0;if(void 0!==s)u.push(s);else for(let[e,t]of Object.entries(l)){if("children"===e)continue;let n=c(t);void 0!==n&&u.push(n)}return i(u)}function s(e,t){let n=function e(t,n){let[o,l]=t,[i,s]=n,f=a(o),d=a(i);if(r.INTERCEPTION_ROUTE_MARKERS.some(e=>f.startsWith(e)||d.startsWith(e)))return"";if(!(0,u.matchSegment)(o,i)){var p;return null!=(p=c(n))?p:""}for(let t in l)if(s[t]){let n=e(l[t],s[t]);if(null!==n)return a(i)+"/"+n}return null}(e,t);return null==n||"/"===n?n:i(n.split("/"))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3456:function(e,t){"use strict";function n(e,t){return void 0===t&&(t=!0),e.pathname+e.search+(t?e.hash:"")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createHrefFromUrl",{enumerable:!0,get:function(){return n}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},2952:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createInitialRouterState",{enumerable:!0,get:function(){return c}});let r=n(3456),o=n(7420),u=n(5410),l=n(305),a=n(4673),i=n(232);function c(e){var t;let{buildId:n,initialTree:c,initialSeedData:s,urlParts:f,initialParallelRoutes:d,location:p,initialHead:h,couldBeIntercepted:y}=e,_=f.join("/"),v=!p,b={lazyData:null,rsc:s[2],prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:v?new Map:d,lazyDataResolved:!1,loading:s[3]},g=p?(0,r.createHrefFromUrl)(p):_;(0,i.addRefreshMarkerToActiveParallelSegments)(c,g);let m=new Map;(null===d||0===d.size)&&(0,o.fillLazyItemsTillLeafWithHead)(b,void 0,c,s,h);let R={buildId:n,tree:c,cache:b,prefetchCache:m,pushRef:{pendingPush:!1,mpaNavigation:!1,preserveCustomHistoryState:!0},focusAndScrollRef:{apply:!1,onlyHashChange:!1,hashFragment:null,segmentPaths:[]},canonicalUrl:g,nextUrl:null!=(t=(0,u.extractPathFromFlightRouterState)(c)||(null==p?void 0:p.pathname))?t:null};if(p){let e=new URL(""+p.pathname+p.search,p.origin),t=[["",c,null,null]];(0,l.createPrefetchCacheEntryForInitialLoad)({url:e,kind:a.PrefetchKind.AUTO,data:[t,void 0,!1,y],tree:R.tree,prefetchCache:R.prefetchCache,nextUrl:R.nextUrl})}return R}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},8505:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createRouterCacheKey",{enumerable:!0,get:function(){return o}});let r=n(4541);function o(e,t){return(void 0===t&&(t=!1),Array.isArray(e))?e[0]+"|"+e[1]+"|"+e[2]:t&&e.startsWith(r.PAGE_SEGMENT_KEY)?r.PAGE_SEGMENT_KEY:e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4848:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"fetchServerResponse",{enumerable:!0,get:function(){return f}});let r=n(6866),o=n(2846),u=n(3079),l=n(4673),a=n(7207),i=n(1311),{createFromFetch:c}=n(6671);function s(e){return[(0,o.urlToUrlWithoutFlightMarker)(e).toString(),void 0,!1,!1]}async function f(e,t,n,f,d){let p={[r.RSC_HEADER]:"1",[r.NEXT_ROUTER_STATE_TREE]:(0,i.prepareFlightRouterStateForRequest)(t)};d===l.PrefetchKind.AUTO&&(p[r.NEXT_ROUTER_PREFETCH_HEADER]="1"),n&&(p[r.NEXT_URL]=n);let h=(0,a.hexHash)([p[r.NEXT_ROUTER_PREFETCH_HEADER]||"0",p[r.NEXT_ROUTER_STATE_TREE],p[r.NEXT_URL]].join(","));try{var y;let t=new URL(e);t.pathname.endsWith("/")?t.pathname+="index.txt":t.pathname+=".txt",t.searchParams.set(r.NEXT_RSC_UNION_QUERY,h);let n=await fetch(t,{credentials:"same-origin",headers:p}),l=(0,o.urlToUrlWithoutFlightMarker)(n.url),a=n.redirected?l:void 0,i=n.headers.get("content-type")||"",d=!!n.headers.get(r.NEXT_DID_POSTPONE_HEADER),_=!!(null==(y=n.headers.get("vary"))?void 0:y.includes(r.NEXT_URL)),v=i===r.RSC_CONTENT_TYPE_HEADER;if(v||(v=i.startsWith("text/plain")),!v||!n.ok)return e.hash&&(l.hash=e.hash),s(l.toString());let[b,g]=await c(Promise.resolve(n),{callServer:u.callServer});if(f!==b)return s(n.url);return[g,a,d,_]}catch(t){return console.error("Failed to fetch RSC payload for "+e+". Falling back to browser navigation.",t),[e.toString(),void 0,!1,!1]}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},2576:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"fillCacheWithNewSubTreeData",{enumerable:!0,get:function(){return function e(t,n,l,a){let i=l.length<=5,[c,s]=l,f=(0,u.createRouterCacheKey)(s),d=n.parallelRoutes.get(c);if(!d)return;let p=t.parallelRoutes.get(c);p&&p!==d||(p=new Map(d),t.parallelRoutes.set(c,p));let h=d.get(f),y=p.get(f);if(i){if(!y||!y.lazyData||y===h){let e=l[3];y={lazyData:null,rsc:e[2],prefetchRsc:null,head:null,prefetchHead:null,loading:e[3],parallelRoutes:h?new Map(h.parallelRoutes):new Map,lazyDataResolved:!1},h&&(0,r.invalidateCacheByRouterState)(y,h,l[2]),(0,o.fillLazyItemsTillLeafWithHead)(y,h,l[2],e,l[4],a),p.set(f,y)}return}y&&h&&(y===h&&(y={lazyData:y.lazyData,rsc:y.rsc,prefetchRsc:y.prefetchRsc,head:y.head,prefetchHead:y.prefetchHead,parallelRoutes:new Map(y.parallelRoutes),lazyDataResolved:!1,loading:y.loading},p.set(f,y)),e(y,h,l.slice(2),a))}}});let r=n(4377),o=n(7420),u=n(8505);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},7420:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"fillLazyItemsTillLeafWithHead",{enumerable:!0,get:function(){return function e(t,n,u,l,a,i){if(0===Object.keys(u[1]).length){t.head=a;return}for(let c in u[1]){let s;let f=u[1][c],d=f[0],p=(0,r.createRouterCacheKey)(d),h=null!==l&&void 0!==l[1][c]?l[1][c]:null;if(n){let r=n.parallelRoutes.get(c);if(r){let n;let u=(null==i?void 0:i.kind)==="auto"&&i.status===o.PrefetchCacheEntryStatus.reusable,l=new Map(r),s=l.get(p);n=null!==h?{lazyData:null,rsc:h[2],prefetchRsc:null,head:null,prefetchHead:null,loading:h[3],parallelRoutes:new Map(null==s?void 0:s.parallelRoutes),lazyDataResolved:!1}:u&&s?{lazyData:s.lazyData,rsc:s.rsc,prefetchRsc:s.prefetchRsc,head:s.head,prefetchHead:s.prefetchHead,parallelRoutes:new Map(s.parallelRoutes),lazyDataResolved:s.lazyDataResolved,loading:s.loading}:{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map(null==s?void 0:s.parallelRoutes),lazyDataResolved:!1,loading:null},l.set(p,n),e(n,s,f,h||null,a,i),t.parallelRoutes.set(c,l);continue}}if(null!==h){let e=h[2],t=h[3];s={lazyData:null,rsc:e,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:t}}else s={lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null};let y=t.parallelRoutes.get(c);y?y.set(p,s):t.parallelRoutes.set(c,new Map([[p,s]])),e(s,void 0,f,h,a,i)}}}});let r=n(8505),o=n(4673);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4510:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"handleMutable",{enumerable:!0,get:function(){return u}});let r=n(5410);function o(e){return void 0!==e}function u(e,t){var n,u,l;let a=null==(u=t.shouldScroll)||u,i=e.nextUrl;if(o(t.patchedTree)){let n=(0,r.computeChangedPath)(e.tree,t.patchedTree);n?i=n:i||(i=e.canonicalUrl)}return{buildId:e.buildId,canonicalUrl:o(t.canonicalUrl)?t.canonicalUrl===e.canonicalUrl?e.canonicalUrl:t.canonicalUrl:e.canonicalUrl,pushRef:{pendingPush:o(t.pendingPush)?t.pendingPush:e.pushRef.pendingPush,mpaNavigation:o(t.mpaNavigation)?t.mpaNavigation:e.pushRef.mpaNavigation,preserveCustomHistoryState:o(t.preserveCustomHistoryState)?t.preserveCustomHistoryState:e.pushRef.preserveCustomHistoryState},focusAndScrollRef:{apply:!!a&&(!!o(null==t?void 0:t.scrollableSegments)||e.focusAndScrollRef.apply),onlyHashChange:!!t.hashFragment&&e.canonicalUrl.split("#",1)[0]===(null==(n=t.canonicalUrl)?void 0:n.split("#",1)[0]),hashFragment:a?t.hashFragment&&""!==t.hashFragment?decodeURIComponent(t.hashFragment.slice(1)):e.focusAndScrollRef.hashFragment:null,segmentPaths:a?null!=(l=null==t?void 0:t.scrollableSegments)?l:e.focusAndScrollRef.segmentPaths:[]},cache:t.cache?t.cache:e.cache,prefetchCache:t.prefetchCache?t.prefetchCache:e.prefetchCache,tree:o(t.patchedTree)?t.patchedTree:e.tree,nextUrl:i}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},7831:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"handleSegmentMismatch",{enumerable:!0,get:function(){return o}});let r=n(5967);function o(e,t,n){return(0,r.handleExternalUrl)(e,{},e.canonicalUrl,!0)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},7058:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"invalidateCacheBelowFlightSegmentPath",{enumerable:!0,get:function(){return function e(t,n,o){let u=o.length<=2,[l,a]=o,i=(0,r.createRouterCacheKey)(a),c=n.parallelRoutes.get(l);if(!c)return;let s=t.parallelRoutes.get(l);if(s&&s!==c||(s=new Map(c),t.parallelRoutes.set(l,s)),u){s.delete(i);return}let f=c.get(i),d=s.get(i);d&&f&&(d===f&&(d={lazyData:d.lazyData,rsc:d.rsc,prefetchRsc:d.prefetchRsc,head:d.head,prefetchHead:d.prefetchHead,parallelRoutes:new Map(d.parallelRoutes),lazyDataResolved:d.lazyDataResolved},s.set(i,d)),e(d,f,o.slice(2)))}}});let r=n(8505);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4377:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"invalidateCacheByRouterState",{enumerable:!0,get:function(){return o}});let r=n(8505);function o(e,t,n){for(let o in n[1]){let u=n[1][o][0],l=(0,r.createRouterCacheKey)(u),a=t.parallelRoutes.get(o);if(a){let t=new Map(a);t.delete(l),e.parallelRoutes.set(o,t)}}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3237:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isNavigatingToNewRootLayout",{enumerable:!0,get:function(){return function e(t,n){let r=t[0],o=n[0];if(Array.isArray(r)&&Array.isArray(o)){if(r[0]!==o[0]||r[2]!==o[2])return!0}else if(r!==o)return!0;if(t[4])return!n[4];if(n[4])return!0;let u=Object.values(t[1])[0],l=Object.values(n[1])[0];return!u||!l||e(u,l)}}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6118:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{abortTask:function(){return c},listenForDynamicRequest:function(){return a},updateCacheNodeOnNavigation:function(){return function e(t,n,a,c,s){let f=n[1],d=a[1],p=c[1],h=t.parallelRoutes,y=new Map(h),_={},v=null;for(let t in d){let n;let a=d[t],c=f[t],b=h.get(t),g=p[t],m=a[0],R=(0,u.createRouterCacheKey)(m),P=void 0!==c?c[0]:void 0,j=void 0!==b?b.get(R):void 0;if(null!==(n=m===r.PAGE_SEGMENT_KEY?l(a,void 0!==g?g:null,s):m===r.DEFAULT_SEGMENT_KEY?void 0!==c?{route:c,node:null,children:null}:l(a,void 0!==g?g:null,s):void 0!==P&&(0,o.matchSegment)(m,P)&&void 0!==j&&void 0!==c?null!=g?e(j,c,a,g,s):function(e){let t=i(e,null,null);return{route:e,node:t,children:null}}(a):l(a,void 0!==g?g:null,s))){null===v&&(v=new Map),v.set(t,n);let e=n.node;if(null!==e){let n=new Map(b);n.set(R,e),y.set(t,n)}_[t]=n.route}else _[t]=a}if(null===v)return null;let b={lazyData:null,rsc:t.rsc,prefetchRsc:t.prefetchRsc,head:t.head,prefetchHead:t.prefetchHead,loading:t.loading,parallelRoutes:y,lazyDataResolved:!1};return{route:function(e,t){let n=[e[0],t];return 2 in e&&(n[2]=e[2]),3 in e&&(n[3]=e[3]),4 in e&&(n[4]=e[4]),n}(a,_),node:b,children:v}}},updateCacheNodeOnPopstateRestoration:function(){return function e(t,n){let r=n[1],o=t.parallelRoutes,l=new Map(o);for(let t in r){let n=r[t],a=n[0],i=(0,u.createRouterCacheKey)(a),c=o.get(t);if(void 0!==c){let r=c.get(i);if(void 0!==r){let o=e(r,n),u=new Map(c);u.set(i,o),l.set(t,u)}}}let a=t.rsc,i=d(a)&&"pending"===a.status;return{lazyData:null,rsc:a,head:t.head,prefetchHead:i?t.prefetchHead:null,prefetchRsc:i?t.prefetchRsc:null,loading:i?t.loading:null,parallelRoutes:l,lazyDataResolved:!1}}}});let r=n(4541),o=n(6015),u=n(8505);function l(e,t,n){let r=i(e,t,n);return{route:e,node:r,children:null}}function a(e,t){t.then(t=>{for(let n of t[0]){let t=n.slice(0,-3),r=n[n.length-3],l=n[n.length-2],a=n[n.length-1];"string"!=typeof t&&function(e,t,n,r,l){let a=e;for(let e=0;e{c(e,t)})}function i(e,t,n){let r=e[1],o=null!==t?t[1]:null,l=new Map;for(let e in r){let t=r[e],a=null!==o?o[e]:null,c=t[0],s=(0,u.createRouterCacheKey)(c),f=i(t,void 0===a?null:a,n),d=new Map;d.set(s,f),l.set(e,d)}let a=0===l.size,c=null!==t?t[2]:null,s=null!==t?t[3]:null;return{lazyData:null,parallelRoutes:l,prefetchRsc:void 0!==c?c:null,prefetchHead:a?n:null,loading:void 0!==s?s:null,rsc:p(),head:a?p():null,lazyDataResolved:!1}}function c(e,t){let n=e.node;if(null===n)return;let r=e.children;if(null===r)s(e.route,n,t);else for(let e of r.values())c(e,t);e.node=null}function s(e,t,n){let r=e[1],o=t.parallelRoutes;for(let e in r){let t=r[e],l=o.get(e);if(void 0===l)continue;let a=t[0],i=(0,u.createRouterCacheKey)(a),c=l.get(i);void 0!==c&&s(t,c,n)}let l=t.rsc;d(l)&&(null===n?l.resolve(null):l.reject(n));let a=t.head;d(a)&&a.resolve(null)}let f=Symbol();function d(e){return e&&e.tag===f}function p(){let e,t;let n=new Promise((n,r)=>{e=n,t=r});return n.status="pending",n.resolve=t=>{"pending"===n.status&&(n.status="fulfilled",n.value=t,e(t))},n.reject=e=>{"pending"===n.status&&(n.status="rejected",n.reason=e,t(e))},n.tag=f,n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},305:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{createPrefetchCacheEntryForInitialLoad:function(){return c},getOrCreatePrefetchCacheEntry:function(){return i},prunePrefetchCache:function(){return f}});let r=n(3456),o=n(4848),u=n(4673),l=n(4819);function a(e,t){let n=(0,r.createHrefFromUrl)(e,!1);return t?t+"%"+n:n}function i(e){let t,{url:n,nextUrl:r,tree:o,buildId:l,prefetchCache:i,kind:c}=e,f=a(n,r),d=i.get(f);if(d)t=d;else{let e=a(n),r=i.get(e);r&&(t=r)}return t?(t.status=h(t),t.kind!==u.PrefetchKind.FULL&&c===u.PrefetchKind.FULL)?s({tree:o,url:n,buildId:l,nextUrl:r,prefetchCache:i,kind:null!=c?c:u.PrefetchKind.TEMPORARY}):(c&&t.kind===u.PrefetchKind.TEMPORARY&&(t.kind=c),t):s({tree:o,url:n,buildId:l,nextUrl:r,prefetchCache:i,kind:c||u.PrefetchKind.TEMPORARY})}function c(e){let{nextUrl:t,tree:n,prefetchCache:r,url:o,kind:l,data:i}=e,[,,,c]=i,s=c?a(o,t):a(o),f={treeAtTimeOfPrefetch:n,data:Promise.resolve(i),kind:l,prefetchTime:Date.now(),lastUsedTime:Date.now(),key:s,status:u.PrefetchCacheEntryStatus.fresh};return r.set(s,f),f}function s(e){let{url:t,kind:n,tree:r,nextUrl:i,buildId:c,prefetchCache:s}=e,f=a(t),d=l.prefetchQueue.enqueue(()=>(0,o.fetchServerResponse)(t,r,i,c,n).then(e=>{let[,,,n]=e;return n&&function(e){let{url:t,nextUrl:n,prefetchCache:r}=e,o=a(t),u=r.get(o);if(!u)return;let l=a(t,n);r.set(l,u),r.delete(o)}({url:t,nextUrl:i,prefetchCache:s}),e})),p={treeAtTimeOfPrefetch:r,data:d,kind:n,prefetchTime:Date.now(),lastUsedTime:null,key:f,status:u.PrefetchCacheEntryStatus.fresh};return s.set(f,p),p}function f(e){for(let[t,n]of e)h(n)===u.PrefetchCacheEntryStatus.expired&&e.delete(t)}let d=1e3*Number("30"),p=1e3*Number("300");function h(e){let{kind:t,prefetchTime:n,lastUsedTime:r}=e;return Date.now()<(null!=r?r:n)+d?r?u.PrefetchCacheEntryStatus.reusable:u.PrefetchCacheEntryStatus.fresh:"auto"===t&&Date.now(){let[n,f]=t,h=!1;if(E.lastUsedTime||(E.lastUsedTime=Date.now(),h=!0),"string"==typeof n)return _(e,R,n,O);if(document.getElementById("__next-page-redirect"))return _(e,R,j,O);let b=e.tree,g=e.cache,w=[];for(let t of n){let n=t.slice(0,-4),r=t.slice(-3)[0],c=["",...n],f=(0,u.applyRouterStatePatchToTree)(c,b,r,j);if(null===f&&(f=(0,u.applyRouterStatePatchToTree)(c,S,r,j)),null!==f){if((0,a.isNavigatingToNewRootLayout)(b,f))return _(e,R,j,O);let u=(0,d.createEmptyCacheNode)(),m=!1;for(let e of(E.status!==i.PrefetchCacheEntryStatus.stale||h?m=(0,s.applyFlightData)(g,u,t,E):(m=function(e,t,n,r){let o=!1;for(let u of(e.rsc=t.rsc,e.prefetchRsc=t.prefetchRsc,e.loading=t.loading,e.parallelRoutes=new Map(t.parallelRoutes),v(r).map(e=>[...n,...e])))(0,y.clearCacheNodeDataForSegmentPath)(e,t,u),o=!0;return o}(u,g,n,r),E.lastUsedTime=Date.now()),(0,l.shouldHardNavigate)(c,b)?(u.rsc=g.rsc,u.prefetchRsc=g.prefetchRsc,(0,o.invalidateCacheBelowFlightSegmentPath)(u,g,n),R.cache=u):m&&(R.cache=u,g=u),b=f,v(r))){let t=[...n,...e];t[t.length-1]!==p.DEFAULT_SEGMENT_KEY&&w.push(t)}}}return R.patchedTree=b,R.canonicalUrl=f?(0,r.createHrefFromUrl)(f):j,R.pendingPush=O,R.scrollableSegments=w,R.hashFragment=P,R.shouldScroll=m,(0,c.handleMutable)(e,R)},()=>e)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4819:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{prefetchQueue:function(){return l},prefetchReducer:function(){return a}});let r=n(6866),o=n(9744),u=n(305),l=new o.PromiseQueue(5);function a(e,t){(0,u.prunePrefetchCache)(e.prefetchCache);let{url:n}=t;return n.searchParams.delete(r.NEXT_RSC_UNION_QUERY),(0,u.getOrCreatePrefetchCacheEntry)({url:n,nextUrl:e.nextUrl,prefetchCache:e.prefetchCache,kind:t.kind,tree:e.tree,buildId:e.buildId}),e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},9601:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"refreshReducer",{enumerable:!0,get:function(){return h}});let r=n(4848),o=n(3456),u=n(1935),l=n(3237),a=n(5967),i=n(4510),c=n(7420),s=n(2846),f=n(7831),d=n(8077),p=n(232);function h(e,t){let{origin:n}=t,h={},y=e.canonicalUrl,_=e.tree;h.preserveCustomHistoryState=!1;let v=(0,s.createEmptyCacheNode)(),b=(0,d.hasInterceptionRouteInCurrentTree)(e.tree);return v.lazyData=(0,r.fetchServerResponse)(new URL(y,n),[_[0],_[1],_[2],"refetch"],b?e.nextUrl:null,e.buildId),v.lazyData.then(async n=>{let[r,s]=n;if("string"==typeof r)return(0,a.handleExternalUrl)(e,h,r,e.pushRef.pendingPush);for(let n of(v.lazyData=null,r)){if(3!==n.length)return console.log("REFRESH FAILED"),e;let[r]=n,i=(0,u.applyRouterStatePatchToTree)([""],_,r,e.canonicalUrl);if(null===i)return(0,f.handleSegmentMismatch)(e,t,r);if((0,l.isNavigatingToNewRootLayout)(_,i))return(0,a.handleExternalUrl)(e,h,y,e.pushRef.pendingPush);let d=s?(0,o.createHrefFromUrl)(s):void 0;s&&(h.canonicalUrl=d);let[g,m]=n.slice(-2);if(null!==g){let e=g[2];v.rsc=e,v.prefetchRsc=null,(0,c.fillLazyItemsTillLeafWithHead)(v,void 0,r,g,m),h.prefetchCache=new Map}await (0,p.refreshInactiveParallelSegments)({state:e,updatedTree:i,updatedCache:v,includeNextUrl:b,canonicalUrl:h.canonicalUrl||e.canonicalUrl}),h.cache=v,h.patchedTree=i,h.canonicalUrl=y,_=i}return(0,i.handleMutable)(e,h)},()=>e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},7784:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"restoreReducer",{enumerable:!0,get:function(){return u}});let r=n(3456),o=n(5410);function u(e,t){var n;let{url:u,tree:l}=t,a=(0,r.createHrefFromUrl)(u),i=l||e.tree,c=e.cache;return{buildId:e.buildId,canonicalUrl:a,pushRef:{pendingPush:!1,mpaNavigation:!1,preserveCustomHistoryState:!0},focusAndScrollRef:e.focusAndScrollRef,cache:c,prefetchCache:e.prefetchCache,tree:i,nextUrl:null!=(n=(0,o.extractPathFromFlightRouterState)(i))?n:u.pathname}}n(6118),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3722:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"serverActionReducer",{enumerable:!0,get:function(){return m}});let r=n(3079),o=n(6866),u=n(1634),l=n(3456),a=n(5967),i=n(1935),c=n(3237),s=n(4510),f=n(7420),d=n(2846),p=n(8077),h=n(7831),y=n(232),_=n(1311),{createFromFetch:v,encodeReply:b}=n(6671);async function g(e,t,n){let l,{actionId:a,actionArgs:i}=n,c=await b(i),s=await fetch("",{method:"POST",headers:{Accept:o.RSC_CONTENT_TYPE_HEADER,[o.ACTION]:a,[o.NEXT_ROUTER_STATE_TREE]:(0,_.prepareFlightRouterStateForRequest)(e.tree),...t?{[o.NEXT_URL]:t}:{}},body:c}),f=s.headers.get("x-action-redirect");try{let e=JSON.parse(s.headers.get("x-action-revalidated")||"[[],0,0]");l={paths:e[0]||[],tag:!!e[1],cookie:e[2]}}catch(e){l={paths:[],tag:!1,cookie:!1}}let d=f?new URL((0,u.addBasePath)(f),new URL(e.canonicalUrl,window.location.href)):void 0;if(s.headers.get("content-type")===o.RSC_CONTENT_TYPE_HEADER){let e=await v(Promise.resolve(s),{callServer:r.callServer});if(f){let[,t]=null!=e?e:[];return{actionFlightData:t,redirectLocation:d,revalidatedParts:l}}let[t,[,n]]=null!=e?e:[];return{actionResult:t,actionFlightData:n,redirectLocation:d,revalidatedParts:l}}return{redirectLocation:d,revalidatedParts:l}}function m(e,t){let{resolve:n,reject:r}=t,o={},u=e.canonicalUrl,_=e.tree;o.preserveCustomHistoryState=!1;let v=e.nextUrl&&(0,p.hasInterceptionRouteInCurrentTree)(e.tree)?e.nextUrl:null;return o.inFlightServerAction=g(e,v,t),o.inFlightServerAction.then(async r=>{let{actionResult:p,actionFlightData:b,redirectLocation:g}=r;if(g&&(e.pushRef.pendingPush=!0,o.pendingPush=!0),!b)return(n(p),g)?(0,a.handleExternalUrl)(e,o,g.href,e.pushRef.pendingPush):e;if("string"==typeof b)return(0,a.handleExternalUrl)(e,o,b,e.pushRef.pendingPush);if(o.inFlightServerAction=null,g){let e=(0,l.createHrefFromUrl)(g,!1);o.canonicalUrl=e}for(let n of b){if(3!==n.length)return console.log("SERVER ACTION APPLY FAILED"),e;let[r]=n,s=(0,i.applyRouterStatePatchToTree)([""],_,r,g?(0,l.createHrefFromUrl)(g):e.canonicalUrl);if(null===s)return(0,h.handleSegmentMismatch)(e,t,r);if((0,c.isNavigatingToNewRootLayout)(_,s))return(0,a.handleExternalUrl)(e,o,u,e.pushRef.pendingPush);let[p,b]=n.slice(-2),m=null!==p?p[2]:null;if(null!==m){let t=(0,d.createEmptyCacheNode)();t.rsc=m,t.prefetchRsc=null,(0,f.fillLazyItemsTillLeafWithHead)(t,void 0,r,p,b),await (0,y.refreshInactiveParallelSegments)({state:e,updatedTree:s,updatedCache:t,includeNextUrl:!!v,canonicalUrl:o.canonicalUrl||e.canonicalUrl}),o.cache=t,o.prefetchCache=new Map}o.patchedTree=s,_=s}return n(p),(0,s.handleMutable)(e,o)},t=>(r(t),e))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},8448:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"serverPatchReducer",{enumerable:!0,get:function(){return f}});let r=n(3456),o=n(1935),u=n(3237),l=n(5967),a=n(2356),i=n(4510),c=n(2846),s=n(7831);function f(e,t){let{serverResponse:n}=t,[f,d]=n,p={};if(p.preserveCustomHistoryState=!1,"string"==typeof f)return(0,l.handleExternalUrl)(e,p,f,e.pushRef.pendingPush);let h=e.tree,y=e.cache;for(let n of f){let i=n.slice(0,-4),[f]=n.slice(-3,-2),_=(0,o.applyRouterStatePatchToTree)(["",...i],h,f,e.canonicalUrl);if(null===_)return(0,s.handleSegmentMismatch)(e,t,f);if((0,u.isNavigatingToNewRootLayout)(h,_))return(0,l.handleExternalUrl)(e,p,e.canonicalUrl,e.pushRef.pendingPush);let v=d?(0,r.createHrefFromUrl)(d):void 0;v&&(p.canonicalUrl=v);let b=(0,c.createEmptyCacheNode)();(0,a.applyFlightData)(y,b,n),p.patchedTree=_,p.cache=b,y=b,h=_}return(0,i.handleMutable)(e,p)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},232:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{addRefreshMarkerToActiveParallelSegments:function(){return function e(t,n){let[r,o,,l]=t;for(let a in r.includes(u.PAGE_SEGMENT_KEY)&&"refresh"!==l&&(t[2]=n,t[3]="refresh"),o)e(o[a],n)}},refreshInactiveParallelSegments:function(){return l}});let r=n(2356),o=n(4848),u=n(4541);async function l(e){let t=new Set;await a({...e,rootTree:e.updatedTree,fetchedSegments:t})}async function a(e){let{state:t,updatedTree:n,updatedCache:u,includeNextUrl:l,fetchedSegments:i,rootTree:c=n,canonicalUrl:s}=e,[,f,d,p]=n,h=[];if(d&&d!==s&&"refresh"===p&&!i.has(d)){i.add(d);let e=(0,o.fetchServerResponse)(new URL(d,location.origin),[c[0],c[1],c[2],"refetch"],l?t.nextUrl:null,t.buildId).then(e=>{let t=e[0];if("string"!=typeof t)for(let e of t)(0,r.applyFlightData)(u,u,e)});h.push(e)}for(let e in f){let n=a({state:t,updatedTree:f[e],updatedCache:u,includeNextUrl:l,fetchedSegments:i,rootTree:c,canonicalUrl:s});h.push(n)}await Promise.all(h)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4673:function(e,t){"use strict";var n,r,o,u;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ACTION_FAST_REFRESH:function(){return f},ACTION_NAVIGATE:function(){return a},ACTION_PREFETCH:function(){return s},ACTION_REFRESH:function(){return l},ACTION_RESTORE:function(){return i},ACTION_SERVER_ACTION:function(){return d},ACTION_SERVER_PATCH:function(){return c},PrefetchCacheEntryStatus:function(){return r},PrefetchKind:function(){return n},isThenable:function(){return p}});let l="refresh",a="navigate",i="restore",c="server-patch",s="prefetch",f="fast-refresh",d="server-action";function p(e){return e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}(o=n||(n={})).AUTO="auto",o.FULL="full",o.TEMPORARY="temporary",(u=r||(r={})).fresh="fresh",u.reusable="reusable",u.expired="expired",u.stale="stale",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},1450:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"reducer",{enumerable:!0,get:function(){return f}});let r=n(4673),o=n(5967),u=n(8448),l=n(7784),a=n(9601),i=n(4819),c=n(4529),s=n(3722),f="undefined"==typeof window?function(e,t){return e}:function(e,t){switch(t.type){case r.ACTION_NAVIGATE:return(0,o.navigateReducer)(e,t);case r.ACTION_SERVER_PATCH:return(0,u.serverPatchReducer)(e,t);case r.ACTION_RESTORE:return(0,l.restoreReducer)(e,t);case r.ACTION_REFRESH:return(0,a.refreshReducer)(e,t);case r.ACTION_FAST_REFRESH:return(0,c.fastRefreshReducer)(e,t);case r.ACTION_PREFETCH:return(0,i.prefetchReducer)(e,t);case r.ACTION_SERVER_ACTION:return(0,s.serverActionReducer)(e,t);default:throw Error("Unknown action")}};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3728:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"shouldHardNavigate",{enumerable:!0,get:function(){return function e(t,n){let[o,u]=n,[l,a]=t;return(0,r.matchSegment)(l,o)?!(t.length<=2)&&e(t.slice(2),u[a]):!!Array.isArray(l)}}});let r=n(6015);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4535:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{createDynamicallyTrackedSearchParams:function(){return a},createUntrackedSearchParams:function(){return l}});let r=n(1845),o=n(6999),u=n(650);function l(e){let t=r.staticGenerationAsyncStorage.getStore();return t&&t.forceStatic?{}:e}function a(e){let t=r.staticGenerationAsyncStorage.getStore();return t?t.forceStatic?{}:t.isStaticGeneration||t.dynamicShouldError?new Proxy({},{get:(e,n,r)=>("string"==typeof n&&(0,o.trackDynamicDataAccessed)(t,"searchParams."+n),u.ReflectAdapter.get(e,n,r)),has:(e,n)=>("string"==typeof n&&(0,o.trackDynamicDataAccessed)(t,"searchParams."+n),Reflect.has(e,n)),ownKeys:e=>((0,o.trackDynamicDataAccessed)(t,"searchParams"),Reflect.ownKeys(e))}):e:e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},1845:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"staticGenerationAsyncStorage",{enumerable:!0,get:function(){return r.staticGenerationAsyncStorage}});let r=n(30);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6864:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{StaticGenBailoutError:function(){return r},isStaticGenBailoutError:function(){return o}});let n="NEXT_STATIC_GEN_BAILOUT";class r extends Error{constructor(...e){super(...e),this.code=n}}function o(e){return"object"==typeof e&&null!==e&&"code"in e&&e.code===n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},8137:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"unresolvedThenable",{enumerable:!0,get:function(){return n}});let n={then:()=>{}};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},7744:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{useReducerWithReduxDevtools:function(){return i},useUnwrapState:function(){return a}});let r=n(3099)._(n(2265)),o=n(4673),u=n(2103);function l(e){if(e instanceof Map){let t={};for(let[n,r]of e.entries()){if("function"==typeof r){t[n]="fn()";continue}if("object"==typeof r&&null!==r){if(r.$$typeof){t[n]=r.$$typeof.toString();continue}if(r._bundlerConfig){t[n]="FlightData";continue}}t[n]=l(r)}return t}if("object"==typeof e&&null!==e){let t={};for(let n in e){let r=e[n];if("function"==typeof r){t[n]="fn()";continue}if("object"==typeof r&&null!==r){if(r.$$typeof){t[n]=r.$$typeof.toString();continue}if(r.hasOwnProperty("_bundlerConfig")){t[n]="FlightData";continue}}t[n]=l(r)}return t}return Array.isArray(e)?e.map(l):e}function a(e){return(0,o.isThenable)(e)?(0,r.use)(e):e}let i="undefined"!=typeof window?function(e){let[t,n]=r.default.useState(e),o=(0,r.useContext)(u.ActionQueueContext);if(!o)throw Error("Invariant: Missing ActionQueueContext");let a=(0,r.useRef)(),i=(0,r.useRef)();return(0,r.useEffect)(()=>{if(!a.current&&!1!==i.current){if(void 0===i.current&&void 0===window.__REDUX_DEVTOOLS_EXTENSION__){i.current=!1;return}return a.current=window.__REDUX_DEVTOOLS_EXTENSION__.connect({instanceId:8e3,name:"next-router"}),a.current&&(a.current.init(l(e)),o&&(o.devToolsInstance=a.current)),()=>{a.current=void 0}}},[e,o]),[t,(0,r.useCallback)(t=>{o.state||(o.state=e),o.dispatch(t,n)},[o,e]),(0,r.useCallback)(e=>{a.current&&a.current.send({type:"RENDER_SYNC"},l(e))},[])]}:function(e){return[e,()=>{},()=>{}]};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},1311:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"prepareFlightRouterStateForRequest",{enumerable:!0,get:function(){return o}});let r=n(4541);function o(e,t){return t?encodeURIComponent(JSON.stringify(e)):encodeURIComponent(JSON.stringify(function e(t){let[n,o,,u,l]=t,a="string"==typeof n&&n.startsWith(r.PAGE_SEGMENT_KEY+"?")?r.PAGE_SEGMENT_KEY:n,i={};for(let[t,n]of Object.entries(o))i[t]=e(n);let c=[a,i,null,u&&"refresh"!==u?u:null];return void 0!==l&&(c[4]=l),c}(e)))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},1283:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"hasBasePath",{enumerable:!0,get:function(){return o}});let r=n(580);function o(e){return(0,r.pathHasPrefix)(e,"")}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},8521:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"normalizePathTrailingSlash",{enumerable:!0,get:function(){return u}});let r=n(6674),o=n(3381),u=e=>{if(!e.startsWith("/"))return e;let{pathname:t,query:n,hash:u}=(0,o.parsePath)(e);return""+(0,r.removeTrailingSlash)(t)+n+u};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},1404:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return o}});let r=n(8993);function o(e){let t="function"==typeof reportError?reportError:e=>{window.console.error(e)};(0,r.isBailoutToCSRError)(e)||t(e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},5076:function(e,t,n){"use strict";function r(e){return e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"removeBasePath",{enumerable:!0,get:function(){return r}}),n(1283),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},2010:function(e,t){"use strict";function n(e,t){var n=e.length;for(e.push(t);0>>1,o=e[r];if(0>>1;ru(i,n))cu(s,i)?(e[r]=s,e[c]=n,r=c):(e[r]=i,e[a]=n,r=a);else if(cu(s,n))e[r]=s,e[c]=n,r=c;else break}}return t}function u(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var l,a=performance;t.unstable_now=function(){return a.now()}}else{var i=Date,c=i.now();t.unstable_now=function(){return i.now()-c}}var s=[],f=[],d=1,p=null,h=3,y=!1,_=!1,v=!1,b="function"==typeof setTimeout?setTimeout:null,g="function"==typeof clearTimeout?clearTimeout:null,m="undefined"!=typeof setImmediate?setImmediate:null;function R(e){for(var t=r(f);null!==t;){if(null===t.callback)o(f);else if(t.startTime<=e)o(f),t.sortIndex=t.expirationTime,n(s,t);else break;t=r(f)}}function P(e){if(v=!1,R(e),!_){if(null!==r(s))_=!0,C();else{var t=r(f);null!==t&&A(P,t.startTime-e)}}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var j=!1,O=-1,E=5,S=-1;function w(){return!(t.unstable_now()-Se&&w());){var a=p.callback;if("function"==typeof a){p.callback=null,h=p.priorityLevel;var i=a(p.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof i){p.callback=i,R(e),n=!0;break t}p===r(s)&&o(s),R(e)}else o(s);p=r(s)}if(null!==p)n=!0;else{var c=r(f);null!==c&&A(P,c.startTime-e),n=!1}}break e}finally{p=null,h=u,y=!1}n=void 0}}finally{n?l():j=!1}}}if("function"==typeof m)l=function(){m(M)};else if("undefined"!=typeof MessageChannel){var T=new MessageChannel,x=T.port2;T.port1.onmessage=M,l=function(){x.postMessage(null)}}else l=function(){b(M,0)};function C(){j||(j=!0,l())}function A(e,n){O=b(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){_||y||(_=!0,C())},t.unstable_forceFrameRate=function(e){0>e||125l?(e.sortIndex=u,n(f,e),null===r(s)&&e===r(f)&&(v?(g(O),O=-1):v=!0,A(P,u-l))):(e.sortIndex=a,n(s,e),_||y||(_=!0,C())),e},t.unstable_shouldYield=w,t.unstable_wrapCallback=function(e){var t=h;return function(){var n=h;h=t;try{return e.apply(this,arguments)}finally{h=n}}}},1767:function(e,t,n){"use strict";e.exports=n(2010)},934:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{getPathname:function(){return r},isFullStringUrl:function(){return o},parseUrl:function(){return u}});let n="http://n";function r(e){return new URL(e,n).pathname}function o(e){return/https?:\/\//.test(e)}function u(e){let t;try{t=new URL(e,n)}catch{}return t}},6999:function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{Postpone:function(){return d},createPostponedAbortSignal:function(){return b},createPrerenderState:function(){return c},formatDynamicAPIAccesses:function(){return _},markCurrentScopeAsDynamic:function(){return s},trackDynamicDataAccessed:function(){return f},trackDynamicFetch:function(){return p},usedDynamicAPIs:function(){return y}});let o=(r=n(2265))&&r.__esModule?r:{default:r},u=n(6177),l=n(6864),a=n(934),i="function"==typeof o.default.unstable_postpone;function c(e){return{isDebugSkeleton:e,dynamicAccesses:[]}}function s(e,t){let n=(0,a.getPathname)(e.urlPathname);if(!e.isUnstableCacheCallback){if(e.dynamicShouldError)throw new l.StaticGenBailoutError(`Route ${n} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${t}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`);if(e.prerenderState)h(e.prerenderState,t,n);else if(e.revalidate=0,e.isStaticGeneration){let r=new u.DynamicServerError(`Route ${n} couldn't be rendered statically because it used ${t}. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`);throw e.dynamicUsageDescription=t,e.dynamicUsageStack=r.stack,r}}}function f(e,t){let n=(0,a.getPathname)(e.urlPathname);if(e.isUnstableCacheCallback)throw Error(`Route ${n} used "${t}" inside a function cached with "unstable_cache(...)". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use "${t}" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`);if(e.dynamicShouldError)throw new l.StaticGenBailoutError(`Route ${n} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${t}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`);if(e.prerenderState)h(e.prerenderState,t,n);else if(e.revalidate=0,e.isStaticGeneration){let r=new u.DynamicServerError(`Route ${n} couldn't be rendered statically because it used \`${t}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`);throw e.dynamicUsageDescription=t,e.dynamicUsageStack=r.stack,r}}function d({reason:e,prerenderState:t,pathname:n}){h(t,e,n)}function p(e,t){e.prerenderState&&h(e.prerenderState,t,e.urlPathname)}function h(e,t,n){v();let r=`Route ${n} needs to bail out of prerendering at this point because it used ${t}. React throws this special object to indicate where. It should not be caught by your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`;e.dynamicAccesses.push({stack:e.isDebugSkeleton?Error().stack:void 0,expression:t}),o.default.unstable_postpone(r)}function y(e){return e.dynamicAccesses.length>0}function _(e){return e.dynamicAccesses.filter(e=>"string"==typeof e.stack&&e.stack.length>0).map(({expression:e,stack:t})=>(t=t.split("\n").slice(4).filter(e=>!(e.includes("node_modules/next/")||e.includes(" ()")||e.includes(" (node:"))).join("\n"),`Dynamic API Usage Debug - ${e}: -${t}`))}function v(){if(!i)throw Error("Invariant: React.unstable_postpone is not defined. This suggests the wrong version of React was loaded. This is a bug in Next.js")}function b(e){v();let t=new AbortController;try{o.default.unstable_postpone(e)}catch(e){t.abort(e)}return t.signal}},7417:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getSegmentParam",{enumerable:!0,get:function(){return o}});let r=n(1182);function o(e){let t=r.INTERCEPTION_ROUTE_MARKERS.find(t=>e.startsWith(t));return(t&&(e=e.slice(t.length)),e.startsWith("[[...")&&e.endsWith("]]"))?{type:"optional-catchall",param:e.slice(5,-2)}:e.startsWith("[...")&&e.endsWith("]")?{type:t?"catchall-intercepted":"catchall",param:e.slice(4,-1)}:e.startsWith("[")&&e.endsWith("]")?{type:t?"dynamic-intercepted":"dynamic",param:e.slice(1,-1)}:null}},647:function(e,t){"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HMR_ACTIONS_SENT_TO_BROWSER",{enumerable:!0,get:function(){return n}}),(r=n||(n={})).ADDED_PAGE="addedPage",r.REMOVED_PAGE="removedPage",r.RELOAD_PAGE="reloadPage",r.SERVER_COMPONENT_CHANGES="serverComponentChanges",r.MIDDLEWARE_CHANGES="middlewareChanges",r.CLIENT_CHANGES="clientChanges",r.SERVER_ONLY_CHANGES="serverOnlyChanges",r.SYNC="sync",r.BUILT="built",r.BUILDING="building",r.DEV_PAGES_MANIFEST_UPDATE="devPagesManifestUpdate",r.TURBOPACK_MESSAGE="turbopack-message",r.SERVER_ERROR="serverError",r.TURBOPACK_CONNECTED="turbopack-connected"},1182:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{INTERCEPTION_ROUTE_MARKERS:function(){return o},extractInterceptionRouteInformation:function(){return l},isInterceptionRouteAppPath:function(){return u}});let r=n(926),o=["(..)(..)","(.)","(..)","(...)"];function u(e){return void 0!==e.split("/").find(e=>o.find(t=>e.startsWith(t)))}function l(e){let t,n,u;for(let r of e.split("/"))if(n=o.find(e=>r.startsWith(e))){[t,u]=e.split(n,2);break}if(!t||!n||!u)throw Error(`Invalid interception route: ${e}. Must be in the format //(..|...|..)(..)/`);switch(t=(0,r.normalizeAppPath)(t),n){case"(.)":u="/"===t?`/${u}`:t+"/"+u;break;case"(..)":if("/"===t)throw Error(`Invalid interception route: ${e}. Cannot use (..) marker at the root level, use (.) instead.`);u=t.split("/").slice(0,-1).concat(u).join("/");break;case"(...)":u="/"+u;break;case"(..)(..)":let l=t.split("/");if(l.length<=2)throw Error(`Invalid interception route: ${e}. Cannot use (..)(..) marker at the root level or one level up.`);u=l.slice(0,-2).concat(u).join("/");break;default:throw Error("Invariant: unexpected marker")}return{interceptingRoute:t,interceptedRoute:u}}},650:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ReflectAdapter",{enumerable:!0,get:function(){return n}});class n{static get(e,t,n){let r=Reflect.get(e,t,n);return"function"==typeof r?r.bind(e):r}static set(e,t,n,r){return Reflect.set(e,t,n,r)}static has(e,t){return Reflect.has(e,t)}static deleteProperty(e,t){return Reflect.deleteProperty(e,t)}}},1956:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{AppRouterContext:function(){return o},GlobalLayoutRouterContext:function(){return l},LayoutRouterContext:function(){return u},MissingSlotContext:function(){return i},TemplateContext:function(){return a}});let r=n(7043)._(n(2265)),o=r.default.createContext(null),u=r.default.createContext(null),l=r.default.createContext(null),a=r.default.createContext(null),i=r.default.createContext(new Set)},7207:function(e,t){"use strict";function n(e){let t=5381;for(let n=0;n>>0}function r(e){return n(e).toString(36).slice(0,5)}Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{djb2Hash:function(){return n},hexHash:function(){return r}})},8701:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HeadManagerContext",{enumerable:!0,get:function(){return r}});let r=n(7043)._(n(2265)).default.createContext({})},9060:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{PathParamsContext:function(){return l},PathnameContext:function(){return u},SearchParamsContext:function(){return o}});let r=n(2265),o=(0,r.createContext)(null),u=(0,r.createContext)(null),l=(0,r.createContext)(null)},8993:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{BailoutToCSRError:function(){return r},isBailoutToCSRError:function(){return o}});let n="BAILOUT_TO_CLIENT_SIDE_RENDERING";class r extends Error{constructor(e){super("Bail out to client-side rendering: "+e),this.reason=e,this.digest=n}}function o(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===n}},8162:function(e,t){"use strict";function n(e){return e.startsWith("/")?e:"/"+e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ensureLeadingSlash",{enumerable:!0,get:function(){return n}})},2103:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ActionQueueContext:function(){return a},createMutableActionQueue:function(){return s}});let r=n(3099),o=n(4673),u=n(1450),l=r._(n(2265)),a=l.default.createContext(null);function i(e,t){null!==e.pending&&(e.pending=e.pending.next,null!==e.pending?c({actionQueue:e,action:e.pending,setState:t}):e.needsRefresh&&(e.needsRefresh=!1,e.dispatch({type:o.ACTION_REFRESH,origin:window.location.origin},t)))}async function c(e){let{actionQueue:t,action:n,setState:r}=e,u=t.state;if(!u)throw Error("Invariant: Router state not initialized");t.pending=n;let l=n.payload,a=t.action(u,l);function c(e){n.discarded||(t.state=e,t.devToolsInstance&&t.devToolsInstance.send(l,e),i(t,r),n.resolve(e))}(0,o.isThenable)(a)?a.then(c,e=>{i(t,r),n.reject(e)}):c(a)}function s(){let e={state:null,dispatch:(t,n)=>(function(e,t,n){let r={resolve:n,reject:()=>{}};if(t.type!==o.ACTION_RESTORE){let e=new Promise((e,t)=>{r={resolve:e,reject:t}});(0,l.startTransition)(()=>{n(e)})}let u={payload:t,next:null,resolve:r.resolve,reject:r.reject};null===e.pending?(e.last=u,c({actionQueue:e,action:u,setState:n})):t.type===o.ACTION_NAVIGATE||t.type===o.ACTION_RESTORE?(e.pending.discarded=!0,e.last=u,e.pending.payload.type===o.ACTION_SERVER_ACTION&&(e.needsRefresh=!0),c({actionQueue:e,action:u,setState:n})):(null!==e.last&&(e.last.next=u),e.last=u)})(e,t,n),action:async(e,t)=>{if(null===e)throw Error("Invariant: Router state not initialized");return(0,u.reducer)(e,t)},pending:null,last:null};return e}},8498:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addPathPrefix",{enumerable:!0,get:function(){return o}});let r=n(3381);function o(e,t){if(!e.startsWith("/")||!t)return e;let{pathname:n,query:o,hash:u}=(0,r.parsePath)(e);return""+t+n+o+u}},926:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{normalizeAppPath:function(){return u},normalizeRscURL:function(){return l}});let r=n(8162),o=n(4541);function u(e){return(0,r.ensureLeadingSlash)(e.split("/").reduce((e,t,n,r)=>!t||(0,o.isGroupSegment)(t)||"@"===t[0]||("page"===t||"route"===t)&&n===r.length-1?e:e+"/"+t,""))}function l(e){return e.replace(/\.rsc($|\?)/,"$1")}},7092:function(e,t){"use strict";function n(e,t){if(void 0===t&&(t={}),t.onlyHashChange){e();return}let n=document.documentElement,r=n.style.scrollBehavior;n.style.scrollBehavior="auto",t.dontForceLayout||n.getClientRects(),e(),n.style.scrollBehavior=r}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"handleSmoothScroll",{enumerable:!0,get:function(){return n}})},6146:function(e,t){"use strict";function n(e){return/Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver/i.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isBot",{enumerable:!0,get:function(){return n}})},3381:function(e,t){"use strict";function n(e){let t=e.indexOf("#"),n=e.indexOf("?"),r=n>-1&&(t<0||n-1?{pathname:e.substring(0,r?n:t),query:r?e.substring(n,t>-1?t:void 0):"",hash:t>-1?e.slice(t):""}:{pathname:e,query:"",hash:""}}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"parsePath",{enumerable:!0,get:function(){return n}})},580:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"pathHasPrefix",{enumerable:!0,get:function(){return o}});let r=n(3381);function o(e,t){if("string"!=typeof e)return!1;let{pathname:n}=(0,r.parsePath)(e);return n===t||n.startsWith(t+"/")}},6674:function(e,t){"use strict";function n(e){return e.replace(/\/$/,"")||"/"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"removeTrailingSlash",{enumerable:!0,get:function(){return n}})},4541:function(e,t){"use strict";function n(e){return"("===e[0]&&e.endsWith(")")}Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{DEFAULT_SEGMENT_KEY:function(){return o},PAGE_SEGMENT_KEY:function(){return r},isGroupSegment:function(){return n}});let r="__PAGE__",o="__DEFAULT__"},5501:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ServerInsertedHTMLContext:function(){return o},useServerInsertedHTML:function(){return u}});let r=n(3099)._(n(2265)),o=r.default.createContext(null);function u(e){let t=(0,r.useContext)(o);t&&t(e)}},1765:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"warnOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},7149:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"actionAsyncStorage",{enumerable:!0,get:function(){return r}});let r=(0,n(4832).createAsyncLocalStorage)();("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4832:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createAsyncLocalStorage",{enumerable:!0,get:function(){return u}});let n=Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");class r{disable(){throw n}getStore(){}run(){throw n}exit(){throw n}enterWith(){throw n}}let o=globalThis.AsyncLocalStorage;function u(){return o?new o:new r}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},9134:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"requestAsyncStorage",{enumerable:!0,get:function(){return r}});let r=(0,n(4832).createAsyncLocalStorage)();("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},30:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"staticGenerationAsyncStorage",{enumerable:!0,get:function(){return r}});let r=(0,n(4832).createAsyncLocalStorage)();("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4040:function(e,t,n){"use strict";var r=n(4887);t.createRoot=r.createRoot,t.hydrateRoot=r.hydrateRoot},4887:function(e,t,n){"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=n(4417)},7950:function(e,t,n){"use strict";var r=n(4887),o={stream:!0},u=Object.prototype.hasOwnProperty,l=new Map;function a(e){var t=n(e);return"function"!=typeof t.then||"fulfilled"===t.status?null:(t.then(function(e){t.status="fulfilled",t.value=e},function(e){t.status="rejected",t.reason=e}),t)}function i(){}var c=new Map,s=n.u;n.u=function(e){var t=c.get(e);return void 0!==t?t:s(e)};var f=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Dispatcher,d=Symbol.for("react.element"),p=Symbol.for("react.lazy"),h=Symbol.iterator,y=Array.isArray,_=Object.getPrototypeOf,v=Object.prototype,b=new WeakMap;function g(e,t,n,r){this.status=e,this.value=t,this.reason=n,this._response=r}function m(e){switch(e.status){case"resolved_model":w(e);break;case"resolved_module":M(e)}switch(e.status){case"fulfilled":return e.value;case"pending":case"blocked":case"cyclic":throw e;default:throw e.reason}}function R(e,t){for(var n=0;nh?(_=h,h=3,p++):(_=0,h=3);continue;case 2:44===(m=d[p++])?h=4:v=v<<4|(96d.length&&(m=-1)}var R=d.byteOffset+p;if(-1e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let u=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:i=24,strokeWidth:u=2,absoluteStrokeWidth:c,className:l="",children:a,iconNode:h,...d}=e;return(0,r.createElement)("svg",{ref:t,...o,width:i,height:i,stroke:n,strokeWidth:c?24*Number(u)/Number(i):u,className:s("lucide",l),...d},[...h.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(a)?a:[a]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,o)=>{let{className:c,...l}=n;return(0,r.createElement)(u,{ref:o,iconNode:t,className:s("lucide-".concat(i(e)),c),...l})});return n.displayName="".concat(e),n}},4001:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},3229:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},257:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4601:function(){},4227:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function s(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}function u(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var c=[],l=!1,a=-1;function h(){l&&r&&(l=!1,r.length?c=r.concat(c):a=-1,c.length&&d())}function d(){if(!l){var e=u(h);l=!0;for(var t=c.length;t;){for(r=c,c=[];++a1)for(var n=1;n>>0},h={};function d(e,t){if(!t)return"jsx-"+e;var n=String(t),r=e+n;return h[r]||(h[r]="jsx-"+a(e+"-"+n)),h[r]}function f(e,t){"undefined"==typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var n=e+t;return h[n]||(h[n]=t.replace(/__jsx-style-dynamic-selector/g,e)),h[n]}var p=function(){function e(e){var t=void 0===e?{}:e,n=t.styleSheet,r=void 0===n?null:n,i=t.optimizeForSpeed,s=void 0!==i&&i;this._sheet=r||new c({name:"styled-jsx",optimizeForSpeed:s}),this._sheet.inject(),r&&"boolean"==typeof s&&(this._sheet.setOptimizeForSpeed(s),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"undefined"==typeof window||this._fromServer||(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var n=this.getIdAndRules(e),r=n.styleId,i=n.rules;if(r in this._instancesCounts){this._instancesCounts[r]+=1;return}var s=i.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[r]=s,this._instancesCounts[r]=1},t.remove=function(e){var t=this,n=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(n in this._instancesCounts,"styleId: `"+n+"` not found"),this._instancesCounts[n]-=1,this._instancesCounts[n]<1){var r=this._fromServer&&this._fromServer[n];r?(r.parentNode.removeChild(r),delete this._fromServer[n]):(this._indices[n].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[n]),delete this._instancesCounts[n]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],n=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return n[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,n;return t=this.cssRules(),void 0===(n=e)&&(n={}),t.map(function(e){var t=e[0],r=e[1];return s.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:n.nonce?n.nonce:void 0,dangerouslySetInnerHTML:{__html:r}})})},t.getIdAndRules=function(e){var t=e.children,n=e.dynamic,r=e.id;if(n){var i=d(r,n);return{styleId:i,rules:Array.isArray(t)?t.map(function(e){return f(i,e)}):[f(i,t)]}}return{styleId:d(r),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),m=i.createContext(null);m.displayName="StyleSheetContext";var y=s.default.useInsertionEffect||s.default.useLayoutEffect,v="undefined"!=typeof window?new p:void 0;function _(e){var t=v||i.useContext(m);return t&&("undefined"==typeof window?t.add(e):y(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}_.dynamic=function(e){return e.map(function(e){return d(e[0],e[1])}).join(" ")},t.style=_},29:function(e,t,n){"use strict";e.exports=n(8975).style}}]); \ No newline at end of file diff --git a/static/_next/static/chunks/5029-407359e83cfd8fd3.js b/static/_next/static/chunks/5029-407359e83cfd8fd3.js deleted file mode 100644 index d4837235a01b0a3a2199624fe96aae0c2da53873..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/5029-407359e83cfd8fd3.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5029],{9205:function(t,e,n){"use strict";n.d(e,{Z:function(){return o}});var r=n(2265);let i=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var t=arguments.length,e=Array(t),n=0;n!!t&&n.indexOf(t)===e).join(" ")};var u={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((t,e)=>{let{color:n="currentColor",size:i=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:l="",children:s,iconNode:f,...h}=t;return(0,r.createElement)("svg",{ref:e,...u,width:i,height:i,stroke:n,strokeWidth:o?24*Number(c)/Number(i):c,className:a("lucide",l),...h},[...f.map(t=>{let[e,n]=t;return(0,r.createElement)(e,n)}),...Array.isArray(s)?s:[s]])}),o=(t,e)=>{let n=(0,r.forwardRef)((n,u)=>{let{className:o,...l}=n;return(0,r.createElement)(c,{ref:u,iconNode:e,className:a("lucide-".concat(i(t)),o),...l})});return n.displayName="".concat(t),n}},4401:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},875:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},2135:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},9322:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},1723:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},5252:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]])},5621:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])},3417:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},730:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]])},8662:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]])},7133:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]])},3041:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]])},7168:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},4743:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},8728:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},8930:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},1706:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]])},5395:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},2926:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]])},2489:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});let r=(0,n(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},257:function(t,e,n){"use strict";var r,i;t.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(t){!function(){var e={229:function(t){var e,n,r,i=t.exports={};function a(){throw Error("setTimeout has not been defined")}function u(){throw Error("clearTimeout has not been defined")}function c(t){if(e===setTimeout)return setTimeout(t,0);if((e===a||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:a}catch(t){e=a}try{n="function"==typeof clearTimeout?clearTimeout:u}catch(t){n=u}}();var o=[],l=!1,s=-1;function f(){l&&r&&(l=!1,r.length?o=r.concat(o):s=-1,o.length&&h())}function h(){if(!l){var t=c(f);l=!0;for(var e=o.length;e;){for(r=o,o=[];++s1)for(var n=1;ne.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let u=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:o=24,strokeWidth:u=2,absoluteStrokeWidth:s,className:c="",children:l,iconNode:f,...d}=e;return(0,r.createElement)("svg",{ref:t,...i,width:o,height:o,stroke:n,strokeWidth:s?24*Number(u)/Number(o):u,className:a("lucide",c),...d},[...f.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(l)?l:[l]])}),s=(e,t)=>{let n=(0,r.forwardRef)((n,i)=>{let{className:s,...c}=n;return(0,r.createElement)(u,{ref:i,iconNode:t,className:a("lucide-".concat(o(e)),s),...c})});return n.displayName="".concat(e),n}},4401:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},8428:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]])},1769:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])},1178:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]])},2222:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])},4972:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]])},6215:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]])},2451:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]])},1723:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},91:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},5252:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]])},2735:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},8736:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},8220:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]])},3781:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]])},6272:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]])},9659:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("HeartPulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]])},8997:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]])},4001:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},8124:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]])},5466:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]])},7692:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]])},3417:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},8662:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]])},3073:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Puzzle",[["path",{d:"M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z",key:"i0oyt7"}]])},8406:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]])},6137:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},8728:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},8906:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},2023:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]])},221:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]])},7829:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("TestTube",[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]])},6865:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},3628:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]])},1239:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},7648:function(e,t,n){"use strict";n.d(t,{default:function(){return o.a}});var r=n(2972),o=n.n(r)},9376:function(e,t,n){"use strict";var r=n(5475);n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},257:function(e,t,n){"use strict";var r,o;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(o=n.g.process)?void 0:o.env)?n.g.process:n(4227)},5449:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addLocale",{enumerable:!0,get:function(){return r}}),n(8521);let r=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;ra?e.prefetch(t,o):e.prefetch(t,n,r))().catch(e=>{})}}function E(e){return"string"==typeof e?e:(0,s.formatUrl)(e)}let R=a.default.forwardRef(function(e,t){let n,r;let{href:s,as:g,children:R,prefetch:v=null,passHref:k,replace:b,shallow:x,scroll:P,locale:S,onClick:A,onMouseEnter:M,onTouchStart:T,legacyBehavior:O=!1,...N}=e;n=R,O&&("string"==typeof n||"number"==typeof n)&&(n=(0,o.jsx)("a",{children:n}));let w=a.default.useContext(f.RouterContext),I=a.default.useContext(d.AppRouterContext),C=null!=w?w:I,j=!w,L=!1!==v,Z=null===v?m.PrefetchKind.AUTO:m.PrefetchKind.FULL,{href:D,as:U}=a.default.useMemo(()=>{if(!w){let e=E(s);return{href:e,as:g?E(g):e}}let[e,t]=(0,i.resolveHref)(w,s,!0);return{href:e,as:g?(0,i.resolveHref)(w,g):t||e}},[w,s,g]),H=a.default.useRef(D),z=a.default.useRef(U);O&&(r=a.default.Children.only(n));let q=O?r&&"object"==typeof r&&r.ref:t,[F,V,X]=(0,p.useIntersection)({rootMargin:"200px"}),W=a.default.useCallback(e=>{(z.current!==U||H.current!==D)&&(X(),z.current=U,H.current=D),F(e),q&&("function"==typeof q?q(e):"object"==typeof q&&(q.current=e))},[U,q,D,X,F]);a.default.useEffect(()=>{C&&V&&L&&_(C,D,U,{locale:S},{kind:Z},j)},[U,D,V,S,L,null==w?void 0:w.locale,C,j,Z]);let G={ref:W,onClick(e){O||"function"!=typeof A||A(e),O&&r.props&&"function"==typeof r.props.onClick&&r.props.onClick(e),C&&!e.defaultPrevented&&function(e,t,n,r,o,i,s,c,l){let{nodeName:f}=e.currentTarget;if("A"===f.toUpperCase()&&(function(e){let t=e.currentTarget.getAttribute("target");return t&&"_self"!==t||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which}(e)||!l&&!(0,u.isLocalURL)(n)))return;e.preventDefault();let d=()=>{let e=null==s||s;"beforePopState"in t?t[o?"replace":"push"](n,r,{shallow:i,locale:c,scroll:e}):t[o?"replace":"push"](r||n,{scroll:e})};l?a.default.startTransition(d):d()}(e,C,D,U,b,x,P,S,j)},onMouseEnter(e){O||"function"!=typeof M||M(e),O&&r.props&&"function"==typeof r.props.onMouseEnter&&r.props.onMouseEnter(e),C&&(L||!j)&&_(C,D,U,{locale:S,priority:!0,bypassPrefetchedCheck:!0},{kind:Z},j)},onTouchStart:function(e){O||"function"!=typeof T||T(e),O&&r.props&&"function"==typeof r.props.onTouchStart&&r.props.onTouchStart(e),C&&(L||!j)&&_(C,D,U,{locale:S,priority:!0,bypassPrefetchedCheck:!0},{kind:Z},j)}};if((0,c.isAbsoluteUrl)(U))G.href=U;else if(!O||k||"a"===r.type&&!("href"in r.props)){let e=void 0!==S?S:null==w?void 0:w.locale,t=(null==w?void 0:w.isLocaleDomain)&&(0,h.getDomainLocale)(U,e,null==w?void 0:w.locales,null==w?void 0:w.domainLocales);G.href=t||(0,y.addBasePath)((0,l.addLocale)(U,e,null==w?void 0:w.defaultLocale))}return O?a.default.cloneElement(r,G):(0,o.jsx)("a",{...N,...G,children:n})});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3515:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{cancelIdleCallback:function(){return r},requestIdleCallback:function(){return n}});let n="undefined"!=typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(window)||function(e){let t=Date.now();return self.setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})},1)},r="undefined"!=typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(window)||function(e){return clearTimeout(e)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},5246:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"resolveHref",{enumerable:!0,get:function(){return f}});let r=n(8637),o=n(7497),a=n(7053),i=n(3987),u=n(8521),s=n(3552),c=n(6279),l=n(7205);function f(e,t,n){let f;let d="string"==typeof t?t:(0,o.formatWithValidation)(t),p=d.match(/^[a-zA-Z]{1,}:\/\//),h=p?d.slice(p[0].length):d;if((h.split("?",1)[0]||"").match(/(\/\/|\\)/)){console.error("Invalid href '"+d+"' passed to next/router in page: '"+e.pathname+"'. Repeated forward-slashes (//) or backslashes \\ are not valid in the href.");let t=(0,i.normalizeRepeatedSlashes)(h);d=(p?p[0]:"")+t}if(!(0,s.isLocalURL)(d))return n?[d]:d;try{f=new URL(d.startsWith("#")?e.asPath:e.pathname,"http://n")}catch(e){f=new URL("/","http://n")}try{let e=new URL(d,f);e.pathname=(0,u.normalizePathTrailingSlash)(e.pathname);let t="";if((0,c.isDynamicRoute)(e.pathname)&&e.searchParams&&n){let n=(0,r.searchParamsToUrlQuery)(e.searchParams),{result:i,params:u}=(0,l.interpolateAs)(e.pathname,e.pathname,n);i&&(t=(0,o.formatWithValidation)({pathname:i,hash:e.hash,query:(0,a.omit)(n,u)}))}let i=e.origin===f.origin?e.href.slice(e.origin.length):e.href;return n?[i,t||i]:i}catch(e){return n?[d]:d}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6081:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useIntersection",{enumerable:!0,get:function(){return s}});let r=n(2265),o=n(3515),a="function"==typeof IntersectionObserver,i=new Map,u=[];function s(e){let{rootRef:t,rootMargin:n,disabled:s}=e,c=s||!a,[l,f]=(0,r.useState)(!1),d=(0,r.useRef)(null),p=(0,r.useCallback)(e=>{d.current=e},[]);return(0,r.useEffect)(()=>{if(a){if(c||l)return;let e=d.current;if(e&&e.tagName)return function(e,t,n){let{id:r,observer:o,elements:a}=function(e){let t;let n={root:e.root||null,margin:e.rootMargin||""},r=u.find(e=>e.root===n.root&&e.margin===n.margin);if(r&&(t=i.get(r)))return t;let o=new Map;return t={id:n,observer:new IntersectionObserver(e=>{e.forEach(e=>{let t=o.get(e.target),n=e.isIntersecting||e.intersectionRatio>0;t&&n&&t(n)})},e),elements:o},u.push(n),i.set(n,t),t}(n);return a.set(e,t),o.observe(e),function(){if(a.delete(e),o.unobserve(e),0===a.size){o.disconnect(),i.delete(r);let e=u.findIndex(e=>e.root===r.root&&e.margin===r.margin);e>-1&&u.splice(e,1)}}}(e,e=>e&&f(e),{root:null==t?void 0:t.current,rootMargin:n})}else if(!l){let e=(0,o.requestIdleCallback)(()=>f(!0));return()=>(0,o.cancelIdleCallback)(e)}},[c,n,t,l,d.current]),[p,l,(0,r.useCallback)(()=>{f(!1)},[])]}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4227:function(e){!function(){var t={229:function(e){var t,n,r,o=e.exports={};function a(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function u(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var s=[],c=!1,l=-1;function f(){c&&r&&(c=!1,r.length?s=r.concat(s):l=-1,s.length&&d())}function d(){if(!c){var e=u(f);c=!0;for(var t=s.length;t;){for(r=s,s=[];++l1)for(var n=1;n{let t=s[e]||"",{repeat:n,optional:r}=u[e],o="["+(n?"...":"")+e+"]";return r&&(o=(t?"":"/")+"["+o+"]"),n&&!Array.isArray(t)&&(t=[t]),(r||e in s)&&(a=a.replace(o,n?t.map(e=>encodeURIComponent(e)).join("/"):encodeURIComponent(t))||"/")})||(a=""),{params:c,result:a}}},8104:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isDynamicRoute",{enumerable:!0,get:function(){return a}});let r=n(1182),o=/\/\[[^/]+?\](?=\/|$)/;function a(e){return(0,r.isInterceptionRouteAppPath)(e)&&(e=(0,r.extractInterceptionRouteInformation)(e).interceptedRoute),o.test(e)}},3552:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isLocalURL",{enumerable:!0,get:function(){return a}});let r=n(3987),o=n(1283);function a(e){if(!(0,r.isAbsoluteUrl)(e))return!0;try{let t=(0,r.getLocationOrigin)(),n=new URL(e,t);return n.origin===t&&(0,o.hasBasePath)(n.pathname)}catch(e){return!1}}},7053:function(e,t){"use strict";function n(e,t){let n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"omit",{enumerable:!0,get:function(){return n}})},8637:function(e,t){"use strict";function n(e){let t={};return e.forEach((e,n)=>{void 0===t[n]?t[n]=e:Array.isArray(t[n])?t[n].push(e):t[n]=[t[n],e]}),t}function r(e){return"string"!=typeof e&&("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function o(e){let t=new URLSearchParams;return Object.entries(e).forEach(e=>{let[n,o]=e;Array.isArray(o)?o.forEach(e=>t.append(n,r(e))):t.set(n,r(o))}),t}function a(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r{Array.from(t.keys()).forEach(t=>e.delete(t)),t.forEach((t,n)=>e.append(n,t))}),e}Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{assign:function(){return a},searchParamsToUrlQuery:function(){return n},urlQueryToSearchParams:function(){return o}})},4199:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getRouteMatcher",{enumerable:!0,get:function(){return o}});let r=n(3987);function o(e){let{re:t,groups:n}=e;return e=>{let o=t.exec(e);if(!o)return!1;let a=e=>{try{return decodeURIComponent(e)}catch(e){throw new r.DecodeError("failed to decode param")}},i={};return Object.keys(n).forEach(e=>{let t=n[e],r=o[t.pos];void 0!==r&&(i[e]=~r.indexOf("/")?r.split("/").map(e=>a(e)):t.repeat?[a(r)]:a(r))}),i}}},9964:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{getNamedMiddlewareRegex:function(){return p},getNamedRouteRegex:function(){return d},getRouteRegex:function(){return c},parseParameter:function(){return u}});let r=n(9259),o=n(1182),a=n(42),i=n(6674);function u(e){let t=e.startsWith("[")&&e.endsWith("]");t&&(e=e.slice(1,-1));let n=e.startsWith("...");return n&&(e=e.slice(3)),{key:e,repeat:n,optional:t}}function s(e){let t=(0,i.removeTrailingSlash)(e).slice(1).split("/"),n={},r=1;return{parameterizedRoute:t.map(e=>{let t=o.INTERCEPTION_ROUTE_MARKERS.find(t=>e.startsWith(t)),i=e.match(/\[((?:\[.*\])|.+)\]/);if(t&&i){let{key:e,optional:o,repeat:s}=u(i[1]);return n[e]={pos:r++,repeat:s,optional:o},"/"+(0,a.escapeStringRegexp)(t)+"([^/]+?)"}if(!i)return"/"+(0,a.escapeStringRegexp)(e);{let{key:e,repeat:t,optional:o}=u(i[1]);return n[e]={pos:r++,repeat:t,optional:o},t?o?"(?:/(.+?))?":"/(.+?)":"/([^/]+?)"}}).join(""),groups:n}}function c(e){let{parameterizedRoute:t,groups:n}=s(e);return{re:RegExp("^"+t+"(?:/)?$"),groups:n}}function l(e){let{interceptionMarker:t,getSafeRouteKey:n,segment:r,routeKeys:o,keyPrefix:i}=e,{key:s,optional:c,repeat:l}=u(r),f=s.replace(/\W/g,"");i&&(f=""+i+f);let d=!1;(0===f.length||f.length>30)&&(d=!0),isNaN(parseInt(f.slice(0,1)))||(d=!0),d&&(f=n()),i?o[f]=""+i+s:o[f]=s;let p=t?(0,a.escapeStringRegexp)(t):"";return l?c?"(?:/"+p+"(?<"+f+">.+?))?":"/"+p+"(?<"+f+">.+?)":"/"+p+"(?<"+f+">[^/]+?)"}function f(e,t){let n;let u=(0,i.removeTrailingSlash)(e).slice(1).split("/"),s=(n=0,()=>{let e="",t=++n;for(;t>0;)e+=String.fromCharCode(97+(t-1)%26),t=Math.floor((t-1)/26);return e}),c={};return{namedParameterizedRoute:u.map(e=>{let n=o.INTERCEPTION_ROUTE_MARKERS.some(t=>e.startsWith(t)),i=e.match(/\[((?:\[.*\])|.+)\]/);if(n&&i){let[n]=e.split(i[0]);return l({getSafeRouteKey:s,interceptionMarker:n,segment:i[1],routeKeys:c,keyPrefix:t?r.NEXT_INTERCEPTION_MARKER_PREFIX:void 0})}return i?l({getSafeRouteKey:s,segment:i[1],routeKeys:c,keyPrefix:t?r.NEXT_QUERY_PARAM_PREFIX:void 0}):"/"+(0,a.escapeStringRegexp)(e)}).join(""),routeKeys:c}}function d(e,t){let n=f(e,t);return{...c(e),namedRegex:"^"+n.namedParameterizedRoute+"(?:/)?$",routeKeys:n.routeKeys}}function p(e,t){let{parameterizedRoute:n}=s(e),{catchAll:r=!0}=t;if("/"===n)return{namedRegex:"^/"+(r?".*":"")+"$"};let{namedParameterizedRoute:o}=f(e,!1);return{namedRegex:"^"+o+(r?"(?:(/.*)?)":"")+"$"}}},4777:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getSortedRoutes",{enumerable:!0,get:function(){return r}});class n{insert(e){this._insert(e.split("/").filter(Boolean),[],!1)}smoosh(){return this._smoosh()}_smoosh(e){void 0===e&&(e="/");let t=[...this.children.keys()].sort();null!==this.slugName&&t.splice(t.indexOf("[]"),1),null!==this.restSlugName&&t.splice(t.indexOf("[...]"),1),null!==this.optionalRestSlugName&&t.splice(t.indexOf("[[...]]"),1);let n=t.map(t=>this.children.get(t)._smoosh(""+e+t+"/")).reduce((e,t)=>[...e,...t],[]);if(null!==this.slugName&&n.push(...this.children.get("[]")._smoosh(e+"["+this.slugName+"]/")),!this.placeholder){let t="/"===e?"/":e.slice(0,-1);if(null!=this.optionalRestSlugName)throw Error('You cannot define a route with the same specificity as a optional catch-all route ("'+t+'" and "'+t+"[[..."+this.optionalRestSlugName+']]").');n.unshift(t)}return null!==this.restSlugName&&n.push(...this.children.get("[...]")._smoosh(e+"[..."+this.restSlugName+"]/")),null!==this.optionalRestSlugName&&n.push(...this.children.get("[[...]]")._smoosh(e+"[[..."+this.optionalRestSlugName+"]]/")),n}_insert(e,t,r){if(0===e.length){this.placeholder=!1;return}if(r)throw Error("Catch-all must be the last part of the URL.");let o=e[0];if(o.startsWith("[")&&o.endsWith("]")){let n=o.slice(1,-1),i=!1;if(n.startsWith("[")&&n.endsWith("]")&&(n=n.slice(1,-1),i=!0),n.startsWith("...")&&(n=n.substring(3),r=!0),n.startsWith("[")||n.endsWith("]"))throw Error("Segment names may not start or end with extra brackets ('"+n+"').");if(n.startsWith("."))throw Error("Segment names may not start with erroneous periods ('"+n+"').");function a(e,n){if(null!==e&&e!==n)throw Error("You cannot use different slug names for the same dynamic path ('"+e+"' !== '"+n+"').");t.forEach(e=>{if(e===n)throw Error('You cannot have the same slug name "'+n+'" repeat within a single dynamic path');if(e.replace(/\W/g,"")===o.replace(/\W/g,""))throw Error('You cannot have the slug names "'+e+'" and "'+n+'" differ only by non-word symbols within a single dynamic path')}),t.push(n)}if(r){if(i){if(null!=this.restSlugName)throw Error('You cannot use both an required and optional catch-all route at the same level ("[...'+this.restSlugName+']" and "'+e[0]+'" ).');a(this.optionalRestSlugName,n),this.optionalRestSlugName=n,o="[[...]]"}else{if(null!=this.optionalRestSlugName)throw Error('You cannot use both an optional and required catch-all route at the same level ("[[...'+this.optionalRestSlugName+']]" and "'+e[0]+'").');a(this.restSlugName,n),this.restSlugName=n,o="[...]"}}else{if(i)throw Error('Optional route parameters are not yet supported ("'+e[0]+'").');a(this.slugName,n),this.slugName=n,o="[]"}}this.children.has(o)||this.children.set(o,new n),this.children.get(o)._insert(e.slice(1),t,r)}constructor(){this.placeholder=!0,this.children=new Map,this.slugName=null,this.restSlugName=null,this.optionalRestSlugName=null}}function r(e){let t=new n;return e.forEach(e=>t.insert(e)),t.smoosh()}},3987:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{DecodeError:function(){return h},MiddlewareNotFoundError:function(){return _},MissingStaticPage:function(){return g},NormalizeError:function(){return y},PageNotFoundError:function(){return m},SP:function(){return d},ST:function(){return p},WEB_VITALS:function(){return n},execOnce:function(){return r},getDisplayName:function(){return s},getLocationOrigin:function(){return i},getURL:function(){return u},isAbsoluteUrl:function(){return a},isResSent:function(){return c},loadGetInitialProps:function(){return f},normalizeRepeatedSlashes:function(){return l},stringifyError:function(){return E}});let n=["CLS","FCP","FID","INP","LCP","TTFB"];function r(e){let t,n=!1;return function(){for(var r=arguments.length,o=Array(r),a=0;ao.test(e);function i(){let{protocol:e,hostname:t,port:n}=window.location;return e+"//"+t+(n?":"+n:"")}function u(){let{href:e}=window.location,t=i();return e.substring(t.length)}function s(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function c(e){return e.finished||e.headersSent}function l(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?"?"+t.slice(1).join("?"):"")}async function f(e,t){let n=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await f(t.Component,t.ctx)}:{};let r=await e.getInitialProps(t);if(n&&c(n))return r;if(!r)throw Error('"'+s(e)+'.getInitialProps()" should resolve to an object. But found "'+r+'" instead.');return r}let d="undefined"!=typeof performance,p=d&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class h extends Error{}class y extends Error{}class m extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message="Cannot find module for page: "+e}}class g extends Error{constructor(e,t){super(),this.message="Failed to load static file for page: "+e+" "+t}}class _ extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function E(e){return JSON.stringify({message:e.message,stack:e.stack})}}}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/ab-tests/page-07c292a107a6b7eb.js b/static/_next/static/chunks/app/ab-tests/page-07c292a107a6b7eb.js deleted file mode 100644 index cbecc1e14b90d0b093892cb82fcb0b0b4f86bbcd..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/ab-tests/page-07c292a107a6b7eb.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4502],{7452:function(e,t,a){Promise.resolve().then(a.bind(a,8580))},9205:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var s=a(2265);let r=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n=function(){for(var e=arguments.length,t=Array(e),a=0;a!!e&&a.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,s.forwardRef)((e,t)=>{let{color:a="currentColor",size:r=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...m}=e;return(0,s.createElement)("svg",{ref:t,...i,width:r,height:r,stroke:a,strokeWidth:c?24*Number(l)/Number(r):l,className:n("lucide",o),...m},[...u.map(e=>{let[t,a]=e;return(0,s.createElement)(t,a)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let a=(0,s.forwardRef)((a,i)=>{let{className:c,...o}=a;return(0,s.createElement)(l,{ref:i,iconNode:t,className:n("lucide-".concat(r(e)),c),...o})});return a.displayName="".concat(e),a}},6272:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]])},3276:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},9397:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7168:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},8930:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,a){"use strict";var s,r;e.exports=(null==(s=a.g.process)?void 0:s.env)&&"object"==typeof(null==(r=a.g.process)?void 0:r.env)?a.g.process:a(4227)},4227:function(e){!function(){var t={229:function(e){var t,a,s,r=e.exports={};function n(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===n||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(a){try{return t.call(null,e,0)}catch(a){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:n}catch(e){t=n}try{a="function"==typeof clearTimeout?clearTimeout:i}catch(e){a=i}}();var c=[],o=!1,d=-1;function u(){o&&s&&(o=!1,s.length?c=s.concat(c):d=-1,c.length&&m())}function m(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(s=c,c=[];++d1)for(var a=1;a{m(!0),Promise.all([n.hi.get("/api/ab-tests").catch(()=>[]),n.hi.get("/api/providers").then(e=>j(Object.keys(e))).catch(()=>{})]).then(e=>{let[a]=e;return t(a)}).finally(()=>m(!1))};(0,r.useEffect)(()=>{_()},[]);let y=async e=>{await n.hi.patch("/api/ab-tests/".concat(e,"/toggle")),_()},N=async e=>{confirm("Reset stats for this A/B test?")&&(await n.hi.post("/api/ab-tests/".concat(e,"/reset")),_())},w=async e=>{confirm("Delete this A/B test?")&&(await n.hi.delete("/api/ab-tests/".concat(e)),_())},k=async()=>{if(g.name&&g.variant_a_provider&&g.variant_a_model&&g.variant_b_provider&&g.variant_b_model)try{let e={name:g.name,split_percent:g.split_percent,variant_a_provider:g.variant_a_provider,variant_a_model:g.variant_a_model,variant_b_provider:g.variant_b_provider,variant_b_model:g.variant_b_model};g.description&&(e.description=g.description),g.trigger_models&&(e.trigger_models=g.trigger_models.split(",").map(e=>e.trim()).filter(Boolean)),await n.hi.post("/api/ab-tests",e),v(!1),b({name:"",description:"",split_percent:50,variant_a_provider:"",variant_a_model:"",variant_b_provider:"",variant_b_model:"",trigger_models:""}),_()}catch(e){p(e instanceof Error?e.message:"Failed")}};r.useEffect(()=>{if(h){let e=setTimeout(()=>p(""),3e3);return()=>clearTimeout(e)}},[h]);let T=e=>{if(0===e.total_a&&0===e.total_b)return null;let t=100*e.error_rate_a+.01*e.avg_latency_a+e.avg_cost_a,a=100*e.error_rate_b+.01*e.avg_latency_b+e.avg_cost_b;return .001>Math.abs(t-a)?null:t(100*e).toFixed(1)+"%",E=e=>"$"+e.toFixed(4),A=e=>e.toFixed(0)+"ms";return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"page-header",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"page-title",children:"A/B Tests"}),(0,s.jsx)("p",{className:"page-sub",children:"Compare model variants side-by-side"})]}),(0,s.jsxs)("button",{className:"btn-primary",onClick:()=>v(!0),children:[(0,s.jsx)(i.Z,{size:16})," New Test"]})]}),x&&(0,s.jsx)("div",{className:"modal-overlay",onClick:()=>v(!1),children:(0,s.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New A/B Test"}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Name"}),(0,s.jsx)("input",{className:"input",value:g.name,onChange:e=>b(t=>({...t,name:e.target.value})),autoFocus:!0})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Description"}),(0,s.jsx)("input",{className:"input",value:g.description,onChange:e=>b(t=>({...t,description:e.target.value}))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Split % (first variant)"}),(0,s.jsx)("input",{className:"input",type:"number",min:1,max:99,value:g.split_percent,onChange:e=>b(t=>({...t,split_percent:Number(e.target.value)}))})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("p",{className:"text-sm font-semibold text-blue-400",children:"Variant A"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Provider"}),(0,s.jsxs)("select",{className:"select",value:g.variant_a_provider,onChange:e=>b(t=>({...t,variant_a_provider:e.target.value})),children:[(0,s.jsx)("option",{value:"",children:"Select"}),f.map(e=>(0,s.jsx)("option",{value:e,children:e},e))]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Model"}),(0,s.jsx)("input",{className:"input",value:g.variant_a_model,onChange:e=>b(t=>({...t,variant_a_model:e.target.value})),placeholder:"gpt-4o"})]})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("p",{className:"text-sm font-semibold text-purple-400",children:"Variant B"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Provider"}),(0,s.jsxs)("select",{className:"select",value:g.variant_b_provider,onChange:e=>b(t=>({...t,variant_b_provider:e.target.value})),children:[(0,s.jsx)("option",{value:"",children:"Select"}),f.map(e=>(0,s.jsx)("option",{value:e,children:e},e))]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Model"}),(0,s.jsx)("input",{className:"input",value:g.variant_b_model,onChange:e=>b(t=>({...t,variant_b_model:e.target.value})),placeholder:"claude-3-opus"})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"label",children:["Trigger Models ",(0,s.jsx)("span",{className:"text-[var(--text-tertiary)] font-normal",children:"comma-separated, leave empty for all"})]}),(0,s.jsx)("input",{className:"input",value:g.trigger_models,onChange:e=>b(t=>({...t,trigger_models:e.target.value})),placeholder:"gpt-4o, claude-3-opus"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:k,children:"Create"}),(0,s.jsx)("button",{className:"btn-ghost",onClick:()=>v(!1),children:"Cancel"})]})]})]})}),a?(0,s.jsx)("div",{className:"card",children:(0,s.jsx)("div",{className:"skeleton h-48 w-full"})}):0===e.length?(0,s.jsxs)("div",{className:"card text-center py-12",children:[(0,s.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,s.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No A/B tests configured."})]}):(0,s.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:e.map(e=>{let t=T(e);return(0,s.jsxs)("div",{className:"card",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold truncate",children:e.name}),e.description&&(0,s.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mt-0.5 truncate",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 ml-3 shrink-0",children:[(0,s.jsx)("button",{onClick:()=>y(e.id),title:e.is_active?"Disable":"Enable",children:e.is_active?(0,s.jsx)(c,{size:14,className:"text-green-400"}):(0,s.jsx)(o.Z,{size:14,className:"text-[var(--text-tertiary)]"})}),(0,s.jsx)("button",{onClick:()=>N(e.id),title:"Reset stats",children:(0,s.jsx)(d.Z,{size:14,className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)]"})}),(0,s.jsx)("button",{onClick:()=>w(e.id),title:"Delete",children:(0,s.jsx)(u.Z,{size:14,className:"text-red-400"})})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,s.jsx)("span",{className:"badge-".concat(e.is_active?"green":"red"),children:e.is_active?"Active":"Paused"}),(0,s.jsxs)("span",{className:"text-xs text-[var(--text-tertiary)]",children:[e.split_percent,"% / ",100-e.split_percent,"% split"]}),e.trigger_models.length>0&&(0,s.jsxs)("span",{className:"text-xs text-[var(--text-tertiary)] ml-auto truncate",title:e.trigger_models.join(", "),children:["triggers: ",e.trigger_models.join(", ")]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{className:"p-3 rounded-lg border ".concat("a"===t?"border-blue-500/40 bg-blue-500/5":"border-[var(--border)]"),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-blue-400",children:"Variant A"}),"a"===t&&(0,s.jsx)("span",{className:"text-[10px] font-semibold text-blue-400",children:"WINNING"})]}),(0,s.jsxs)("p",{className:"text-xs font-mono mb-1 truncate",children:[e.variant_a_provider,"/",e.variant_a_model]}),(0,s.jsxs)("div",{className:"space-y-0.5 text-[11px] text-[var(--text-secondary)]",children:[(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Requests"}),(0,s.jsx)("span",{className:"font-mono",children:e.total_a})]}),(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Avg Latency"}),(0,s.jsx)("span",{className:"font-mono",children:A(e.avg_latency_a)})]}),(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Avg Cost"}),(0,s.jsx)("span",{className:"font-mono",children:E(e.avg_cost_a)})]}),(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Error Rate"}),(0,s.jsx)("span",{className:"font-mono",children:C(e.error_rate_a)})]})]})]}),(0,s.jsxs)("div",{className:"p-3 rounded-lg border ".concat("b"===t?"border-purple-500/40 bg-purple-500/5":"border-[var(--border)]"),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-purple-400",children:"Variant B"}),"b"===t&&(0,s.jsx)("span",{className:"text-[10px] font-semibold text-purple-400",children:"WINNING"})]}),(0,s.jsxs)("p",{className:"text-xs font-mono mb-1 truncate",children:[e.variant_b_provider,"/",e.variant_b_model]}),(0,s.jsxs)("div",{className:"space-y-0.5 text-[11px] text-[var(--text-secondary)]",children:[(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Requests"}),(0,s.jsx)("span",{className:"font-mono",children:e.total_b})]}),(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Avg Latency"}),(0,s.jsx)("span",{className:"font-mono",children:A(e.avg_latency_b)})]}),(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Avg Cost"}),(0,s.jsx)("span",{className:"font-mono",children:E(e.avg_cost_b)})]}),(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Error Rate"}),(0,s.jsx)("span",{className:"font-mono",children:C(e.error_rate_b)})]})]})]})]})]},e.id)})}),h&&(0,s.jsx)("div",{className:"toast",children:h})]})}},1837:function(e,t,a){"use strict";a.d(t,{KF:function(){return m},hi:function(){return u},jl:function(){return i},qz:function(){return n}});let s=a(257).env.NEXT_PUBLIC_API_BASE||"";function r(){return localStorage.getItem("nexus_token")}function n(){localStorage.removeItem("nexus_token")}function i(){return!!r()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.method||"GET",i=r(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===a&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let a=o.get(e);if(a)return a}let u=(async()=>{let r=await fetch("".concat(s).concat(e),{method:a,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return r;if(401===r.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw n(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!r.ok)throw Error((await r.json().catch(()=>({detail:r.statusText}))).detail||"HTTP ".concat(r.status));if(204===r.status)return;let l=await r.json();return"GET"!==a||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===a&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var a;let s=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return a=s.access_token,localStorage.setItem("nexus_token",a),s},getMe:()=>d("/api/auth/me"),logout:()=>{n(),c.clear(),window.location.href="/login"}},m=async e=>{let t=r(),a=await fetch("".concat(s).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!a.ok)throw Error("Failed to download");let n=await a.blob(),i=URL.createObjectURL(n),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=7452)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/ab-tests/page-2b8d2c50e2a70e90.js b/static/_next/static/chunks/app/ab-tests/page-2b8d2c50e2a70e90.js new file mode 100644 index 0000000000000000000000000000000000000000..0e0e0a76e2ad3ab37d7c7a68905038aa6054f014 --- /dev/null +++ b/static/_next/static/chunks/app/ab-tests/page-2b8d2c50e2a70e90.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4502],{7452:function(e,t,a){Promise.resolve().then(a.bind(a,8580))},9205:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var r=a(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n=function(){for(var e=arguments.length,t=Array(e),a=0;a!!e&&a.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,r.forwardRef)((e,t)=>{let{color:a="currentColor",size:s=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...m}=e;return(0,r.createElement)("svg",{ref:t,...i,width:s,height:s,stroke:a,strokeWidth:c?24*Number(l)/Number(s):l,className:n("lucide",o),...m},[...u.map(e=>{let[t,a]=e;return(0,r.createElement)(t,a)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let a=(0,r.forwardRef)((a,i)=>{let{className:c,...o}=a;return(0,r.createElement)(l,{ref:i,iconNode:t,className:n("lucide-".concat(s(e)),c),...o})});return a.displayName="".concat(e),a}},6272:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]])},3276:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},9397:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7168:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},8930:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,a){"use strict";var r,s;e.exports=(null==(r=a.g.process)?void 0:r.env)&&"object"==typeof(null==(s=a.g.process)?void 0:s.env)?a.g.process:a(4227)},4227:function(e){!function(){var t={229:function(e){var t,a,r,s=e.exports={};function n(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===n||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(a){try{return t.call(null,e,0)}catch(a){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:n}catch(e){t=n}try{a="function"==typeof clearTimeout?clearTimeout:i}catch(e){a=i}}();var c=[],o=!1,d=-1;function u(){o&&r&&(o=!1,r.length?c=r.concat(c):d=-1,c.length&&m())}function m(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(r=c,c=[];++d1)for(var a=1;a{m(!0),Promise.all([n.hi.get("/api/ab-tests").catch(()=>[]),n.hi.get("/api/providers").then(e=>g(Object.keys(e))).catch(()=>{})]).then(e=>{let[a]=e;return t(a)}).finally(()=>m(!1))};(0,s.useEffect)(()=>{_()},[]);let y=async e=>{await n.hi.patch("/api/ab-tests/".concat(e,"/toggle")),_()},N=async e=>{confirm("Reset stats for this A/B test?")&&(await n.hi.post("/api/ab-tests/".concat(e,"/reset")),_())},w=async e=>{confirm("Delete this A/B test?")&&(await n.hi.delete("/api/ab-tests/".concat(e)),_())},k=async()=>{if(j.name&&j.variant_a_provider&&j.variant_a_model&&j.variant_b_provider&&j.variant_b_model)try{let e={name:j.name,split_percent:j.split_percent,variant_a_provider:j.variant_a_provider,variant_a_model:j.variant_a_model,variant_b_provider:j.variant_b_provider,variant_b_model:j.variant_b_model};j.description&&(e.description=j.description),j.trigger_models&&(e.trigger_models=j.trigger_models.split(",").map(e=>e.trim()).filter(Boolean)),await n.hi.post("/api/ab-tests",e),v(!1),b({name:"",description:"",split_percent:50,variant_a_provider:"",variant_a_model:"",variant_b_provider:"",variant_b_model:"",trigger_models:""}),_()}catch(e){p(e instanceof Error?e.message:"Failed")}};s.useEffect(()=>{if(h){let e=setTimeout(()=>p(""),3e3);return()=>clearTimeout(e)}},[h]);let T=e=>{if(0===e.total_a&&0===e.total_b)return null;let t=100*e.error_rate_a+.01*e.avg_latency_a+e.avg_cost_a,a=100*e.error_rate_b+.01*e.avg_latency_b+e.avg_cost_b;return .001>Math.abs(t-a)?null:t(100*e).toFixed(1)+"%",E=e=>"$"+e.toFixed(4),A=e=>e.toFixed(0)+"ms";return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"A/B Tests"}),(0,r.jsx)("p",{className:"page-sub",children:"Compare model variants side-by-side"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>v(!0),children:[(0,r.jsx)(i.Z,{size:16})," New Test"]})]}),x&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>v(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New A/B Test"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name"}),(0,r.jsx)("input",{className:"input",value:j.name,onChange:e=>b(t=>({...t,name:e.target.value})),autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Description"}),(0,r.jsx)("input",{className:"input",value:j.description,onChange:e=>b(t=>({...t,description:e.target.value}))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Split % (first variant)"}),(0,r.jsx)("input",{className:"input",type:"number",min:1,max:99,value:j.split_percent,onChange:e=>b(t=>({...t,split_percent:Number(e.target.value)}))})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-blue-400",children:"Variant A"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Provider"}),(0,r.jsxs)("select",{className:"select",value:j.variant_a_provider,onChange:e=>b(t=>({...t,variant_a_provider:e.target.value})),children:[(0,r.jsx)("option",{value:"",children:"Select"}),f.map(e=>(0,r.jsx)("option",{value:e,children:e},e))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Model"}),(0,r.jsx)("input",{className:"input",value:j.variant_a_model,onChange:e=>b(t=>({...t,variant_a_model:e.target.value})),placeholder:"gpt-4o"})]})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-purple-400",children:"Variant B"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Provider"}),(0,r.jsxs)("select",{className:"select",value:j.variant_b_provider,onChange:e=>b(t=>({...t,variant_b_provider:e.target.value})),children:[(0,r.jsx)("option",{value:"",children:"Select"}),f.map(e=>(0,r.jsx)("option",{value:e,children:e},e))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Model"}),(0,r.jsx)("input",{className:"input",value:j.variant_b_model,onChange:e=>b(t=>({...t,variant_b_model:e.target.value})),placeholder:"claude-3-opus"})]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"label",children:["Trigger Models ",(0,r.jsx)("span",{className:"text-[var(--text-tertiary)] font-normal",children:"comma-separated, leave empty for all"})]}),(0,r.jsx)("input",{className:"input",value:j.trigger_models,onChange:e=>b(t=>({...t,trigger_models:e.target.value})),placeholder:"gpt-4o, claude-3-opus"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:k,children:"Create"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>v(!1),children:"Cancel"})]})]})]})}),a?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-48 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No A/B tests configured."})]}):(0,r.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:e.map(e=>{let t=T(e);return(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold truncate",children:e.name}),e.description&&(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mt-0.5 truncate",children:e.description})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 ml-3 shrink-0",children:[(0,r.jsx)("button",{onClick:()=>y(e.id),title:e.is_active?"Disable":"Enable",children:e.is_active?(0,r.jsx)(c,{size:14,className:"text-green-400"}):(0,r.jsx)(o.Z,{size:14,className:"text-[var(--text-tertiary)]"})}),(0,r.jsx)("button",{onClick:()=>N(e.id),title:"Reset stats",children:(0,r.jsx)(d.Z,{size:14,className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)]"})}),(0,r.jsx)("button",{onClick:()=>w(e.id),title:"Delete",children:(0,r.jsx)(u.Z,{size:14,className:"text-red-400"})})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,r.jsx)("span",{className:"badge-".concat(e.is_active?"green":"red"),children:e.is_active?"Active":"Paused"}),(0,r.jsxs)("span",{className:"text-xs text-[var(--text-tertiary)]",children:[e.split_percent,"% / ",100-e.split_percent,"% split"]}),e.trigger_models.length>0&&(0,r.jsxs)("span",{className:"text-xs text-[var(--text-tertiary)] ml-auto truncate",title:e.trigger_models.join(", "),children:["triggers: ",e.trigger_models.join(", ")]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{className:"p-3 rounded-lg border ".concat("a"===t?"border-blue-500/40 bg-blue-500/5":"border-[var(--border)]"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("span",{className:"text-xs font-semibold text-blue-400",children:"Variant A"}),"a"===t&&(0,r.jsx)("span",{className:"text-[10px] font-semibold text-blue-400",children:"WINNING"})]}),(0,r.jsxs)("p",{className:"text-xs font-mono mb-1 truncate",children:[e.variant_a_provider,"/",e.variant_a_model]}),(0,r.jsxs)("div",{className:"space-y-0.5 text-[11px] text-[var(--text-secondary)]",children:[(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{children:"Requests"}),(0,r.jsx)("span",{className:"font-mono",children:e.total_a})]}),(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{children:"Avg Latency"}),(0,r.jsx)("span",{className:"font-mono",children:A(e.avg_latency_a)})]}),(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{children:"Avg Cost"}),(0,r.jsx)("span",{className:"font-mono",children:E(e.avg_cost_a)})]}),(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{children:"Error Rate"}),(0,r.jsx)("span",{className:"font-mono",children:C(e.error_rate_a)})]})]})]}),(0,r.jsxs)("div",{className:"p-3 rounded-lg border ".concat("b"===t?"border-purple-500/40 bg-purple-500/5":"border-[var(--border)]"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("span",{className:"text-xs font-semibold text-purple-400",children:"Variant B"}),"b"===t&&(0,r.jsx)("span",{className:"text-[10px] font-semibold text-purple-400",children:"WINNING"})]}),(0,r.jsxs)("p",{className:"text-xs font-mono mb-1 truncate",children:[e.variant_b_provider,"/",e.variant_b_model]}),(0,r.jsxs)("div",{className:"space-y-0.5 text-[11px] text-[var(--text-secondary)]",children:[(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{children:"Requests"}),(0,r.jsx)("span",{className:"font-mono",children:e.total_b})]}),(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{children:"Avg Latency"}),(0,r.jsx)("span",{className:"font-mono",children:A(e.avg_latency_b)})]}),(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{children:"Avg Cost"}),(0,r.jsx)("span",{className:"font-mono",children:E(e.avg_cost_b)})]}),(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("span",{children:"Error Rate"}),(0,r.jsx)("span",{className:"font-mono",children:C(e.error_rate_b)})]})]})]})]})]},e.id)})}),h&&(0,r.jsx)("div",{className:"toast",children:h})]})}},1837:function(e,t,a){"use strict";a.d(t,{KF:function(){return m},hi:function(){return u},jl:function(){return i},qz:function(){return n}});let r=a(257).env.NEXT_PUBLIC_API_BASE||"";function s(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function n(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!s()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.method||"GET",i=s(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===a&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let a=o.get(e);if(a)return a}let u=(async()=>{let s=await fetch("".concat(r).concat(e),{method:a,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw n(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let l=await s.json();return"GET"!==a||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===a&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var a;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return a=r.access_token,localStorage.setItem("nexus_token",a),function(e,t,a){try{let a="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(a)}catch(e){}}("nexus_token",a,0),r},getMe:()=>d("/api/auth/me"),logout:()=>{n(),c.clear(),window.location.href="/login"}},m=async e=>{let t=s(),a=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!a.ok)throw Error("Failed to download");let n=await a.blob(),i=URL.createObjectURL(n),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=7452)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/ab-tests/page-48b03e034dff445e.js b/static/_next/static/chunks/app/ab-tests/page-48b03e034dff445e.js deleted file mode 100644 index cbecc1e14b90d0b093892cb82fcb0b0b4f86bbcd..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/ab-tests/page-48b03e034dff445e.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4502],{7452:function(e,t,a){Promise.resolve().then(a.bind(a,8580))},9205:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var s=a(2265);let r=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n=function(){for(var e=arguments.length,t=Array(e),a=0;a!!e&&a.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,s.forwardRef)((e,t)=>{let{color:a="currentColor",size:r=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...m}=e;return(0,s.createElement)("svg",{ref:t,...i,width:r,height:r,stroke:a,strokeWidth:c?24*Number(l)/Number(r):l,className:n("lucide",o),...m},[...u.map(e=>{let[t,a]=e;return(0,s.createElement)(t,a)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let a=(0,s.forwardRef)((a,i)=>{let{className:c,...o}=a;return(0,s.createElement)(l,{ref:i,iconNode:t,className:n("lucide-".concat(r(e)),c),...o})});return a.displayName="".concat(e),a}},6272:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]])},3276:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},9397:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7168:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},8930:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,a){"use strict";var s,r;e.exports=(null==(s=a.g.process)?void 0:s.env)&&"object"==typeof(null==(r=a.g.process)?void 0:r.env)?a.g.process:a(4227)},4227:function(e){!function(){var t={229:function(e){var t,a,s,r=e.exports={};function n(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===n||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(a){try{return t.call(null,e,0)}catch(a){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:n}catch(e){t=n}try{a="function"==typeof clearTimeout?clearTimeout:i}catch(e){a=i}}();var c=[],o=!1,d=-1;function u(){o&&s&&(o=!1,s.length?c=s.concat(c):d=-1,c.length&&m())}function m(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(s=c,c=[];++d1)for(var a=1;a{m(!0),Promise.all([n.hi.get("/api/ab-tests").catch(()=>[]),n.hi.get("/api/providers").then(e=>j(Object.keys(e))).catch(()=>{})]).then(e=>{let[a]=e;return t(a)}).finally(()=>m(!1))};(0,r.useEffect)(()=>{_()},[]);let y=async e=>{await n.hi.patch("/api/ab-tests/".concat(e,"/toggle")),_()},N=async e=>{confirm("Reset stats for this A/B test?")&&(await n.hi.post("/api/ab-tests/".concat(e,"/reset")),_())},w=async e=>{confirm("Delete this A/B test?")&&(await n.hi.delete("/api/ab-tests/".concat(e)),_())},k=async()=>{if(g.name&&g.variant_a_provider&&g.variant_a_model&&g.variant_b_provider&&g.variant_b_model)try{let e={name:g.name,split_percent:g.split_percent,variant_a_provider:g.variant_a_provider,variant_a_model:g.variant_a_model,variant_b_provider:g.variant_b_provider,variant_b_model:g.variant_b_model};g.description&&(e.description=g.description),g.trigger_models&&(e.trigger_models=g.trigger_models.split(",").map(e=>e.trim()).filter(Boolean)),await n.hi.post("/api/ab-tests",e),v(!1),b({name:"",description:"",split_percent:50,variant_a_provider:"",variant_a_model:"",variant_b_provider:"",variant_b_model:"",trigger_models:""}),_()}catch(e){p(e instanceof Error?e.message:"Failed")}};r.useEffect(()=>{if(h){let e=setTimeout(()=>p(""),3e3);return()=>clearTimeout(e)}},[h]);let T=e=>{if(0===e.total_a&&0===e.total_b)return null;let t=100*e.error_rate_a+.01*e.avg_latency_a+e.avg_cost_a,a=100*e.error_rate_b+.01*e.avg_latency_b+e.avg_cost_b;return .001>Math.abs(t-a)?null:t(100*e).toFixed(1)+"%",E=e=>"$"+e.toFixed(4),A=e=>e.toFixed(0)+"ms";return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"page-header",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"page-title",children:"A/B Tests"}),(0,s.jsx)("p",{className:"page-sub",children:"Compare model variants side-by-side"})]}),(0,s.jsxs)("button",{className:"btn-primary",onClick:()=>v(!0),children:[(0,s.jsx)(i.Z,{size:16})," New Test"]})]}),x&&(0,s.jsx)("div",{className:"modal-overlay",onClick:()=>v(!1),children:(0,s.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New A/B Test"}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Name"}),(0,s.jsx)("input",{className:"input",value:g.name,onChange:e=>b(t=>({...t,name:e.target.value})),autoFocus:!0})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Description"}),(0,s.jsx)("input",{className:"input",value:g.description,onChange:e=>b(t=>({...t,description:e.target.value}))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Split % (first variant)"}),(0,s.jsx)("input",{className:"input",type:"number",min:1,max:99,value:g.split_percent,onChange:e=>b(t=>({...t,split_percent:Number(e.target.value)}))})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("p",{className:"text-sm font-semibold text-blue-400",children:"Variant A"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Provider"}),(0,s.jsxs)("select",{className:"select",value:g.variant_a_provider,onChange:e=>b(t=>({...t,variant_a_provider:e.target.value})),children:[(0,s.jsx)("option",{value:"",children:"Select"}),f.map(e=>(0,s.jsx)("option",{value:e,children:e},e))]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Model"}),(0,s.jsx)("input",{className:"input",value:g.variant_a_model,onChange:e=>b(t=>({...t,variant_a_model:e.target.value})),placeholder:"gpt-4o"})]})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("p",{className:"text-sm font-semibold text-purple-400",children:"Variant B"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Provider"}),(0,s.jsxs)("select",{className:"select",value:g.variant_b_provider,onChange:e=>b(t=>({...t,variant_b_provider:e.target.value})),children:[(0,s.jsx)("option",{value:"",children:"Select"}),f.map(e=>(0,s.jsx)("option",{value:e,children:e},e))]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Model"}),(0,s.jsx)("input",{className:"input",value:g.variant_b_model,onChange:e=>b(t=>({...t,variant_b_model:e.target.value})),placeholder:"claude-3-opus"})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"label",children:["Trigger Models ",(0,s.jsx)("span",{className:"text-[var(--text-tertiary)] font-normal",children:"comma-separated, leave empty for all"})]}),(0,s.jsx)("input",{className:"input",value:g.trigger_models,onChange:e=>b(t=>({...t,trigger_models:e.target.value})),placeholder:"gpt-4o, claude-3-opus"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:k,children:"Create"}),(0,s.jsx)("button",{className:"btn-ghost",onClick:()=>v(!1),children:"Cancel"})]})]})]})}),a?(0,s.jsx)("div",{className:"card",children:(0,s.jsx)("div",{className:"skeleton h-48 w-full"})}):0===e.length?(0,s.jsxs)("div",{className:"card text-center py-12",children:[(0,s.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,s.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No A/B tests configured."})]}):(0,s.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:e.map(e=>{let t=T(e);return(0,s.jsxs)("div",{className:"card",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold truncate",children:e.name}),e.description&&(0,s.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mt-0.5 truncate",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 ml-3 shrink-0",children:[(0,s.jsx)("button",{onClick:()=>y(e.id),title:e.is_active?"Disable":"Enable",children:e.is_active?(0,s.jsx)(c,{size:14,className:"text-green-400"}):(0,s.jsx)(o.Z,{size:14,className:"text-[var(--text-tertiary)]"})}),(0,s.jsx)("button",{onClick:()=>N(e.id),title:"Reset stats",children:(0,s.jsx)(d.Z,{size:14,className:"text-[var(--text-tertiary)] hover:text-[var(--text-primary)]"})}),(0,s.jsx)("button",{onClick:()=>w(e.id),title:"Delete",children:(0,s.jsx)(u.Z,{size:14,className:"text-red-400"})})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,s.jsx)("span",{className:"badge-".concat(e.is_active?"green":"red"),children:e.is_active?"Active":"Paused"}),(0,s.jsxs)("span",{className:"text-xs text-[var(--text-tertiary)]",children:[e.split_percent,"% / ",100-e.split_percent,"% split"]}),e.trigger_models.length>0&&(0,s.jsxs)("span",{className:"text-xs text-[var(--text-tertiary)] ml-auto truncate",title:e.trigger_models.join(", "),children:["triggers: ",e.trigger_models.join(", ")]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{className:"p-3 rounded-lg border ".concat("a"===t?"border-blue-500/40 bg-blue-500/5":"border-[var(--border)]"),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-blue-400",children:"Variant A"}),"a"===t&&(0,s.jsx)("span",{className:"text-[10px] font-semibold text-blue-400",children:"WINNING"})]}),(0,s.jsxs)("p",{className:"text-xs font-mono mb-1 truncate",children:[e.variant_a_provider,"/",e.variant_a_model]}),(0,s.jsxs)("div",{className:"space-y-0.5 text-[11px] text-[var(--text-secondary)]",children:[(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Requests"}),(0,s.jsx)("span",{className:"font-mono",children:e.total_a})]}),(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Avg Latency"}),(0,s.jsx)("span",{className:"font-mono",children:A(e.avg_latency_a)})]}),(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Avg Cost"}),(0,s.jsx)("span",{className:"font-mono",children:E(e.avg_cost_a)})]}),(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Error Rate"}),(0,s.jsx)("span",{className:"font-mono",children:C(e.error_rate_a)})]})]})]}),(0,s.jsxs)("div",{className:"p-3 rounded-lg border ".concat("b"===t?"border-purple-500/40 bg-purple-500/5":"border-[var(--border)]"),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-xs font-semibold text-purple-400",children:"Variant B"}),"b"===t&&(0,s.jsx)("span",{className:"text-[10px] font-semibold text-purple-400",children:"WINNING"})]}),(0,s.jsxs)("p",{className:"text-xs font-mono mb-1 truncate",children:[e.variant_b_provider,"/",e.variant_b_model]}),(0,s.jsxs)("div",{className:"space-y-0.5 text-[11px] text-[var(--text-secondary)]",children:[(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Requests"}),(0,s.jsx)("span",{className:"font-mono",children:e.total_b})]}),(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Avg Latency"}),(0,s.jsx)("span",{className:"font-mono",children:A(e.avg_latency_b)})]}),(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Avg Cost"}),(0,s.jsx)("span",{className:"font-mono",children:E(e.avg_cost_b)})]}),(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("span",{children:"Error Rate"}),(0,s.jsx)("span",{className:"font-mono",children:C(e.error_rate_b)})]})]})]})]})]},e.id)})}),h&&(0,s.jsx)("div",{className:"toast",children:h})]})}},1837:function(e,t,a){"use strict";a.d(t,{KF:function(){return m},hi:function(){return u},jl:function(){return i},qz:function(){return n}});let s=a(257).env.NEXT_PUBLIC_API_BASE||"";function r(){return localStorage.getItem("nexus_token")}function n(){localStorage.removeItem("nexus_token")}function i(){return!!r()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.method||"GET",i=r(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===a&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let a=o.get(e);if(a)return a}let u=(async()=>{let r=await fetch("".concat(s).concat(e),{method:a,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return r;if(401===r.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw n(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!r.ok)throw Error((await r.json().catch(()=>({detail:r.statusText}))).detail||"HTTP ".concat(r.status));if(204===r.status)return;let l=await r.json();return"GET"!==a||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===a&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var a;let s=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return a=s.access_token,localStorage.setItem("nexus_token",a),s},getMe:()=>d("/api/auth/me"),logout:()=>{n(),c.clear(),window.location.href="/login"}},m=async e=>{let t=r(),a=await fetch("".concat(s).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!a.ok)throw Error("Failed to download");let n=await a.blob(),i=URL.createObjectURL(n),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=7452)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/activity/page-5a4807967b5002cd.js b/static/_next/static/chunks/app/activity/page-03c92e6695ec079a.js similarity index 67% rename from static/_next/static/chunks/app/activity/page-5a4807967b5002cd.js rename to static/_next/static/chunks/app/activity/page-03c92e6695ec079a.js index f3ae6bba94c41c0d215e00f1d4cc470a8d51bcbb..05989a891a8e7751f8cfb0dfbecdd5f58b800ad9 100644 --- a/static/_next/static/chunks/app/activity/page-5a4807967b5002cd.js +++ b/static/_next/static/chunks/app/activity/page-03c92e6695ec079a.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6263],{8973:function(e,t,n){Promise.resolve().then(n.bind(n,6105))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:d,iconNode:u,...h}=e;return(0,r.createElement)("svg",{ref:t,...i,width:s,height:s,stroke:n,strokeWidth:c?24*Number(o)/Number(s):o,className:a("lucide",l),...h},[...u.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,i)=>{let{className:c,...l}=n;return(0,r.createElement)(o,{ref:i,iconNode:t,className:a("lucide-".concat(s(e)),c),...l})});return n.displayName="".concat(e),n}},401:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},2735:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},5621:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},2489:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},257:function(e,t,n){"use strict";var r,s;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(s=n.g.process)?void 0:s.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,s=e.exports={};function a(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var c=[],l=!1,d=-1;function u(){l&&r&&(l=!1,r.length?c=r.concat(c):d=-1,c.length&&h())}function h(){if(!l){var e=o(u);l=!0;for(var t=c.length;t;){for(r=c,c=[];++d1)for(var n=1;n{h(!0),x(""),a.hi.get("/api/logs?offset=".concat(m,"&limit=").concat(25)).then(e=>{t(e.logs),g(e.total)}).catch(e=>x(e instanceof Error?e.message:"Failed to load activity")).finally(()=>h(!1))},[m]);let N=Math.ceil(y/25),T=async()=>{if(confirm("Delete all activity logs? This cannot be undone.")){j(!0);try{await a.hi.delete("/api/logs"),p(0),t([]),g(0)}catch(e){x(e instanceof Error?e.message:"Failed to clear logs")}finally{j(!1)}}},E=async()=>{k(!0);try{await (0,a.KF)("/api/logs/export.csv")}catch(e){x(e instanceof Error?e.message:"Failed to export CSV")}finally{k(!1)}};return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Activity Log"}),(0,r.jsx)("p",{className:"page-sub",children:"Recent API requests and responses"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsxs)("button",{className:"btn-secondary",onClick:E,disabled:w||0===e.length,children:[(0,r.jsx)(i.Z,{size:16}),w?"Downloading...":"Download CSV"]}),(0,r.jsxs)("button",{className:"btn-danger",onClick:T,disabled:v||0===y,children:[(0,r.jsx)(o.Z,{size:16}),v?"Clearing...":"Clear Logs"]})]})]}),f?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:f})]}):n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-48 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No activity yet. Start making requests to see logs."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Time"}),(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Provider"}),(0,r.jsx)("th",{children:"Tokens"}),(0,r.jsx)("th",{children:"Cost"}),(0,r.jsx)("th",{children:"Latency"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{children:"Flags"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"text-xs text-[var(--text-tertiary)] whitespace-nowrap",children:e.timestamp}),(0,r.jsx)("td",{className:"font-medium text-sm max-w-[200px] truncate",title:e.model,children:e.model}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"text-sm capitalize",children:e.provider})}),(0,r.jsxs)("td",{className:"text-xs",children:[e.tokens_in," → ",e.tokens_out]}),(0,r.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.cost).toFixed(6)]}),(0,r.jsxs)("td",{className:"text-xs",children:[e.latency_ms,"ms"]}),(0,r.jsx)("td",{children:e.error?(0,r.jsxs)("span",{className:"badge-red",title:e.error,children:[(0,r.jsx)(u.Z,{size:12})," Error"]}):(0,r.jsxs)("span",{className:"badge-green",children:[(0,r.jsx)(d.Z,{size:12})," Success"]})}),(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"flex gap-1",children:[1===e.streaming&&(0,r.jsx)("span",{className:"badge-blue text-xs",children:"stream"}),1===e.cached&&(0,r.jsx)("span",{className:"badge-green text-xs",children:"cached"})]})})]},e.id))})]})})}),N>1&&(0,r.jsxs)("div",{className:"flex items-center justify-between mt-4 text-sm",children:[(0,r.jsxs)("span",{className:"text-[var(--text-tertiary)]",children:["Page ",Math.floor(m/25)+1," of ",N," (",y," total)"]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-ghost btn-sm",disabled:m<=0,onClick:()=>b(()=>p(e=>Math.max(0,e-25))),children:"← Prev"}),(0,r.jsx)("button",{className:"btn-ghost btn-sm",disabled:m+25>=y,onClick:()=>b(()=>p(e=>e+25)),children:"Next →"})]})]})]})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return a}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function s(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function i(){return!!s()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=s(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let u=(async()=>{let s=await fetch("".concat(r).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let o=await s.json();return"GET"!==n||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===n&&!i){l.set(e,u);try{return await u}finally{l.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>d("/api/auth/me"),logout:()=>{a(),c.clear(),window.location.href="/login"}},h=async e=>{let t=s(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let a=await n.blob(),i=URL.createObjectURL(a),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=8973)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6263],{8973:function(e,t,n){Promise.resolve().then(n.bind(n,6105))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...i,width:s,height:s,stroke:n,strokeWidth:c?24*Number(o)/Number(s):o,className:a("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,i)=>{let{className:c,...l}=n;return(0,r.createElement)(o,{ref:i,iconNode:t,className:a("lucide-".concat(s(e)),c),...l})});return n.displayName="".concat(e),n}},401:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},2735:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},5621:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},2489:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},257:function(e,t,n){"use strict";var r,s;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(s=n.g.process)?void 0:s.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,s=e.exports={};function a(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var c=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?c=r.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(r=c,c=[];++u1)for(var n=1;n{h(!0),x(""),a.hi.get("/api/logs?offset=".concat(m,"&limit=").concat(25)).then(e=>{t(e.logs),g(e.total)}).catch(e=>x(e instanceof Error?e.message:"Failed to load activity")).finally(()=>h(!1))},[m]);let N=Math.ceil(y/25),T=async()=>{if(confirm("Delete all activity logs? This cannot be undone.")){j(!0);try{await a.hi.delete("/api/logs"),p(0),t([]),g(0)}catch(e){x(e instanceof Error?e.message:"Failed to clear logs")}finally{j(!1)}}},E=async()=>{w(!0);try{await (0,a.KF)("/api/logs/export.csv")}catch(e){x(e instanceof Error?e.message:"Failed to export CSV")}finally{w(!1)}};return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Activity Log"}),(0,r.jsx)("p",{className:"page-sub",children:"Recent API requests and responses"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsxs)("button",{className:"btn-secondary",onClick:E,disabled:k||0===e.length,children:[(0,r.jsx)(i.Z,{size:16}),k?"Downloading...":"Download CSV"]}),(0,r.jsxs)("button",{className:"btn-danger",onClick:T,disabled:v||0===y,children:[(0,r.jsx)(o.Z,{size:16}),v?"Clearing...":"Clear Logs"]})]})]}),f?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:f})]}):n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-48 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No activity yet. Start making requests to see logs."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Time"}),(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Provider"}),(0,r.jsx)("th",{children:"Tokens"}),(0,r.jsx)("th",{children:"Cost"}),(0,r.jsx)("th",{children:"Latency"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{children:"Flags"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"text-xs text-[var(--text-tertiary)] whitespace-nowrap",children:e.timestamp}),(0,r.jsx)("td",{className:"font-medium text-sm max-w-[200px] truncate",title:e.model,children:e.model}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"text-sm capitalize",children:e.provider})}),(0,r.jsxs)("td",{className:"text-xs",children:[e.tokens_in," → ",e.tokens_out]}),(0,r.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.cost).toFixed(6)]}),(0,r.jsxs)("td",{className:"text-xs",children:[e.latency_ms,"ms"]}),(0,r.jsx)("td",{children:e.error?(0,r.jsxs)("span",{className:"badge-red",title:e.error,children:[(0,r.jsx)(d.Z,{size:12})," Error"]}):(0,r.jsxs)("span",{className:"badge-green",children:[(0,r.jsx)(u.Z,{size:12})," Success"]})}),(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"flex gap-1",children:[1===e.streaming&&(0,r.jsx)("span",{className:"badge-blue text-xs",children:"stream"}),1===e.cached&&(0,r.jsx)("span",{className:"badge-green text-xs",children:"cached"})]})})]},e.id))})]})})}),N>1&&(0,r.jsxs)("div",{className:"flex items-center justify-between mt-4 text-sm",children:[(0,r.jsxs)("span",{className:"text-[var(--text-tertiary)]",children:["Page ",Math.floor(m/25)+1," of ",N," (",y," total)"]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-ghost btn-sm",disabled:m<=0,onClick:()=>b(()=>p(e=>Math.max(0,e-25))),children:"← Prev"}),(0,r.jsx)("button",{className:"btn-ghost btn-sm",disabled:m+25>=y,onClick:()=>b(()=>p(e=>e+25)),children:"Next →"})]})]})]})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return a}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function s(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function a(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!s()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=s(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let s=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let o=await s.json();return"GET"!==n||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===n&&!i){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>u("/api/auth/me"),logout:()=>{a(),c.clear(),window.location.href="/login"}},h=async e=>{let t=s(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let a=await n.blob(),i=URL.createObjectURL(a),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=8973)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/activity/page-d1a71f38c937f6b6.js b/static/_next/static/chunks/app/activity/page-d1a71f38c937f6b6.js deleted file mode 100644 index f3ae6bba94c41c0d215e00f1d4cc470a8d51bcbb..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/activity/page-d1a71f38c937f6b6.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6263],{8973:function(e,t,n){Promise.resolve().then(n.bind(n,6105))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:d,iconNode:u,...h}=e;return(0,r.createElement)("svg",{ref:t,...i,width:s,height:s,stroke:n,strokeWidth:c?24*Number(o)/Number(s):o,className:a("lucide",l),...h},[...u.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,i)=>{let{className:c,...l}=n;return(0,r.createElement)(o,{ref:i,iconNode:t,className:a("lucide-".concat(s(e)),c),...l})});return n.displayName="".concat(e),n}},401:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},2735:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},5621:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},2489:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},257:function(e,t,n){"use strict";var r,s;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(s=n.g.process)?void 0:s.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,s=e.exports={};function a(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var c=[],l=!1,d=-1;function u(){l&&r&&(l=!1,r.length?c=r.concat(c):d=-1,c.length&&h())}function h(){if(!l){var e=o(u);l=!0;for(var t=c.length;t;){for(r=c,c=[];++d1)for(var n=1;n{h(!0),x(""),a.hi.get("/api/logs?offset=".concat(m,"&limit=").concat(25)).then(e=>{t(e.logs),g(e.total)}).catch(e=>x(e instanceof Error?e.message:"Failed to load activity")).finally(()=>h(!1))},[m]);let N=Math.ceil(y/25),T=async()=>{if(confirm("Delete all activity logs? This cannot be undone.")){j(!0);try{await a.hi.delete("/api/logs"),p(0),t([]),g(0)}catch(e){x(e instanceof Error?e.message:"Failed to clear logs")}finally{j(!1)}}},E=async()=>{k(!0);try{await (0,a.KF)("/api/logs/export.csv")}catch(e){x(e instanceof Error?e.message:"Failed to export CSV")}finally{k(!1)}};return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Activity Log"}),(0,r.jsx)("p",{className:"page-sub",children:"Recent API requests and responses"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsxs)("button",{className:"btn-secondary",onClick:E,disabled:w||0===e.length,children:[(0,r.jsx)(i.Z,{size:16}),w?"Downloading...":"Download CSV"]}),(0,r.jsxs)("button",{className:"btn-danger",onClick:T,disabled:v||0===y,children:[(0,r.jsx)(o.Z,{size:16}),v?"Clearing...":"Clear Logs"]})]})]}),f?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:f})]}):n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-48 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No activity yet. Start making requests to see logs."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Time"}),(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Provider"}),(0,r.jsx)("th",{children:"Tokens"}),(0,r.jsx)("th",{children:"Cost"}),(0,r.jsx)("th",{children:"Latency"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{children:"Flags"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"text-xs text-[var(--text-tertiary)] whitespace-nowrap",children:e.timestamp}),(0,r.jsx)("td",{className:"font-medium text-sm max-w-[200px] truncate",title:e.model,children:e.model}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"text-sm capitalize",children:e.provider})}),(0,r.jsxs)("td",{className:"text-xs",children:[e.tokens_in," → ",e.tokens_out]}),(0,r.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.cost).toFixed(6)]}),(0,r.jsxs)("td",{className:"text-xs",children:[e.latency_ms,"ms"]}),(0,r.jsx)("td",{children:e.error?(0,r.jsxs)("span",{className:"badge-red",title:e.error,children:[(0,r.jsx)(u.Z,{size:12})," Error"]}):(0,r.jsxs)("span",{className:"badge-green",children:[(0,r.jsx)(d.Z,{size:12})," Success"]})}),(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"flex gap-1",children:[1===e.streaming&&(0,r.jsx)("span",{className:"badge-blue text-xs",children:"stream"}),1===e.cached&&(0,r.jsx)("span",{className:"badge-green text-xs",children:"cached"})]})})]},e.id))})]})})}),N>1&&(0,r.jsxs)("div",{className:"flex items-center justify-between mt-4 text-sm",children:[(0,r.jsxs)("span",{className:"text-[var(--text-tertiary)]",children:["Page ",Math.floor(m/25)+1," of ",N," (",y," total)"]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-ghost btn-sm",disabled:m<=0,onClick:()=>b(()=>p(e=>Math.max(0,e-25))),children:"← Prev"}),(0,r.jsx)("button",{className:"btn-ghost btn-sm",disabled:m+25>=y,onClick:()=>b(()=>p(e=>e+25)),children:"Next →"})]})]})]})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return a}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function s(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function i(){return!!s()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=s(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let u=(async()=>{let s=await fetch("".concat(r).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let o=await s.json();return"GET"!==n||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===n&&!i){l.set(e,u);try{return await u}finally{l.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>d("/api/auth/me"),logout:()=>{a(),c.clear(),window.location.href="/login"}},h=async e=>{let t=s(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let a=await n.blob(),i=URL.createObjectURL(a),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=8973)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/admin/page-2d512533ea7af2ec.js b/static/_next/static/chunks/app/admin/page-2d512533ea7af2ec.js deleted file mode 100644 index 01490bc1a51d8dfc6d9db9017483425a0d164277..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/admin/page-2d512533ea7af2ec.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3],{3429:function(e,s,a){Promise.resolve().then(a.bind(a,6683))},6683:function(e,s,a){"use strict";a.r(s),a.d(s,{default:function(){return f}});var d=a(7437),l=a(29),t=a.n(l),n=a(2265),c=a(1837),i=a(3229),r=a(4001);function f(){let[e,s]=(0,n.useState)({}),[a,l]=(0,n.useState)(!0),[f,x]=(0,n.useState)(!1),[j,o]=(0,n.useState)(""),[h,m]=(0,n.useState)(""),[u,p]=(0,n.useState)("");(0,n.useEffect)(()=>{c.hi.get("/api/settings").then(e=>{s(e)}).finally(()=>l(!1))},[]);let g=(e,a)=>{s(s=>({...s,[e]:String(a)}))},b=s=>"true"===e[s],N=s=>e[s]||"",v=s=>parseInt(e[s])||0,_=s=>parseFloat(e[s])||0,y=async()=>{x(!0);try{await c.hi.put("/api/settings",e),o("Settings saved")}catch(e){o(e instanceof Error?e.message:"Failed")}finally{x(!1)}},k=async()=>{if(!h||!u||u.length<6){o("Both fields required, new password min 6 chars");return}try{await c.hi.post("/api/auth/change-password",{old_password:h,new_password:u}),o("Password changed"),m(""),p("")}catch(e){o(e instanceof Error?e.message:"Failed")}};return(n.useEffect(()=>{if(j){let e=setTimeout(()=>o(""),3e3);return()=>clearTimeout(e)}},[j]),a)?(0,d.jsx)("div",{className:"card",children:(0,d.jsx)("div",{className:"skeleton h-64 w-full"})}):(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 page-header",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("h1",{className:"jsx-d7f00f396e984d2 page-title",children:"Settings"}),(0,d.jsx)("p",{className:"jsx-d7f00f396e984d2 page-sub",children:"Gateway configuration"})]}),(0,d.jsxs)("button",{onClick:y,disabled:f,className:"jsx-d7f00f396e984d2 btn-primary",children:[f?(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,d.jsx)(i.Z,{size:16}),"Save"]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Load Balancing"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Strategy"}),(0,d.jsxs)("select",{value:N("load_balance_strategy"),onChange:e=>g("load_balance_strategy",e.target.value),className:"jsx-d7f00f396e984d2 select",children:[(0,d.jsx)("option",{value:"round_robin",className:"jsx-d7f00f396e984d2",children:"Round Robin"}),(0,d.jsx)("option",{value:"weighted",className:"jsx-d7f00f396e984d2",children:"Weighted"}),(0,d.jsx)("option",{value:"least_used",className:"jsx-d7f00f396e984d2",children:"Least Used"}),(0,d.jsx)("option",{value:"random",className:"jsx-d7f00f396e984d2",children:"Random"}),(0,d.jsx)("option",{value:"lowest_cost",className:"jsx-d7f00f396e984d2",children:"Lowest Cost"}),(0,d.jsx)("option",{value:"lowest_latency",className:"jsx-d7f00f396e984d2",children:"Lowest Latency"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Fallback Chains"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Auto-retry on failure"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_fallback"),onChange:e=>g("enable_fallback",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Retry Attempts"}),(0,d.jsx)("input",{type:"number",min:"1",max:"10",value:v("retry_attempts"),onChange:e=>g("retry_attempts",parseInt(e.target.value)||3),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Cooldown on Error (s)"}),(0,d.jsx)("input",{type:"number",value:v("cooldown_on_error_seconds"),onChange:e=>g("cooldown_on_error_seconds",parseInt(e.target.value)||60),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Request Timeout (s)"}),(0,d.jsx)("input",{type:"number",value:v("default_timeout_seconds"),onChange:e=>g("default_timeout_seconds",parseInt(e.target.value)||120),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Auto Model Selection"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Auto Selection"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Route to best model when model is empty"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_auto_model_selection"),onChange:e=>g("enable_auto_model_selection",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Strategy"}),(0,d.jsxs)("select",{value:N("auto_select_strategy"),onChange:e=>g("auto_select_strategy",e.target.value),className:"jsx-d7f00f396e984d2 select",children:[(0,d.jsx)("option",{value:"cheapest",className:"jsx-d7f00f396e984d2",children:"Cheapest"}),(0,d.jsx)("option",{value:"fastest",className:"jsx-d7f00f396e984d2",children:"Fastest"}),(0,d.jsx)("option",{value:"best_context",className:"jsx-d7f00f396e984d2",children:"Best Context Window"}),(0,d.jsx)("option",{value:"reasoning",className:"jsx-d7f00f396e984d2",children:"Best Reasoning"}),(0,d.jsx)("option",{value:"coding",className:"jsx-d7f00f396e984d2",children:"Best Coding"}),(0,d.jsx)("option",{value:"vision",className:"jsx-d7f00f396e984d2",children:"Best Vision"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"A/B Testing"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Auto-route to active A/B tests"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_ab_testing"),onChange:e=>g("enable_ab_testing",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Vision Routing"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Route image requests to vision-capable models"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_vision_routing"),onChange:e=>g("enable_vision_routing",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Function Validation"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Validate tool/function call schemas"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_function_validation"),onChange:e=>g("enable_function_validation",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Security"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Require Auth for Proxy"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Protect /v1/* with JWT or hub key"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("require_auth_for_proxy"),onChange:e=>g("require_auth_for_proxy",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Injection Detection"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Scan prompts for injection attempts"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_injection_detection"),onChange:e=>g("enable_injection_detection",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 label",children:["Block Threshold (0-1) ",(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 text-[var(--text-tertiary)] font-normal",children:"requests above this score are rejected"})]}),(0,d.jsx)("input",{type:"number",step:"0.05",min:"0",max:"1",value:_("injection_block_threshold"),onChange:e=>g("injection_block_threshold",parseFloat(e.target.value)||.7),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 label",children:["Flag Threshold (0-1) ",(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 text-[var(--text-tertiary)] font-normal",children:"requests above this score are logged"})]}),(0,d.jsx)("input",{type:"number",step:"0.05",min:"0",max:"1",value:_("injection_flag_threshold"),onChange:e=>g("injection_flag_threshold",parseFloat(e.target.value)||.4),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Response Filtering"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Filter/modify responses"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_response_filtering"),onChange:e=>g("enable_response_filtering",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Request Transforms"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Apply transformer rules to requests"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_request_transforms"),onChange:e=>g("enable_request_transforms",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Observability"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Request Logging"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Store all requests in database"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_request_logging"),onChange:e=>g("enable_request_logging",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Cost Tracking"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Estimate USD cost per request"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_cost_tracking"),onChange:e=>g("enable_cost_tracking",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Uptime Tracking"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Background provider health checks"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_uptime_tracking"),onChange:e=>g("enable_uptime_tracking",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Log Entries"}),(0,d.jsx)("input",{type:"number",value:v("max_log_entries"),onChange:e=>g("max_log_entries",parseInt(e.target.value)||1e4),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Uptime Check Interval (s)"}),(0,d.jsx)("input",{type:"number",value:v("uptime_check_interval"),onChange:e=>g("uptime_check_interval",parseInt(e.target.value)||300),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Spend Alert Threshold ($)"}),(0,d.jsx)("input",{type:"number",step:"0.01",value:_("spend_alert_threshold"),onChange:e=>g("spend_alert_threshold",parseFloat(e.target.value)||0),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Error Spike Threshold"}),(0,d.jsx)("input",{type:"number",value:v("error_spike_threshold"),onChange:e=>g("error_spike_threshold",parseInt(e.target.value)||0),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Error Spike Window (s)"}),(0,d.jsx)("input",{type:"number",value:v("error_spike_window_seconds"),onChange:e=>g("error_spike_window_seconds",parseInt(e.target.value)||60),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Caching"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Exact Cache"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Cache identical requests"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_exact_cache"),onChange:e=>g("enable_exact_cache",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Semantic Cache"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Cache semantically similar requests"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_semantic_cache"),onChange:e=>g("enable_semantic_cache",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Anthropic Cache"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Use Anthropic prompt caching"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_anthropic_cache"),onChange:e=>g("enable_anthropic_cache",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Cache TTL (s)"}),(0,d.jsx)("input",{type:"number",value:v("cache_ttl_seconds"),onChange:e=>g("cache_ttl_seconds",parseInt(e.target.value)||3600),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Web Search"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Web Search"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Allow :online suffix and auto web search"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_web_search"),onChange:e=>g("enable_web_search",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Search Provider"}),(0,d.jsxs)("select",{value:N("search_provider"),onChange:e=>g("search_provider",e.target.value),className:"jsx-d7f00f396e984d2 select",children:[(0,d.jsx)("option",{value:"",className:"jsx-d7f00f396e984d2",children:"None"}),(0,d.jsx)("option",{value:"tavily",className:"jsx-d7f00f396e984d2",children:"Tavily"}),(0,d.jsx)("option",{value:"brave",className:"jsx-d7f00f396e984d2",children:"Brave"}),(0,d.jsx)("option",{value:"searxng",className:"jsx-d7f00f396e984d2",children:"SearXNG"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Tavily API Key"}),(0,d.jsx)("input",{type:"password",value:N("search_tavily_key"),onChange:e=>g("search_tavily_key",e.target.value),placeholder:"sk-...",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Brave API Key"}),(0,d.jsx)("input",{type:"password",value:N("search_brave_key"),onChange:e=>g("search_brave_key",e.target.value),placeholder:"BSA...",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"SearXNG URL"}),(0,d.jsx)("input",{value:N("search_searxng_url"),onChange:e=>g("search_searxng_url",e.target.value),placeholder:"http://localhost:8888",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Results"}),(0,d.jsx)("input",{type:"number",value:v("search_max_results"),onChange:e=>g("search_max_results",parseInt(e.target.value)||5),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Code Interpreter"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Code Interpreter"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Allow :code suffix for code execution"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_code_interpreter"),onChange:e=>g("enable_code_interpreter",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Jupyter URL"}),(0,d.jsx)("input",{value:N("jupyter_url"),onChange:e=>g("jupyter_url",e.target.value),placeholder:"http://localhost:8888",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Jupyter Token"}),(0,d.jsx)("input",{type:"password",value:N("jupyter_token"),onChange:e=>g("jupyter_token",e.target.value),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Timeout (s)"}),(0,d.jsx)("input",{type:"number",value:v("jupyter_timeout_seconds"),onChange:e=>g("jupyter_timeout_seconds",parseInt(e.target.value)||60),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Iterations"}),(0,d.jsx)("input",{type:"number",value:v("code_interpreter_max_iterations"),onChange:e=>g("code_interpreter_max_iterations",parseInt(e.target.value)||3),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"RAG"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable RAG"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Retrieval-augmented generation"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_rag"),onChange:e=>g("enable_rag",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"RAG TTL (s)"}),(0,d.jsx)("input",{type:"number",value:v("rag_ttl_seconds"),onChange:e=>g("rag_ttl_seconds",parseInt(e.target.value)||3600),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Embedding Provider"}),(0,d.jsx)("input",{value:N("rag_embed_provider"),onChange:e=>g("rag_embed_provider",e.target.value),placeholder:"openai",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Embedding Model"}),(0,d.jsx)("input",{value:N("rag_embed_model"),onChange:e=>g("rag_embed_model",e.target.value),placeholder:"text-embedding-3-small",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Top K Results"}),(0,d.jsx)("input",{type:"number",value:v("rag_top_k"),onChange:e=>g("rag_top_k",parseInt(e.target.value)||3),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Conversation History"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Conversation History"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Store conversation context"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_conversation_history"),onChange:e=>g("enable_conversation_history",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Turns"}),(0,d.jsx)("input",{type:"number",value:v("conversation_max_turns"),onChange:e=>g("conversation_max_turns",parseInt(e.target.value)||10),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"TTL (s)"}),(0,d.jsx)("input",{type:"number",value:v("conversation_ttl_seconds"),onChange:e=>g("conversation_ttl_seconds",parseInt(e.target.value)||3600),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"General"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Hub Name"}),(0,d.jsx)("input",{value:N("hub_name"),onChange:e=>g("hub_name",e.target.value),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Model Catalog"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Auto-refresh model catalog"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_model_catalog"),onChange:e=>g("enable_model_catalog",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Catalog Refresh Interval (s)"}),(0,d.jsx)("input",{type:"number",value:v("catalog_refresh_interval"),onChange:e=>g("catalog_refresh_interval",parseInt(e.target.value)||86400),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Batch API"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Enable batch request processing"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_batch_api"),onChange:e=>g("enable_batch_api",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Batch Size"}),(0,d.jsx)("input",{type:"number",value:v("max_batch_size"),onChange:e=>g("max_batch_size",parseInt(e.target.value)||100),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Config Backup"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Auto-backup configuration"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_config_backup"),onChange:e=>g("enable_config_backup",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Public Status Page"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Allow unauthenticated uptime view"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("public_status_page"),onChange:e=>g("public_status_page",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Admin Username"}),(0,d.jsx)("input",{value:N("admin_username"),onChange:e=>g("admin_username",e.target.value),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsxs)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:[(0,d.jsx)(r.Z,{size:16})," Change Password"]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Current Password"}),(0,d.jsx)("input",{type:"password",value:h,onChange:e=>m(e.target.value),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 label",children:["New Password ",(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 text-[var(--text-tertiary)] font-normal",children:"min 6 chars"})]}),(0,d.jsx)("input",{type:"password",value:u,onChange:e=>p(e.target.value),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsx)("button",{onClick:k,className:"jsx-d7f00f396e984d2 btn-secondary justify-center w-full",children:"Update Password"})]})]})]}),j&&(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 toast",children:j}),(0,d.jsx)(t(),{id:"d7f00f396e984d2",children:'.t-title.jsx-d7f00f396e984d2{font-size:13px;font-weight:600}.t-sub.jsx-d7f00f396e984d2{font-size:11px;color:var(--text-tertiary);margin-top:2px}.toggle.jsx-d7f00f396e984d2{position:relative;width:40px;height:22px;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0}.toggle.jsx-d7f00f396e984d2 input.jsx-d7f00f396e984d2{opacity:0;width:0;height:0}.toggle-slider.jsx-d7f00f396e984d2{position:absolute;inset:0;background:var(--surface-100);-webkit-border-radius:22px;-moz-border-radius:22px;border-radius:22px;cursor:pointer;-webkit-transition:all.16s;-moz-transition:all.16s;-o-transition:all.16s;transition:all.16s;border:1px solid var(--border)}.toggle-slider.jsx-d7f00f396e984d2:before{content:"";position:absolute;left:3px;top:3px;width:14px;height:14px;background:var(--text-tertiary);-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;-webkit-transition:all.16s;-moz-transition:all.16s;-o-transition:all.16s;transition:all.16s}.toggle.jsx-d7f00f396e984d2 input.jsx-d7f00f396e984d2:checked+.toggle-slider.jsx-d7f00f396e984d2{background:rgba(59,130,246,.2);border-color:rgba(59,130,246,.4)}.toggle.jsx-d7f00f396e984d2 input.jsx-d7f00f396e984d2:checked+.toggle-slider.jsx-d7f00f396e984d2:before{background:var(--blue);-webkit-transform:translatex(18px);-moz-transform:translatex(18px);-ms-transform:translatex(18px);-o-transform:translatex(18px);transform:translatex(18px)}'})]})}},1837:function(e,s,a){"use strict";a.d(s,{KF:function(){return j},hi:function(){return x},jl:function(){return n},qz:function(){return t}});let d=a(257).env.NEXT_PUBLIC_API_BASE||"";function l(){return localStorage.getItem("nexus_token")}function t(){localStorage.removeItem("nexus_token")}function n(){return!!l()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},i=new Map,r=new Map;async function f(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=s.method||"GET",n=l(),f={"Content-Type":"application/json",...s.headers};if(n&&(f.Authorization="Bearer ".concat(n)),"GET"===a&&!n){let s=function(e){let s=i.get(e);if(s){if(Date.now()-s.ts>function(e){for(let s in c)if(e===s||e.startsWith(s+"/")||e.startsWith(s+"?"))return c[s];return 5e3}(e)){i.delete(e);return}return s.data}}(e);if(void 0!==s)return s;let a=r.get(e);if(a)return a}let x=(async()=>{let l=await fetch("".concat(d).concat(e),{method:a,headers:f,body:s.body?JSON.stringify(s.body):void 0});if(s.raw)return l;if(401===l.status&&n&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw t(),i.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!l.ok)throw Error((await l.json().catch(()=>({detail:l.statusText}))).detail||"HTTP ".concat(l.status));if(204===l.status)return;let c=await l.json();return"GET"!==a||n||function(e,s){if(i.size>=200){let e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(e,{ts:Date.now(),data:s})}(e,c),c})();if("GET"===a&&!n){r.set(e,x);try{return await x}finally{r.delete(e)}}return x}let x={get:e=>f(e),post:(e,s)=>f(e,{method:"POST",body:s}),put:(e,s)=>f(e,{method:"PUT",body:s}),patch:(e,s)=>f(e,{method:"PATCH",body:s}),delete:e=>f(e,{method:"DELETE"}),login:async(e,s)=>{var a;let d=await f("/api/auth/login",{method:"POST",body:{username:e,password:s}});return a=d.access_token,localStorage.setItem("nexus_token",a),d},getMe:()=>f("/api/auth/me"),logout:()=>{t(),i.clear(),window.location.href="/login"}},j=async e=>{let s=l(),a=await fetch("".concat(d).concat(e),{headers:s?{Authorization:"Bearer ".concat(s)}:{}});if(!a.ok)throw Error("Failed to download");let t=await a.blob(),n=URL.createObjectURL(t),c=document.createElement("a");c.href=n,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(n)}}},function(e){e.O(0,[4953,2971,2117,1744],function(){return e(e.s=3429)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/admin/page-048442296e23ef4d.js b/static/_next/static/chunks/app/admin/page-cc1da0c8bc82e2cd.js similarity index 92% rename from static/_next/static/chunks/app/admin/page-048442296e23ef4d.js rename to static/_next/static/chunks/app/admin/page-cc1da0c8bc82e2cd.js index 01490bc1a51d8dfc6d9db9017483425a0d164277..05736ce46c65b3885c4f73bbfb9ee9ce2c7286b0 100644 --- a/static/_next/static/chunks/app/admin/page-048442296e23ef4d.js +++ b/static/_next/static/chunks/app/admin/page-cc1da0c8bc82e2cd.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3],{3429:function(e,s,a){Promise.resolve().then(a.bind(a,6683))},6683:function(e,s,a){"use strict";a.r(s),a.d(s,{default:function(){return f}});var d=a(7437),l=a(29),t=a.n(l),n=a(2265),c=a(1837),i=a(3229),r=a(4001);function f(){let[e,s]=(0,n.useState)({}),[a,l]=(0,n.useState)(!0),[f,x]=(0,n.useState)(!1),[j,o]=(0,n.useState)(""),[h,m]=(0,n.useState)(""),[u,p]=(0,n.useState)("");(0,n.useEffect)(()=>{c.hi.get("/api/settings").then(e=>{s(e)}).finally(()=>l(!1))},[]);let g=(e,a)=>{s(s=>({...s,[e]:String(a)}))},b=s=>"true"===e[s],N=s=>e[s]||"",v=s=>parseInt(e[s])||0,_=s=>parseFloat(e[s])||0,y=async()=>{x(!0);try{await c.hi.put("/api/settings",e),o("Settings saved")}catch(e){o(e instanceof Error?e.message:"Failed")}finally{x(!1)}},k=async()=>{if(!h||!u||u.length<6){o("Both fields required, new password min 6 chars");return}try{await c.hi.post("/api/auth/change-password",{old_password:h,new_password:u}),o("Password changed"),m(""),p("")}catch(e){o(e instanceof Error?e.message:"Failed")}};return(n.useEffect(()=>{if(j){let e=setTimeout(()=>o(""),3e3);return()=>clearTimeout(e)}},[j]),a)?(0,d.jsx)("div",{className:"card",children:(0,d.jsx)("div",{className:"skeleton h-64 w-full"})}):(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 page-header",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("h1",{className:"jsx-d7f00f396e984d2 page-title",children:"Settings"}),(0,d.jsx)("p",{className:"jsx-d7f00f396e984d2 page-sub",children:"Gateway configuration"})]}),(0,d.jsxs)("button",{onClick:y,disabled:f,className:"jsx-d7f00f396e984d2 btn-primary",children:[f?(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,d.jsx)(i.Z,{size:16}),"Save"]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Load Balancing"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Strategy"}),(0,d.jsxs)("select",{value:N("load_balance_strategy"),onChange:e=>g("load_balance_strategy",e.target.value),className:"jsx-d7f00f396e984d2 select",children:[(0,d.jsx)("option",{value:"round_robin",className:"jsx-d7f00f396e984d2",children:"Round Robin"}),(0,d.jsx)("option",{value:"weighted",className:"jsx-d7f00f396e984d2",children:"Weighted"}),(0,d.jsx)("option",{value:"least_used",className:"jsx-d7f00f396e984d2",children:"Least Used"}),(0,d.jsx)("option",{value:"random",className:"jsx-d7f00f396e984d2",children:"Random"}),(0,d.jsx)("option",{value:"lowest_cost",className:"jsx-d7f00f396e984d2",children:"Lowest Cost"}),(0,d.jsx)("option",{value:"lowest_latency",className:"jsx-d7f00f396e984d2",children:"Lowest Latency"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Fallback Chains"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Auto-retry on failure"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_fallback"),onChange:e=>g("enable_fallback",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Retry Attempts"}),(0,d.jsx)("input",{type:"number",min:"1",max:"10",value:v("retry_attempts"),onChange:e=>g("retry_attempts",parseInt(e.target.value)||3),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Cooldown on Error (s)"}),(0,d.jsx)("input",{type:"number",value:v("cooldown_on_error_seconds"),onChange:e=>g("cooldown_on_error_seconds",parseInt(e.target.value)||60),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Request Timeout (s)"}),(0,d.jsx)("input",{type:"number",value:v("default_timeout_seconds"),onChange:e=>g("default_timeout_seconds",parseInt(e.target.value)||120),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Auto Model Selection"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Auto Selection"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Route to best model when model is empty"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_auto_model_selection"),onChange:e=>g("enable_auto_model_selection",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Strategy"}),(0,d.jsxs)("select",{value:N("auto_select_strategy"),onChange:e=>g("auto_select_strategy",e.target.value),className:"jsx-d7f00f396e984d2 select",children:[(0,d.jsx)("option",{value:"cheapest",className:"jsx-d7f00f396e984d2",children:"Cheapest"}),(0,d.jsx)("option",{value:"fastest",className:"jsx-d7f00f396e984d2",children:"Fastest"}),(0,d.jsx)("option",{value:"best_context",className:"jsx-d7f00f396e984d2",children:"Best Context Window"}),(0,d.jsx)("option",{value:"reasoning",className:"jsx-d7f00f396e984d2",children:"Best Reasoning"}),(0,d.jsx)("option",{value:"coding",className:"jsx-d7f00f396e984d2",children:"Best Coding"}),(0,d.jsx)("option",{value:"vision",className:"jsx-d7f00f396e984d2",children:"Best Vision"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"A/B Testing"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Auto-route to active A/B tests"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_ab_testing"),onChange:e=>g("enable_ab_testing",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Vision Routing"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Route image requests to vision-capable models"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_vision_routing"),onChange:e=>g("enable_vision_routing",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Function Validation"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Validate tool/function call schemas"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_function_validation"),onChange:e=>g("enable_function_validation",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Security"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Require Auth for Proxy"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Protect /v1/* with JWT or hub key"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("require_auth_for_proxy"),onChange:e=>g("require_auth_for_proxy",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Injection Detection"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Scan prompts for injection attempts"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_injection_detection"),onChange:e=>g("enable_injection_detection",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 label",children:["Block Threshold (0-1) ",(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 text-[var(--text-tertiary)] font-normal",children:"requests above this score are rejected"})]}),(0,d.jsx)("input",{type:"number",step:"0.05",min:"0",max:"1",value:_("injection_block_threshold"),onChange:e=>g("injection_block_threshold",parseFloat(e.target.value)||.7),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 label",children:["Flag Threshold (0-1) ",(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 text-[var(--text-tertiary)] font-normal",children:"requests above this score are logged"})]}),(0,d.jsx)("input",{type:"number",step:"0.05",min:"0",max:"1",value:_("injection_flag_threshold"),onChange:e=>g("injection_flag_threshold",parseFloat(e.target.value)||.4),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Response Filtering"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Filter/modify responses"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_response_filtering"),onChange:e=>g("enable_response_filtering",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Request Transforms"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Apply transformer rules to requests"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_request_transforms"),onChange:e=>g("enable_request_transforms",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Observability"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Request Logging"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Store all requests in database"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_request_logging"),onChange:e=>g("enable_request_logging",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Cost Tracking"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Estimate USD cost per request"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_cost_tracking"),onChange:e=>g("enable_cost_tracking",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Uptime Tracking"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Background provider health checks"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_uptime_tracking"),onChange:e=>g("enable_uptime_tracking",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Log Entries"}),(0,d.jsx)("input",{type:"number",value:v("max_log_entries"),onChange:e=>g("max_log_entries",parseInt(e.target.value)||1e4),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Uptime Check Interval (s)"}),(0,d.jsx)("input",{type:"number",value:v("uptime_check_interval"),onChange:e=>g("uptime_check_interval",parseInt(e.target.value)||300),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Spend Alert Threshold ($)"}),(0,d.jsx)("input",{type:"number",step:"0.01",value:_("spend_alert_threshold"),onChange:e=>g("spend_alert_threshold",parseFloat(e.target.value)||0),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Error Spike Threshold"}),(0,d.jsx)("input",{type:"number",value:v("error_spike_threshold"),onChange:e=>g("error_spike_threshold",parseInt(e.target.value)||0),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Error Spike Window (s)"}),(0,d.jsx)("input",{type:"number",value:v("error_spike_window_seconds"),onChange:e=>g("error_spike_window_seconds",parseInt(e.target.value)||60),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Caching"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Exact Cache"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Cache identical requests"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_exact_cache"),onChange:e=>g("enable_exact_cache",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Semantic Cache"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Cache semantically similar requests"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_semantic_cache"),onChange:e=>g("enable_semantic_cache",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Anthropic Cache"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Use Anthropic prompt caching"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_anthropic_cache"),onChange:e=>g("enable_anthropic_cache",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Cache TTL (s)"}),(0,d.jsx)("input",{type:"number",value:v("cache_ttl_seconds"),onChange:e=>g("cache_ttl_seconds",parseInt(e.target.value)||3600),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Web Search"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Web Search"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Allow :online suffix and auto web search"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_web_search"),onChange:e=>g("enable_web_search",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Search Provider"}),(0,d.jsxs)("select",{value:N("search_provider"),onChange:e=>g("search_provider",e.target.value),className:"jsx-d7f00f396e984d2 select",children:[(0,d.jsx)("option",{value:"",className:"jsx-d7f00f396e984d2",children:"None"}),(0,d.jsx)("option",{value:"tavily",className:"jsx-d7f00f396e984d2",children:"Tavily"}),(0,d.jsx)("option",{value:"brave",className:"jsx-d7f00f396e984d2",children:"Brave"}),(0,d.jsx)("option",{value:"searxng",className:"jsx-d7f00f396e984d2",children:"SearXNG"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Tavily API Key"}),(0,d.jsx)("input",{type:"password",value:N("search_tavily_key"),onChange:e=>g("search_tavily_key",e.target.value),placeholder:"sk-...",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Brave API Key"}),(0,d.jsx)("input",{type:"password",value:N("search_brave_key"),onChange:e=>g("search_brave_key",e.target.value),placeholder:"BSA...",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"SearXNG URL"}),(0,d.jsx)("input",{value:N("search_searxng_url"),onChange:e=>g("search_searxng_url",e.target.value),placeholder:"http://localhost:8888",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Results"}),(0,d.jsx)("input",{type:"number",value:v("search_max_results"),onChange:e=>g("search_max_results",parseInt(e.target.value)||5),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Code Interpreter"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Code Interpreter"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Allow :code suffix for code execution"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_code_interpreter"),onChange:e=>g("enable_code_interpreter",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Jupyter URL"}),(0,d.jsx)("input",{value:N("jupyter_url"),onChange:e=>g("jupyter_url",e.target.value),placeholder:"http://localhost:8888",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Jupyter Token"}),(0,d.jsx)("input",{type:"password",value:N("jupyter_token"),onChange:e=>g("jupyter_token",e.target.value),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Timeout (s)"}),(0,d.jsx)("input",{type:"number",value:v("jupyter_timeout_seconds"),onChange:e=>g("jupyter_timeout_seconds",parseInt(e.target.value)||60),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Iterations"}),(0,d.jsx)("input",{type:"number",value:v("code_interpreter_max_iterations"),onChange:e=>g("code_interpreter_max_iterations",parseInt(e.target.value)||3),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"RAG"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable RAG"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Retrieval-augmented generation"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_rag"),onChange:e=>g("enable_rag",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"RAG TTL (s)"}),(0,d.jsx)("input",{type:"number",value:v("rag_ttl_seconds"),onChange:e=>g("rag_ttl_seconds",parseInt(e.target.value)||3600),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Embedding Provider"}),(0,d.jsx)("input",{value:N("rag_embed_provider"),onChange:e=>g("rag_embed_provider",e.target.value),placeholder:"openai",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Embedding Model"}),(0,d.jsx)("input",{value:N("rag_embed_model"),onChange:e=>g("rag_embed_model",e.target.value),placeholder:"text-embedding-3-small",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Top K Results"}),(0,d.jsx)("input",{type:"number",value:v("rag_top_k"),onChange:e=>g("rag_top_k",parseInt(e.target.value)||3),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Conversation History"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Conversation History"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Store conversation context"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_conversation_history"),onChange:e=>g("enable_conversation_history",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Turns"}),(0,d.jsx)("input",{type:"number",value:v("conversation_max_turns"),onChange:e=>g("conversation_max_turns",parseInt(e.target.value)||10),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"TTL (s)"}),(0,d.jsx)("input",{type:"number",value:v("conversation_ttl_seconds"),onChange:e=>g("conversation_ttl_seconds",parseInt(e.target.value)||3600),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"General"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Hub Name"}),(0,d.jsx)("input",{value:N("hub_name"),onChange:e=>g("hub_name",e.target.value),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Model Catalog"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Auto-refresh model catalog"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_model_catalog"),onChange:e=>g("enable_model_catalog",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Catalog Refresh Interval (s)"}),(0,d.jsx)("input",{type:"number",value:v("catalog_refresh_interval"),onChange:e=>g("catalog_refresh_interval",parseInt(e.target.value)||86400),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Batch API"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Enable batch request processing"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_batch_api"),onChange:e=>g("enable_batch_api",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Batch Size"}),(0,d.jsx)("input",{type:"number",value:v("max_batch_size"),onChange:e=>g("max_batch_size",parseInt(e.target.value)||100),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Config Backup"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Auto-backup configuration"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_config_backup"),onChange:e=>g("enable_config_backup",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Public Status Page"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Allow unauthenticated uptime view"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("public_status_page"),onChange:e=>g("public_status_page",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Admin Username"}),(0,d.jsx)("input",{value:N("admin_username"),onChange:e=>g("admin_username",e.target.value),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsxs)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:[(0,d.jsx)(r.Z,{size:16})," Change Password"]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Current Password"}),(0,d.jsx)("input",{type:"password",value:h,onChange:e=>m(e.target.value),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 label",children:["New Password ",(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 text-[var(--text-tertiary)] font-normal",children:"min 6 chars"})]}),(0,d.jsx)("input",{type:"password",value:u,onChange:e=>p(e.target.value),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsx)("button",{onClick:k,className:"jsx-d7f00f396e984d2 btn-secondary justify-center w-full",children:"Update Password"})]})]})]}),j&&(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 toast",children:j}),(0,d.jsx)(t(),{id:"d7f00f396e984d2",children:'.t-title.jsx-d7f00f396e984d2{font-size:13px;font-weight:600}.t-sub.jsx-d7f00f396e984d2{font-size:11px;color:var(--text-tertiary);margin-top:2px}.toggle.jsx-d7f00f396e984d2{position:relative;width:40px;height:22px;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0}.toggle.jsx-d7f00f396e984d2 input.jsx-d7f00f396e984d2{opacity:0;width:0;height:0}.toggle-slider.jsx-d7f00f396e984d2{position:absolute;inset:0;background:var(--surface-100);-webkit-border-radius:22px;-moz-border-radius:22px;border-radius:22px;cursor:pointer;-webkit-transition:all.16s;-moz-transition:all.16s;-o-transition:all.16s;transition:all.16s;border:1px solid var(--border)}.toggle-slider.jsx-d7f00f396e984d2:before{content:"";position:absolute;left:3px;top:3px;width:14px;height:14px;background:var(--text-tertiary);-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;-webkit-transition:all.16s;-moz-transition:all.16s;-o-transition:all.16s;transition:all.16s}.toggle.jsx-d7f00f396e984d2 input.jsx-d7f00f396e984d2:checked+.toggle-slider.jsx-d7f00f396e984d2{background:rgba(59,130,246,.2);border-color:rgba(59,130,246,.4)}.toggle.jsx-d7f00f396e984d2 input.jsx-d7f00f396e984d2:checked+.toggle-slider.jsx-d7f00f396e984d2:before{background:var(--blue);-webkit-transform:translatex(18px);-moz-transform:translatex(18px);-ms-transform:translatex(18px);-o-transform:translatex(18px);transform:translatex(18px)}'})]})}},1837:function(e,s,a){"use strict";a.d(s,{KF:function(){return j},hi:function(){return x},jl:function(){return n},qz:function(){return t}});let d=a(257).env.NEXT_PUBLIC_API_BASE||"";function l(){return localStorage.getItem("nexus_token")}function t(){localStorage.removeItem("nexus_token")}function n(){return!!l()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},i=new Map,r=new Map;async function f(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=s.method||"GET",n=l(),f={"Content-Type":"application/json",...s.headers};if(n&&(f.Authorization="Bearer ".concat(n)),"GET"===a&&!n){let s=function(e){let s=i.get(e);if(s){if(Date.now()-s.ts>function(e){for(let s in c)if(e===s||e.startsWith(s+"/")||e.startsWith(s+"?"))return c[s];return 5e3}(e)){i.delete(e);return}return s.data}}(e);if(void 0!==s)return s;let a=r.get(e);if(a)return a}let x=(async()=>{let l=await fetch("".concat(d).concat(e),{method:a,headers:f,body:s.body?JSON.stringify(s.body):void 0});if(s.raw)return l;if(401===l.status&&n&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw t(),i.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!l.ok)throw Error((await l.json().catch(()=>({detail:l.statusText}))).detail||"HTTP ".concat(l.status));if(204===l.status)return;let c=await l.json();return"GET"!==a||n||function(e,s){if(i.size>=200){let e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(e,{ts:Date.now(),data:s})}(e,c),c})();if("GET"===a&&!n){r.set(e,x);try{return await x}finally{r.delete(e)}}return x}let x={get:e=>f(e),post:(e,s)=>f(e,{method:"POST",body:s}),put:(e,s)=>f(e,{method:"PUT",body:s}),patch:(e,s)=>f(e,{method:"PATCH",body:s}),delete:e=>f(e,{method:"DELETE"}),login:async(e,s)=>{var a;let d=await f("/api/auth/login",{method:"POST",body:{username:e,password:s}});return a=d.access_token,localStorage.setItem("nexus_token",a),d},getMe:()=>f("/api/auth/me"),logout:()=>{t(),i.clear(),window.location.href="/login"}},j=async e=>{let s=l(),a=await fetch("".concat(d).concat(e),{headers:s?{Authorization:"Bearer ".concat(s)}:{}});if(!a.ok)throw Error("Failed to download");let t=await a.blob(),n=URL.createObjectURL(t),c=document.createElement("a");c.href=n,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(n)}}},function(e){e.O(0,[4953,2971,2117,1744],function(){return e(e.s=3429)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3],{3429:function(e,s,a){Promise.resolve().then(a.bind(a,6683))},6683:function(e,s,a){"use strict";a.r(s),a.d(s,{default:function(){return f}});var d=a(7437),l=a(29),t=a.n(l),n=a(2265),c=a(1837),i=a(3229),r=a(4001);function f(){let[e,s]=(0,n.useState)({}),[a,l]=(0,n.useState)(!0),[f,x]=(0,n.useState)(!1),[j,o]=(0,n.useState)(""),[h,m]=(0,n.useState)(""),[u,p]=(0,n.useState)("");(0,n.useEffect)(()=>{c.hi.get("/api/settings").then(e=>{s(e)}).finally(()=>l(!1))},[]);let g=(e,a)=>{s(s=>({...s,[e]:String(a)}))},b=s=>"true"===e[s],N=s=>e[s]||"",v=s=>parseInt(e[s])||0,_=s=>parseFloat(e[s])||0,y=async()=>{x(!0);try{await c.hi.put("/api/settings",e),o("Settings saved")}catch(e){o(e instanceof Error?e.message:"Failed")}finally{x(!1)}},k=async()=>{if(!h||!u||u.length<6){o("Both fields required, new password min 6 chars");return}try{await c.hi.post("/api/auth/change-password",{old_password:h,new_password:u}),o("Password changed"),m(""),p("")}catch(e){o(e instanceof Error?e.message:"Failed")}};return(n.useEffect(()=>{if(j){let e=setTimeout(()=>o(""),3e3);return()=>clearTimeout(e)}},[j]),a)?(0,d.jsx)("div",{className:"card",children:(0,d.jsx)("div",{className:"skeleton h-64 w-full"})}):(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 page-header",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("h1",{className:"jsx-d7f00f396e984d2 page-title",children:"Settings"}),(0,d.jsx)("p",{className:"jsx-d7f00f396e984d2 page-sub",children:"Gateway configuration"})]}),(0,d.jsxs)("button",{onClick:y,disabled:f,className:"jsx-d7f00f396e984d2 btn-primary",children:[f?(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,d.jsx)(i.Z,{size:16}),"Save"]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Load Balancing"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Strategy"}),(0,d.jsxs)("select",{value:N("load_balance_strategy"),onChange:e=>g("load_balance_strategy",e.target.value),className:"jsx-d7f00f396e984d2 select",children:[(0,d.jsx)("option",{value:"round_robin",className:"jsx-d7f00f396e984d2",children:"Round Robin"}),(0,d.jsx)("option",{value:"weighted",className:"jsx-d7f00f396e984d2",children:"Weighted"}),(0,d.jsx)("option",{value:"least_used",className:"jsx-d7f00f396e984d2",children:"Least Used"}),(0,d.jsx)("option",{value:"random",className:"jsx-d7f00f396e984d2",children:"Random"}),(0,d.jsx)("option",{value:"lowest_cost",className:"jsx-d7f00f396e984d2",children:"Lowest Cost"}),(0,d.jsx)("option",{value:"lowest_latency",className:"jsx-d7f00f396e984d2",children:"Lowest Latency"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Fallback Chains"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Auto-retry on failure"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_fallback"),onChange:e=>g("enable_fallback",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Retry Attempts"}),(0,d.jsx)("input",{type:"number",min:"1",max:"10",value:v("retry_attempts"),onChange:e=>g("retry_attempts",parseInt(e.target.value)||3),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Cooldown on Error (s)"}),(0,d.jsx)("input",{type:"number",value:v("cooldown_on_error_seconds"),onChange:e=>g("cooldown_on_error_seconds",parseInt(e.target.value)||60),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Request Timeout (s)"}),(0,d.jsx)("input",{type:"number",value:v("default_timeout_seconds"),onChange:e=>g("default_timeout_seconds",parseInt(e.target.value)||120),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Auto Model Selection"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Auto Selection"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Route to best model when model is empty"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_auto_model_selection"),onChange:e=>g("enable_auto_model_selection",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Strategy"}),(0,d.jsxs)("select",{value:N("auto_select_strategy"),onChange:e=>g("auto_select_strategy",e.target.value),className:"jsx-d7f00f396e984d2 select",children:[(0,d.jsx)("option",{value:"cheapest",className:"jsx-d7f00f396e984d2",children:"Cheapest"}),(0,d.jsx)("option",{value:"fastest",className:"jsx-d7f00f396e984d2",children:"Fastest"}),(0,d.jsx)("option",{value:"best_context",className:"jsx-d7f00f396e984d2",children:"Best Context Window"}),(0,d.jsx)("option",{value:"reasoning",className:"jsx-d7f00f396e984d2",children:"Best Reasoning"}),(0,d.jsx)("option",{value:"coding",className:"jsx-d7f00f396e984d2",children:"Best Coding"}),(0,d.jsx)("option",{value:"vision",className:"jsx-d7f00f396e984d2",children:"Best Vision"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"A/B Testing"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Auto-route to active A/B tests"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_ab_testing"),onChange:e=>g("enable_ab_testing",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Vision Routing"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Route image requests to vision-capable models"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_vision_routing"),onChange:e=>g("enable_vision_routing",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Function Validation"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Validate tool/function call schemas"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_function_validation"),onChange:e=>g("enable_function_validation",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Security"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Require Auth for Proxy"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Protect /v1/* with JWT or hub key"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("require_auth_for_proxy"),onChange:e=>g("require_auth_for_proxy",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Injection Detection"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Scan prompts for injection attempts"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_injection_detection"),onChange:e=>g("enable_injection_detection",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 label",children:["Block Threshold (0-1) ",(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 text-[var(--text-tertiary)] font-normal",children:"requests above this score are rejected"})]}),(0,d.jsx)("input",{type:"number",step:"0.05",min:"0",max:"1",value:_("injection_block_threshold"),onChange:e=>g("injection_block_threshold",parseFloat(e.target.value)||.7),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 label",children:["Flag Threshold (0-1) ",(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 text-[var(--text-tertiary)] font-normal",children:"requests above this score are logged"})]}),(0,d.jsx)("input",{type:"number",step:"0.05",min:"0",max:"1",value:_("injection_flag_threshold"),onChange:e=>g("injection_flag_threshold",parseFloat(e.target.value)||.4),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Response Filtering"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Filter/modify responses"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_response_filtering"),onChange:e=>g("enable_response_filtering",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Request Transforms"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Apply transformer rules to requests"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_request_transforms"),onChange:e=>g("enable_request_transforms",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Observability"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Request Logging"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Store all requests in database"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_request_logging"),onChange:e=>g("enable_request_logging",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Cost Tracking"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Estimate USD cost per request"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_cost_tracking"),onChange:e=>g("enable_cost_tracking",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Uptime Tracking"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Background provider health checks"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_uptime_tracking"),onChange:e=>g("enable_uptime_tracking",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Log Entries"}),(0,d.jsx)("input",{type:"number",value:v("max_log_entries"),onChange:e=>g("max_log_entries",parseInt(e.target.value)||1e4),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Uptime Check Interval (s)"}),(0,d.jsx)("input",{type:"number",value:v("uptime_check_interval"),onChange:e=>g("uptime_check_interval",parseInt(e.target.value)||300),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Spend Alert Threshold ($)"}),(0,d.jsx)("input",{type:"number",step:"0.01",value:_("spend_alert_threshold"),onChange:e=>g("spend_alert_threshold",parseFloat(e.target.value)||0),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Error Spike Threshold"}),(0,d.jsx)("input",{type:"number",value:v("error_spike_threshold"),onChange:e=>g("error_spike_threshold",parseInt(e.target.value)||0),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Error Spike Window (s)"}),(0,d.jsx)("input",{type:"number",value:v("error_spike_window_seconds"),onChange:e=>g("error_spike_window_seconds",parseInt(e.target.value)||60),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Caching"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Exact Cache"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Cache identical requests"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_exact_cache"),onChange:e=>g("enable_exact_cache",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Semantic Cache"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Cache semantically similar requests"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_semantic_cache"),onChange:e=>g("enable_semantic_cache",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Anthropic Cache"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Use Anthropic prompt caching"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_anthropic_cache"),onChange:e=>g("enable_anthropic_cache",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Cache TTL (s)"}),(0,d.jsx)("input",{type:"number",value:v("cache_ttl_seconds"),onChange:e=>g("cache_ttl_seconds",parseInt(e.target.value)||3600),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Web Search"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Web Search"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Allow :online suffix and auto web search"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_web_search"),onChange:e=>g("enable_web_search",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Search Provider"}),(0,d.jsxs)("select",{value:N("search_provider"),onChange:e=>g("search_provider",e.target.value),className:"jsx-d7f00f396e984d2 select",children:[(0,d.jsx)("option",{value:"",className:"jsx-d7f00f396e984d2",children:"None"}),(0,d.jsx)("option",{value:"tavily",className:"jsx-d7f00f396e984d2",children:"Tavily"}),(0,d.jsx)("option",{value:"brave",className:"jsx-d7f00f396e984d2",children:"Brave"}),(0,d.jsx)("option",{value:"searxng",className:"jsx-d7f00f396e984d2",children:"SearXNG"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Tavily API Key"}),(0,d.jsx)("input",{type:"password",value:N("search_tavily_key"),onChange:e=>g("search_tavily_key",e.target.value),placeholder:"sk-...",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Brave API Key"}),(0,d.jsx)("input",{type:"password",value:N("search_brave_key"),onChange:e=>g("search_brave_key",e.target.value),placeholder:"BSA...",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"SearXNG URL"}),(0,d.jsx)("input",{value:N("search_searxng_url"),onChange:e=>g("search_searxng_url",e.target.value),placeholder:"http://localhost:8888",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Results"}),(0,d.jsx)("input",{type:"number",value:v("search_max_results"),onChange:e=>g("search_max_results",parseInt(e.target.value)||5),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Code Interpreter"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Code Interpreter"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Allow :code suffix for code execution"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_code_interpreter"),onChange:e=>g("enable_code_interpreter",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Jupyter URL"}),(0,d.jsx)("input",{value:N("jupyter_url"),onChange:e=>g("jupyter_url",e.target.value),placeholder:"http://localhost:8888",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Jupyter Token"}),(0,d.jsx)("input",{type:"password",value:N("jupyter_token"),onChange:e=>g("jupyter_token",e.target.value),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Timeout (s)"}),(0,d.jsx)("input",{type:"number",value:v("jupyter_timeout_seconds"),onChange:e=>g("jupyter_timeout_seconds",parseInt(e.target.value)||60),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Iterations"}),(0,d.jsx)("input",{type:"number",value:v("code_interpreter_max_iterations"),onChange:e=>g("code_interpreter_max_iterations",parseInt(e.target.value)||3),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"RAG"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable RAG"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Retrieval-augmented generation"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_rag"),onChange:e=>g("enable_rag",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"RAG TTL (s)"}),(0,d.jsx)("input",{type:"number",value:v("rag_ttl_seconds"),onChange:e=>g("rag_ttl_seconds",parseInt(e.target.value)||3600),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Embedding Provider"}),(0,d.jsx)("input",{value:N("rag_embed_provider"),onChange:e=>g("rag_embed_provider",e.target.value),placeholder:"openai",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Embedding Model"}),(0,d.jsx)("input",{value:N("rag_embed_model"),onChange:e=>g("rag_embed_model",e.target.value),placeholder:"text-embedding-3-small",className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Top K Results"}),(0,d.jsx)("input",{type:"number",value:v("rag_top_k"),onChange:e=>g("rag_top_k",parseInt(e.target.value)||3),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"Conversation History"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Enable Conversation History"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Store conversation context"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_conversation_history"),onChange:e=>g("enable_conversation_history",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Turns"}),(0,d.jsx)("input",{type:"number",value:v("conversation_max_turns"),onChange:e=>g("conversation_max_turns",parseInt(e.target.value)||10),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"TTL (s)"}),(0,d.jsx)("input",{type:"number",value:v("conversation_ttl_seconds"),onChange:e=>g("conversation_ttl_seconds",parseInt(e.target.value)||3600),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsx)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:"General"}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Hub Name"}),(0,d.jsx)("input",{value:N("hub_name"),onChange:e=>g("hub_name",e.target.value),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Model Catalog"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Auto-refresh model catalog"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_model_catalog"),onChange:e=>g("enable_model_catalog",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Catalog Refresh Interval (s)"}),(0,d.jsx)("input",{type:"number",value:v("catalog_refresh_interval"),onChange:e=>g("catalog_refresh_interval",parseInt(e.target.value)||86400),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Batch API"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Enable batch request processing"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_batch_api"),onChange:e=>g("enable_batch_api",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Max Batch Size"}),(0,d.jsx)("input",{type:"number",value:v("max_batch_size"),onChange:e=>g("max_batch_size",parseInt(e.target.value)||100),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Config Backup"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Auto-backup configuration"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("enable_config_backup"),onChange:e=>g("enable_config_backup",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-title",children:"Public Status Page"}),(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 t-sub",children:"Allow unauthenticated uptime view"})]}),(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 toggle",children:[(0,d.jsx)("input",{type:"checkbox",checked:b("public_status_page"),onChange:e=>g("public_status_page",e.target.checked),className:"jsx-d7f00f396e984d2"}),(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 toggle-slider"})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Admin Username"}),(0,d.jsx)("input",{value:N("admin_username"),onChange:e=>g("admin_username",e.target.value),className:"jsx-d7f00f396e984d2 input"})]})]})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 card",children:[(0,d.jsxs)("h2",{className:"jsx-d7f00f396e984d2 text-sm font-semibold mb-4",children:[(0,d.jsx)(r.Z,{size:16})," Change Password"]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2 space-y-4",children:[(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsx)("label",{className:"jsx-d7f00f396e984d2 label",children:"Current Password"}),(0,d.jsx)("input",{type:"password",value:h,onChange:e=>m(e.target.value),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsxs)("div",{className:"jsx-d7f00f396e984d2",children:[(0,d.jsxs)("label",{className:"jsx-d7f00f396e984d2 label",children:["New Password ",(0,d.jsx)("span",{className:"jsx-d7f00f396e984d2 text-[var(--text-tertiary)] font-normal",children:"min 6 chars"})]}),(0,d.jsx)("input",{type:"password",value:u,onChange:e=>p(e.target.value),className:"jsx-d7f00f396e984d2 input"})]}),(0,d.jsx)("button",{onClick:k,className:"jsx-d7f00f396e984d2 btn-secondary justify-center w-full",children:"Update Password"})]})]})]}),j&&(0,d.jsx)("div",{className:"jsx-d7f00f396e984d2 toast",children:j}),(0,d.jsx)(t(),{id:"d7f00f396e984d2",children:'.t-title.jsx-d7f00f396e984d2{font-size:13px;font-weight:600}.t-sub.jsx-d7f00f396e984d2{font-size:11px;color:var(--text-tertiary);margin-top:2px}.toggle.jsx-d7f00f396e984d2{position:relative;width:40px;height:22px;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0}.toggle.jsx-d7f00f396e984d2 input.jsx-d7f00f396e984d2{opacity:0;width:0;height:0}.toggle-slider.jsx-d7f00f396e984d2{position:absolute;inset:0;background:var(--surface-100);-webkit-border-radius:22px;-moz-border-radius:22px;border-radius:22px;cursor:pointer;-webkit-transition:all.16s;-moz-transition:all.16s;-o-transition:all.16s;transition:all.16s;border:1px solid var(--border)}.toggle-slider.jsx-d7f00f396e984d2:before{content:"";position:absolute;left:3px;top:3px;width:14px;height:14px;background:var(--text-tertiary);-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;-webkit-transition:all.16s;-moz-transition:all.16s;-o-transition:all.16s;transition:all.16s}.toggle.jsx-d7f00f396e984d2 input.jsx-d7f00f396e984d2:checked+.toggle-slider.jsx-d7f00f396e984d2{background:rgba(59,130,246,.2);border-color:rgba(59,130,246,.4)}.toggle.jsx-d7f00f396e984d2 input.jsx-d7f00f396e984d2:checked+.toggle-slider.jsx-d7f00f396e984d2:before{background:var(--blue);-webkit-transform:translatex(18px);-moz-transform:translatex(18px);-ms-transform:translatex(18px);-o-transform:translatex(18px);transform:translatex(18px)}'})]})}},1837:function(e,s,a){"use strict";a.d(s,{KF:function(){return j},hi:function(){return x},jl:function(){return n},qz:function(){return t}});let d=a(257).env.NEXT_PUBLIC_API_BASE||"";function l(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function t(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function n(){return!!l()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},i=new Map,r=new Map;async function f(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=s.method||"GET",n=l(),f={"Content-Type":"application/json",...s.headers};if(n&&(f.Authorization="Bearer ".concat(n)),"GET"===a&&!n){let s=function(e){let s=i.get(e);if(s){if(Date.now()-s.ts>function(e){for(let s in c)if(e===s||e.startsWith(s+"/")||e.startsWith(s+"?"))return c[s];return 5e3}(e)){i.delete(e);return}return s.data}}(e);if(void 0!==s)return s;let a=r.get(e);if(a)return a}let x=(async()=>{let l=await fetch("".concat(d).concat(e),{method:a,headers:f,body:s.body?JSON.stringify(s.body):void 0});if(s.raw)return l;if(401===l.status&&n&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw t(),i.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!l.ok)throw Error((await l.json().catch(()=>({detail:l.statusText}))).detail||"HTTP ".concat(l.status));if(204===l.status)return;let c=await l.json();return"GET"!==a||n||function(e,s){if(i.size>=200){let e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(e,{ts:Date.now(),data:s})}(e,c),c})();if("GET"===a&&!n){r.set(e,x);try{return await x}finally{r.delete(e)}}return x}let x={get:e=>f(e),post:(e,s)=>f(e,{method:"POST",body:s}),put:(e,s)=>f(e,{method:"PUT",body:s}),patch:(e,s)=>f(e,{method:"PATCH",body:s}),delete:e=>f(e,{method:"DELETE"}),login:async(e,s)=>{var a;let d=await f("/api/auth/login",{method:"POST",body:{username:e,password:s}});return a=d.access_token,localStorage.setItem("nexus_token",a),function(e,s,a){try{let a="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(s),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(a)}catch(e){}}("nexus_token",a,0),d},getMe:()=>f("/api/auth/me"),logout:()=>{t(),i.clear(),window.location.href="/login"}},j=async e=>{let s=l(),a=await fetch("".concat(d).concat(e),{headers:s?{Authorization:"Bearer ".concat(s)}:{}});if(!a.ok)throw Error("Failed to download");let t=await a.blob(),n=URL.createObjectURL(t),c=document.createElement("a");c.href=n,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(n)}}},function(e){e.O(0,[4953,2971,2117,1744],function(){return e(e.s=3429)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/agent/page-12f7d7e3790a2607.js b/static/_next/static/chunks/app/agent/page-12f7d7e3790a2607.js deleted file mode 100644 index 11a62c19995bfe204fe3142a36c7551dba022a2e..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/agent/page-12f7d7e3790a2607.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2060],{9763:function(e,t,r){Promise.resolve().then(r.bind(r,5126))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var a=r(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,a.forwardRef)((e,t)=>{let{color:r="currentColor",size:s=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...i,width:s,height:s,stroke:r,strokeWidth:c?24*Number(l)/Number(s):l,className:n("lucide",o),...h},[...u.map(e=>{let[t,r]=e;return(0,a.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let r=(0,a.forwardRef)((r,i)=>{let{className:c,...o}=r;return(0,a.createElement)(l,{ref:i,iconNode:t,className:n("lucide-".concat(s(e)),c),...o})});return r.displayName="".concat(e),r}},2222:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])},875:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},9388:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},2208:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},4001:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},3417:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},9397:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7168:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},4743:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},2023:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]])},8930:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},2489:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},257:function(e,t,r){"use strict";var a,s;e.exports=(null==(a=r.g.process)?void 0:a.env)&&"object"==typeof(null==(s=r.g.process)?void 0:s.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,a,s=e.exports={};function n(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===n||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:n}catch(e){t=n}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var c=[],o=!1,d=-1;function u(){o&&a&&(o=!1,a.length?c=a.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(a=c,c=[];++d1)for(var r=1;rn(e=>!e),className:"w-full flex items-center gap-2 px-3 py-2 text-left text-xs hover:bg-[var(--surface-100)]",children:[i?t.ok?(0,a.jsx)(l,{size:14,className:"text-emerald-400 shrink-0"}):(0,a.jsx)(c.Z,{size:14,className:"text-red-400 shrink-0"}):(0,a.jsx)(o,{size:14,className:"text-blue-400 shrink-0"}),(0,a.jsx)("span",{className:"font-mono text-[var(--text-secondary)]",children:t.name}),(0,a.jsx)("span",{className:"text-[var(--text-tertiary)] truncate flex-1",children:i?t.summary:t.args_display}),r?(0,a.jsx)(d.Z,{size:12}):(0,a.jsx)(u,{size:12})]}),r&&(0,a.jsx)("div",{className:"px-3 py-2 border-t border-[var(--border)] bg-[var(--bg)] text-xs font-mono whitespace-pre-wrap break-all",children:i?t.summary:t.args_display})]})}),z=s.memo(function(e){var t;let{schema:r,onSubmit:n,onCancel:i}=e,[l,c]=(0,s.useState)(!1),[o,d]=(0,s.useState)(()=>{let e={};for(let t of r.fields||[])e[t.name]="";return e}),u=null===(t=r.fields)||void 0===t?void 0:t[0],v=(null==u?void 0:u.type)==="password",y=u&&o[u.name]||"",g=!(null==u?void 0:u.required)||y.length>=(u.minLength||0);return(0,a.jsxs)("div",{className:"my-3 rounded-lg border-2 border-[var(--accent)] bg-[var(--surface)] p-4 shadow-lg",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 mb-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-lg bg-[var(--accent)]/20 flex items-center justify-center shrink-0",children:v?(0,a.jsx)(h.Z,{size:20,className:"text-[var(--accent)]"}):(0,a.jsx)(x,{size:20,className:"text-[var(--accent)]"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:r.title}),(0,a.jsx)("p",{className:"text-xs text-[var(--text-secondary)] mt-1",children:r.description})]}),(0,a.jsx)("button",{onClick:i,className:"text-[var(--text-tertiary)] hover:text-white p-1","aria-label":"Cancel",children:(0,a.jsx)(m.Z,{size:16})})]}),u&&(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsxs)("label",{className:"text-xs font-medium text-[var(--text-secondary)] mb-1 block",children:[u.label,u.required&&(0,a.jsx)("span",{className:"text-red-400 ml-1",children:"*"})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:v&&!l?"password":"text",value:y,onChange:e=>d(t=>({...t,[u.name]:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&g&&n(o),"Escape"===e.key&&i()},autoFocus:!0,autoComplete:"off",spellCheck:!1,className:"w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-3 py-2 pr-10 text-sm font-mono focus:outline-none focus:border-[var(--accent)]",placeholder:"••••••••"}),v&&(0,a.jsx)("button",{type:"button",onClick:()=>c(e=>!e),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)] hover:text-white p-1","aria-label":l?"Hide":"Show",children:l?(0,a.jsx)(f,{size:14}):(0,a.jsx)(p.Z,{size:14})})]}),v&&(0,a.jsxs)("p",{className:"text-[10px] text-[var(--text-tertiary)] mt-1 flex items-center gap-1",children:[(0,a.jsx)(x,{size:10}),"Sent directly to gateway — never appears in chat history or LLM context"]})]}),(0,a.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,a.jsx)("button",{onClick:i,className:"px-3 py-1.5 text-xs rounded-md border border-[var(--border)] hover:bg-[var(--surface-100)]",children:"Cancel"}),(0,a.jsx)("button",{onClick:()=>n(o),disabled:!g,className:"px-3 py-1.5 text-xs rounded-md bg-[var(--accent)] text-white font-medium disabled:opacity-50 hover:opacity-90",children:r.submit_label||"Submit"})]})]})}),E=s.memo(function(e){let{schema:t,onConfirm:r,onCancel:s}=e;return(0,a.jsxs)("div",{className:"my-3 rounded-lg border-2 border-yellow-500/50 bg-[var(--surface)] p-4 shadow-lg",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 mb-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-lg bg-yellow-500/20 flex items-center justify-center shrink-0",children:(0,a.jsx)(v.Z,{size:20,className:"text-yellow-400"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:t.title}),(0,a.jsx)("p",{className:"text-xs text-[var(--text-secondary)] mt-1",children:t.description})]})]}),(0,a.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,a.jsx)("button",{onClick:s,className:"px-3 py-1.5 text-xs rounded-md border border-[var(--border)] hover:bg-[var(--surface-100)]",children:"Cancel"}),(0,a.jsx)("button",{onClick:r,className:"px-3 py-1.5 text-xs rounded-md text-white font-medium hover:opacity-90 ".concat(t.danger?"bg-red-500":"bg-[var(--accent)]"),children:t.confirm_label||"Confirm"})]})]})}),M=s.memo(function(e){let{role:t,content:r,transcript:s}=e,n="user"===t;return(0,a.jsxs)("div",{className:"flex gap-3 ".concat(n?"justify-end":"justify-start"),children:[!n&&(0,a.jsx)("div",{className:"w-7 h-7 rounded-lg bg-gradient-to-br from-[var(--accent)] to-nexus-400 flex items-center justify-center shrink-0",children:(0,a.jsx)(y.Z,{size:14,className:"text-white"})}),(0,a.jsxs)("div",{className:"max-w-[80%] ".concat(n?"order-1":""),children:[s&&s.length>0&&(0,a.jsx)("div",{className:"mb-2",children:s.map((e,t)=>(0,a.jsx)(Z,{item:e},t))}),r&&(0,a.jsx)("div",{className:"rounded-2xl px-4 py-2.5 text-sm leading-relaxed ".concat(n?"bg-[var(--accent)] text-white whitespace-pre-wrap":"bg-[var(--surface-100)] text-[var(--text)] whitespace-pre-wrap"),children:r})]}),n&&(0,a.jsx)("div",{className:"w-7 h-7 rounded-lg bg-[var(--surface-200)] flex items-center justify-center shrink-0 text-xs font-semibold order-2",children:"U"})]})});function T(){let[e,t]=(0,s.useState)([]),[r,i]=(0,s.useState)(null),[l,c]=(0,s.useState)([]),[o,d]=(0,s.useState)(""),[u,h]=(0,s.useState)(!1),[x,f]=(0,s.useState)([]),[p,Z]=(0,s.useState)(""),[T,S]=(0,s.useState)(null),[_,A]=(0,s.useState)(null),[L,q]=(0,s.useState)(""),P=(0,s.useRef)(null),O=(0,s.useRef)(null),R=(0,s.useMemo)(()=>e.find(e=>e.id===r)||null,[e,r]),D=(0,s.useCallback)(async()=>{try{let e=await n.hi.get("/api/agent/conversations");t(e.conversations||[])}catch(e){console.error(e)}},[]),H=(0,s.useCallback)(async e=>{try{let t=((await n.hi.get("/api/agent/conversations/".concat(e))).messages||[]).map(e=>{let t=[];for(let s of e.tool_calls||[]){var r,a;let e=(null===(r=s.function)||void 0===r?void 0:r.name)||"tool",n={};try{n=JSON.parse((null===(a=s.function)||void 0===a?void 0:a.arguments)||"{}")}catch(e){}t.push({type:"tool_call",name:e,args_display:"".concat(e,"(").concat(Object.entries(n).map(e=>{let[t,r]=e;return"".concat(t,"=").concat(JSON.stringify(r))}).join(", "),")"),tool_call_id:s.id})}return{role:e.role,content:e.content||"",transcript:t.length?t:void 0}});c(t)}catch(e){console.error(e),c([])}},[]);(0,s.useEffect)(()=>{D(),n.hi.get("/api/agent/models").then(e=>{var t;f(e.models||[]),(null===(t=e.models)||void 0===t?void 0:t[0])&&Z(e.models[0])}).catch(()=>{})},[D]),(0,s.useEffect)(()=>{r?H(r):c([])},[r,H]),(0,s.useEffect)(()=>{let e=P.current;e&&(e.scrollTop=e.scrollHeight)},[l,T,_]);let F=(0,s.useCallback)(async()=>{try{let e=await n.hi.post("/api/agent/conversations",{model:p});await D(),i(e.id),c([]),S(null),A(null)}catch(e){q(e instanceof Error?e.message:"Failed to create conversation")}},[p,D]),I=(0,s.useCallback)(async e=>{if(confirm("Delete this conversation?"))try{await n.hi.delete("/api/agent/conversations/".concat(e)),r===e&&i(null),await D()}catch(e){q(e instanceof Error?e.message:"Failed to delete")}},[r,D]),U=(0,s.useCallback)(async()=>{let e=o.trim();if(e&&!u&&r){d(""),q(""),h(!0),c(t=>[...t,{role:"user",content:e}]);try{let t=await n.hi.post("/api/agent/conversations/".concat(r,"/message"),{message:e,model:p||void 0});B(t)}catch(e){q(e instanceof Error?e.message:"Request failed"),c(e=>[...e,{role:"assistant",content:"❌ Request failed. Check the error above."}])}finally{var t;h(!1),null===(t=O.current)||void 0===t||t.focus()}}},[o,u,r,p]),B=(0,s.useCallback)(e=>{if("error"===e.status){q(e.error||"Unknown error"),c(t=>[...t,{role:"assistant",content:"❌ ".concat(e.error||"Unknown error")}]);return}if("needs_input"===e.status&&e.form_schema){S({schema:e.form_schema,calls:e.pending_calls||[]}),c(t=>[...t,{role:"assistant",content:"",transcript:e.transcript}]);return}if("needs_confirm"===e.status&&e.confirm_schema){A({schema:e.confirm_schema,calls:e.pending_calls||[]}),c(t=>[...t,{role:"assistant",content:"",transcript:e.transcript}]);return}c(t=>[...t,{role:"assistant",content:e.message||"(no response)",transcript:e.transcript}])},[]),K=(0,s.useCallback)(async e=>{if(!T||!r)return;h(!0),q("");let t=T.calls;S(null);try{let a=await n.hi.post("/api/agent/conversations/".concat(r,"/continue"),{pending_calls:t,form_data:e});B(a)}catch(e){q(e instanceof Error?e.message:"Failed to submit")}finally{h(!1)}},[T,r,B]),W=(0,s.useCallback)(async()=>{if(!_||!r)return;h(!0),q("");let e=_.calls;A(null);try{let t=await n.hi.post("/api/agent/conversations/".concat(r,"/continue"),{pending_calls:e,confirmed:!0});B(t)}catch(e){q(e instanceof Error?e.message:"Failed to confirm")}finally{h(!1)}},[_,r,B]),G=(0,s.useCallback)(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),U())},[U]);return(0,a.jsxs)("div",{className:"flex h-[calc(100vh-3rem)] -m-6 lg:-m-8",children:[(0,a.jsxs)("aside",{className:"w-64 border-r border-[var(--border)] bg-[var(--surface)] flex flex-col shrink-0",children:[(0,a.jsx)("div",{className:"p-3 border-b border-[var(--border)]",children:(0,a.jsxs)("button",{onClick:F,className:"w-full flex items-center justify-center gap-2 bg-[var(--accent)] hover:opacity-90 text-white text-sm font-medium py-2 rounded-lg",children:[(0,a.jsx)(g.Z,{size:16}),"New conversation"]})}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:0===e.length?(0,a.jsxs)("div",{className:"text-center text-xs text-[var(--text-tertiary)] py-8 px-3",children:["No conversations yet.",(0,a.jsx)("br",{}),"Click ",(0,a.jsx)("span",{className:"text-[var(--accent)]",children:"+"})," to start."]}):e.map(e=>(0,a.jsxs)("div",{className:"group flex items-center gap-2 px-2 py-2 rounded-md cursor-pointer text-sm ".concat(r===e.id?"bg-[var(--surface-100)] text-white":"hover:bg-[var(--surface-50)] text-[var(--text-secondary)]"),onClick:()=>i(e.id),children:[(0,a.jsx)(b.Z,{size:14,className:"shrink-0"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"truncate text-xs font-medium",children:e.title}),(0,a.jsxs)("div",{className:"text-[10px] text-[var(--text-tertiary)] truncate",children:[e.model?e.model.split("/").pop():"no model"," \xb7 ",function(e){if(!e)return"";try{let t=new Date(e.replace(" ","T")+(e.includes("Z")?"":"Z")).getTime(),r=Date.now()-t;if(r<6e4)return"just now";if(r<36e5)return Math.floor(r/6e4)+"m ago";if(r<864e5)return Math.floor(r/36e5)+"h ago";return Math.floor(r/864e5)+"d ago"}catch(e){return""}}(e.updated_at)]})]}),(0,a.jsx)("button",{onClick:t=>{t.stopPropagation(),I(e.id)},className:"opacity-0 group-hover:opacity-100 text-[var(--text-tertiary)] hover:text-red-400 p-1","aria-label":"Delete",children:(0,a.jsx)(j.Z,{size:12})})]},e.id))}),(0,a.jsx)("div",{className:"p-3 border-t border-[var(--border)] text-[10px] text-[var(--text-tertiary)]",children:x.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-1",children:"Powered by"}),(0,a.jsx)("select",{value:p,onChange:e=>Z(e.target.value),className:"w-full bg-[var(--bg)] border border-[var(--border)] rounded px-2 py-1 text-xs",children:x.map(e=>(0,a.jsx)("option",{value:e,children:e},e))})]}):(0,a.jsxs)("div",{className:"text-yellow-400",children:["No active provider keys. Add one in ",(0,a.jsx)("span",{className:"font-mono",children:"Provider Keys"})," to power the agent."]})})]}),(0,a.jsxs)("main",{className:"flex-1 flex flex-col bg-[var(--bg)] min-w-0",children:[(0,a.jsxs)("header",{className:"border-b border-[var(--border)] px-4 py-3 flex items-center gap-3 bg-[var(--surface)]",children:[(0,a.jsx)(k.Z,{size:20,className:"text-[var(--accent)]"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h1",{className:"text-sm font-semibold truncate",children:(null==R?void 0:R.title)||"NexusAgent"}),(0,a.jsxs)("p",{className:"text-[10px] text-[var(--text-tertiary)]",children:["AI agent \xb7 ",p||"no model selected"," \xb7 secrets stay secret"]})]}),r&&(0,a.jsx)("button",{onClick:()=>H(r),className:"text-[var(--text-tertiary)] hover:text-white p-2",title:"Reload conversation",children:(0,a.jsx)(w.Z,{size:14})})]}),(0,a.jsx)("div",{ref:P,className:"flex-1 overflow-y-auto p-4 space-y-4",children:r?0===l.length?(0,a.jsx)("div",{className:"text-center text-sm text-[var(--text-tertiary)] py-12",children:"Send a message to start."}):(0,a.jsxs)(a.Fragment,{children:[l.map((e,t)=>(0,a.jsx)(M,{role:e.role,content:e.content,transcript:e.transcript},t)),T&&(0,a.jsx)(z,{schema:T.schema,onSubmit:K,onCancel:()=>S(null)}),_&&(0,a.jsx)(E,{schema:_.schema,onConfirm:W,onCancel:()=>A(null)}),u&&(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)("div",{className:"w-7 h-7 rounded-lg bg-gradient-to-br from-[var(--accent)] to-nexus-400 flex items-center justify-center shrink-0",children:(0,a.jsx)(y.Z,{size:14,className:"text-white"})}),(0,a.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-2xl px-4 py-2.5 flex items-center gap-2 text-sm text-[var(--text-secondary)]",children:[(0,a.jsx)(N,{size:14,className:"animate-spin"}),(0,a.jsx)("span",{children:"Agent is thinking…"})]})]})]}):(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-center max-w-md mx-auto",children:[(0,a.jsx)("div",{className:"w-14 h-14 rounded-2xl bg-gradient-to-br from-[var(--accent)] to-nexus-400 flex items-center justify-center mb-4",children:(0,a.jsx)(k.Z,{size:28,className:"text-white"})}),(0,a.jsx)("h2",{className:"text-lg font-semibold mb-2",children:"NexusAgent"}),(0,a.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-6",children:"An AI agent that can manage your gateway directly. Ask it to add API keys, test models, create aliases, inspect stats — anything."}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 w-full text-left",children:["Add my Gemini key and test it","Show me the slowest models",'Create an alias "fast" → gpt-4o-mini',"Why are my requests failing?"].map(e=>(0,a.jsx)("button",{onClick:()=>{F().then(()=>{d(e)})},className:"text-xs text-left px-3 py-2 rounded-lg border border-[var(--border)] hover:border-[var(--accent)] text-[var(--text-secondary)] hover:text-white",children:e},e))})]})}),L&&(0,a.jsxs)("div",{className:"mx-4 mb-2 px-3 py-2 rounded-lg bg-red-500/10 border border-red-500/30 text-xs text-red-300 flex items-start gap-2",children:[(0,a.jsx)(v.Z,{size:14,className:"shrink-0 mt-0.5"}),(0,a.jsx)("span",{className:"flex-1",children:L}),(0,a.jsx)("button",{onClick:()=>q(""),className:"text-red-300/60 hover:text-red-300",children:(0,a.jsx)(m.Z,{size:12})})]}),(0,a.jsxs)("div",{className:"border-t border-[var(--border)] p-4 bg-[var(--surface)]",children:[(0,a.jsxs)("div",{className:"flex items-end gap-2 max-w-4xl mx-auto",children:[(0,a.jsx)("textarea",{ref:O,value:o,onChange:e=>d(e.target.value),onKeyDown:G,placeholder:r?"Tell the agent what to do…":"Click + to start a new conversation",disabled:!r||u,rows:1,className:"flex-1 bg-[var(--bg)] border border-[var(--border)] rounded-xl px-4 py-3 text-sm resize-none focus:outline-none focus:border-[var(--accent)] disabled:opacity-50",style:{minHeight:44,maxHeight:160}}),(0,a.jsx)("button",{onClick:U,disabled:!r||u||!o.trim(),className:"bg-[var(--accent)] hover:opacity-90 text-white p-3 rounded-xl disabled:opacity-30","aria-label":"Send",children:(0,a.jsx)(C.Z,{size:16})})]}),(0,a.jsx)("p",{className:"text-[10px] text-center text-[var(--text-tertiary)] mt-2",children:"Enter to send \xb7 Shift+Enter for newline \xb7 API keys are entered via secure form, never in chat"})]})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return n}});let a=r(257).env.NEXT_PUBLIC_API_BASE||"";function s(){return localStorage.getItem("nexus_token")}function n(){localStorage.removeItem("nexus_token")}function i(){return!!s()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=s(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let u=(async()=>{let s=await fetch("".concat(a).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw n(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let l=await s.json();return"GET"!==r||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===r&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=a.access_token,localStorage.setItem("nexus_token",r),a},getMe:()=>d("/api/auth/me"),logout:()=>{n(),c.clear(),window.location.href="/login"}},h=async e=>{let t=s(),r=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let n=await r.blob(),i=URL.createObjectURL(n),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=9763)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/agent/page-3e623457abaac9ba.js b/static/_next/static/chunks/app/agent/page-a263a79fd957da1d.js similarity index 60% rename from static/_next/static/chunks/app/agent/page-3e623457abaac9ba.js rename to static/_next/static/chunks/app/agent/page-a263a79fd957da1d.js index 11a62c19995bfe204fe3142a36c7551dba022a2e..e10249fd8f503715b4556217334f215ea16ca10d 100644 --- a/static/_next/static/chunks/app/agent/page-3e623457abaac9ba.js +++ b/static/_next/static/chunks/app/agent/page-a263a79fd957da1d.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2060],{9763:function(e,t,r){Promise.resolve().then(r.bind(r,5126))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var a=r(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,a.forwardRef)((e,t)=>{let{color:r="currentColor",size:s=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...i,width:s,height:s,stroke:r,strokeWidth:c?24*Number(l)/Number(s):l,className:n("lucide",o),...h},[...u.map(e=>{let[t,r]=e;return(0,a.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let r=(0,a.forwardRef)((r,i)=>{let{className:c,...o}=r;return(0,a.createElement)(l,{ref:i,iconNode:t,className:n("lucide-".concat(s(e)),c),...o})});return r.displayName="".concat(e),r}},2222:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])},875:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},9388:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},2208:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},4001:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},3417:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},9397:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7168:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},4743:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},2023:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]])},8930:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},2489:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},257:function(e,t,r){"use strict";var a,s;e.exports=(null==(a=r.g.process)?void 0:a.env)&&"object"==typeof(null==(s=r.g.process)?void 0:s.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,a,s=e.exports={};function n(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===n||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:n}catch(e){t=n}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var c=[],o=!1,d=-1;function u(){o&&a&&(o=!1,a.length?c=a.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(a=c,c=[];++d1)for(var r=1;rn(e=>!e),className:"w-full flex items-center gap-2 px-3 py-2 text-left text-xs hover:bg-[var(--surface-100)]",children:[i?t.ok?(0,a.jsx)(l,{size:14,className:"text-emerald-400 shrink-0"}):(0,a.jsx)(c.Z,{size:14,className:"text-red-400 shrink-0"}):(0,a.jsx)(o,{size:14,className:"text-blue-400 shrink-0"}),(0,a.jsx)("span",{className:"font-mono text-[var(--text-secondary)]",children:t.name}),(0,a.jsx)("span",{className:"text-[var(--text-tertiary)] truncate flex-1",children:i?t.summary:t.args_display}),r?(0,a.jsx)(d.Z,{size:12}):(0,a.jsx)(u,{size:12})]}),r&&(0,a.jsx)("div",{className:"px-3 py-2 border-t border-[var(--border)] bg-[var(--bg)] text-xs font-mono whitespace-pre-wrap break-all",children:i?t.summary:t.args_display})]})}),z=s.memo(function(e){var t;let{schema:r,onSubmit:n,onCancel:i}=e,[l,c]=(0,s.useState)(!1),[o,d]=(0,s.useState)(()=>{let e={};for(let t of r.fields||[])e[t.name]="";return e}),u=null===(t=r.fields)||void 0===t?void 0:t[0],v=(null==u?void 0:u.type)==="password",y=u&&o[u.name]||"",g=!(null==u?void 0:u.required)||y.length>=(u.minLength||0);return(0,a.jsxs)("div",{className:"my-3 rounded-lg border-2 border-[var(--accent)] bg-[var(--surface)] p-4 shadow-lg",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 mb-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-lg bg-[var(--accent)]/20 flex items-center justify-center shrink-0",children:v?(0,a.jsx)(h.Z,{size:20,className:"text-[var(--accent)]"}):(0,a.jsx)(x,{size:20,className:"text-[var(--accent)]"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:r.title}),(0,a.jsx)("p",{className:"text-xs text-[var(--text-secondary)] mt-1",children:r.description})]}),(0,a.jsx)("button",{onClick:i,className:"text-[var(--text-tertiary)] hover:text-white p-1","aria-label":"Cancel",children:(0,a.jsx)(m.Z,{size:16})})]}),u&&(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsxs)("label",{className:"text-xs font-medium text-[var(--text-secondary)] mb-1 block",children:[u.label,u.required&&(0,a.jsx)("span",{className:"text-red-400 ml-1",children:"*"})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:v&&!l?"password":"text",value:y,onChange:e=>d(t=>({...t,[u.name]:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&g&&n(o),"Escape"===e.key&&i()},autoFocus:!0,autoComplete:"off",spellCheck:!1,className:"w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-3 py-2 pr-10 text-sm font-mono focus:outline-none focus:border-[var(--accent)]",placeholder:"••••••••"}),v&&(0,a.jsx)("button",{type:"button",onClick:()=>c(e=>!e),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)] hover:text-white p-1","aria-label":l?"Hide":"Show",children:l?(0,a.jsx)(f,{size:14}):(0,a.jsx)(p.Z,{size:14})})]}),v&&(0,a.jsxs)("p",{className:"text-[10px] text-[var(--text-tertiary)] mt-1 flex items-center gap-1",children:[(0,a.jsx)(x,{size:10}),"Sent directly to gateway — never appears in chat history or LLM context"]})]}),(0,a.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,a.jsx)("button",{onClick:i,className:"px-3 py-1.5 text-xs rounded-md border border-[var(--border)] hover:bg-[var(--surface-100)]",children:"Cancel"}),(0,a.jsx)("button",{onClick:()=>n(o),disabled:!g,className:"px-3 py-1.5 text-xs rounded-md bg-[var(--accent)] text-white font-medium disabled:opacity-50 hover:opacity-90",children:r.submit_label||"Submit"})]})]})}),E=s.memo(function(e){let{schema:t,onConfirm:r,onCancel:s}=e;return(0,a.jsxs)("div",{className:"my-3 rounded-lg border-2 border-yellow-500/50 bg-[var(--surface)] p-4 shadow-lg",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 mb-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-lg bg-yellow-500/20 flex items-center justify-center shrink-0",children:(0,a.jsx)(v.Z,{size:20,className:"text-yellow-400"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:t.title}),(0,a.jsx)("p",{className:"text-xs text-[var(--text-secondary)] mt-1",children:t.description})]})]}),(0,a.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,a.jsx)("button",{onClick:s,className:"px-3 py-1.5 text-xs rounded-md border border-[var(--border)] hover:bg-[var(--surface-100)]",children:"Cancel"}),(0,a.jsx)("button",{onClick:r,className:"px-3 py-1.5 text-xs rounded-md text-white font-medium hover:opacity-90 ".concat(t.danger?"bg-red-500":"bg-[var(--accent)]"),children:t.confirm_label||"Confirm"})]})]})}),M=s.memo(function(e){let{role:t,content:r,transcript:s}=e,n="user"===t;return(0,a.jsxs)("div",{className:"flex gap-3 ".concat(n?"justify-end":"justify-start"),children:[!n&&(0,a.jsx)("div",{className:"w-7 h-7 rounded-lg bg-gradient-to-br from-[var(--accent)] to-nexus-400 flex items-center justify-center shrink-0",children:(0,a.jsx)(y.Z,{size:14,className:"text-white"})}),(0,a.jsxs)("div",{className:"max-w-[80%] ".concat(n?"order-1":""),children:[s&&s.length>0&&(0,a.jsx)("div",{className:"mb-2",children:s.map((e,t)=>(0,a.jsx)(Z,{item:e},t))}),r&&(0,a.jsx)("div",{className:"rounded-2xl px-4 py-2.5 text-sm leading-relaxed ".concat(n?"bg-[var(--accent)] text-white whitespace-pre-wrap":"bg-[var(--surface-100)] text-[var(--text)] whitespace-pre-wrap"),children:r})]}),n&&(0,a.jsx)("div",{className:"w-7 h-7 rounded-lg bg-[var(--surface-200)] flex items-center justify-center shrink-0 text-xs font-semibold order-2",children:"U"})]})});function T(){let[e,t]=(0,s.useState)([]),[r,i]=(0,s.useState)(null),[l,c]=(0,s.useState)([]),[o,d]=(0,s.useState)(""),[u,h]=(0,s.useState)(!1),[x,f]=(0,s.useState)([]),[p,Z]=(0,s.useState)(""),[T,S]=(0,s.useState)(null),[_,A]=(0,s.useState)(null),[L,q]=(0,s.useState)(""),P=(0,s.useRef)(null),O=(0,s.useRef)(null),R=(0,s.useMemo)(()=>e.find(e=>e.id===r)||null,[e,r]),D=(0,s.useCallback)(async()=>{try{let e=await n.hi.get("/api/agent/conversations");t(e.conversations||[])}catch(e){console.error(e)}},[]),H=(0,s.useCallback)(async e=>{try{let t=((await n.hi.get("/api/agent/conversations/".concat(e))).messages||[]).map(e=>{let t=[];for(let s of e.tool_calls||[]){var r,a;let e=(null===(r=s.function)||void 0===r?void 0:r.name)||"tool",n={};try{n=JSON.parse((null===(a=s.function)||void 0===a?void 0:a.arguments)||"{}")}catch(e){}t.push({type:"tool_call",name:e,args_display:"".concat(e,"(").concat(Object.entries(n).map(e=>{let[t,r]=e;return"".concat(t,"=").concat(JSON.stringify(r))}).join(", "),")"),tool_call_id:s.id})}return{role:e.role,content:e.content||"",transcript:t.length?t:void 0}});c(t)}catch(e){console.error(e),c([])}},[]);(0,s.useEffect)(()=>{D(),n.hi.get("/api/agent/models").then(e=>{var t;f(e.models||[]),(null===(t=e.models)||void 0===t?void 0:t[0])&&Z(e.models[0])}).catch(()=>{})},[D]),(0,s.useEffect)(()=>{r?H(r):c([])},[r,H]),(0,s.useEffect)(()=>{let e=P.current;e&&(e.scrollTop=e.scrollHeight)},[l,T,_]);let F=(0,s.useCallback)(async()=>{try{let e=await n.hi.post("/api/agent/conversations",{model:p});await D(),i(e.id),c([]),S(null),A(null)}catch(e){q(e instanceof Error?e.message:"Failed to create conversation")}},[p,D]),I=(0,s.useCallback)(async e=>{if(confirm("Delete this conversation?"))try{await n.hi.delete("/api/agent/conversations/".concat(e)),r===e&&i(null),await D()}catch(e){q(e instanceof Error?e.message:"Failed to delete")}},[r,D]),U=(0,s.useCallback)(async()=>{let e=o.trim();if(e&&!u&&r){d(""),q(""),h(!0),c(t=>[...t,{role:"user",content:e}]);try{let t=await n.hi.post("/api/agent/conversations/".concat(r,"/message"),{message:e,model:p||void 0});B(t)}catch(e){q(e instanceof Error?e.message:"Request failed"),c(e=>[...e,{role:"assistant",content:"❌ Request failed. Check the error above."}])}finally{var t;h(!1),null===(t=O.current)||void 0===t||t.focus()}}},[o,u,r,p]),B=(0,s.useCallback)(e=>{if("error"===e.status){q(e.error||"Unknown error"),c(t=>[...t,{role:"assistant",content:"❌ ".concat(e.error||"Unknown error")}]);return}if("needs_input"===e.status&&e.form_schema){S({schema:e.form_schema,calls:e.pending_calls||[]}),c(t=>[...t,{role:"assistant",content:"",transcript:e.transcript}]);return}if("needs_confirm"===e.status&&e.confirm_schema){A({schema:e.confirm_schema,calls:e.pending_calls||[]}),c(t=>[...t,{role:"assistant",content:"",transcript:e.transcript}]);return}c(t=>[...t,{role:"assistant",content:e.message||"(no response)",transcript:e.transcript}])},[]),K=(0,s.useCallback)(async e=>{if(!T||!r)return;h(!0),q("");let t=T.calls;S(null);try{let a=await n.hi.post("/api/agent/conversations/".concat(r,"/continue"),{pending_calls:t,form_data:e});B(a)}catch(e){q(e instanceof Error?e.message:"Failed to submit")}finally{h(!1)}},[T,r,B]),W=(0,s.useCallback)(async()=>{if(!_||!r)return;h(!0),q("");let e=_.calls;A(null);try{let t=await n.hi.post("/api/agent/conversations/".concat(r,"/continue"),{pending_calls:e,confirmed:!0});B(t)}catch(e){q(e instanceof Error?e.message:"Failed to confirm")}finally{h(!1)}},[_,r,B]),G=(0,s.useCallback)(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),U())},[U]);return(0,a.jsxs)("div",{className:"flex h-[calc(100vh-3rem)] -m-6 lg:-m-8",children:[(0,a.jsxs)("aside",{className:"w-64 border-r border-[var(--border)] bg-[var(--surface)] flex flex-col shrink-0",children:[(0,a.jsx)("div",{className:"p-3 border-b border-[var(--border)]",children:(0,a.jsxs)("button",{onClick:F,className:"w-full flex items-center justify-center gap-2 bg-[var(--accent)] hover:opacity-90 text-white text-sm font-medium py-2 rounded-lg",children:[(0,a.jsx)(g.Z,{size:16}),"New conversation"]})}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:0===e.length?(0,a.jsxs)("div",{className:"text-center text-xs text-[var(--text-tertiary)] py-8 px-3",children:["No conversations yet.",(0,a.jsx)("br",{}),"Click ",(0,a.jsx)("span",{className:"text-[var(--accent)]",children:"+"})," to start."]}):e.map(e=>(0,a.jsxs)("div",{className:"group flex items-center gap-2 px-2 py-2 rounded-md cursor-pointer text-sm ".concat(r===e.id?"bg-[var(--surface-100)] text-white":"hover:bg-[var(--surface-50)] text-[var(--text-secondary)]"),onClick:()=>i(e.id),children:[(0,a.jsx)(b.Z,{size:14,className:"shrink-0"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"truncate text-xs font-medium",children:e.title}),(0,a.jsxs)("div",{className:"text-[10px] text-[var(--text-tertiary)] truncate",children:[e.model?e.model.split("/").pop():"no model"," \xb7 ",function(e){if(!e)return"";try{let t=new Date(e.replace(" ","T")+(e.includes("Z")?"":"Z")).getTime(),r=Date.now()-t;if(r<6e4)return"just now";if(r<36e5)return Math.floor(r/6e4)+"m ago";if(r<864e5)return Math.floor(r/36e5)+"h ago";return Math.floor(r/864e5)+"d ago"}catch(e){return""}}(e.updated_at)]})]}),(0,a.jsx)("button",{onClick:t=>{t.stopPropagation(),I(e.id)},className:"opacity-0 group-hover:opacity-100 text-[var(--text-tertiary)] hover:text-red-400 p-1","aria-label":"Delete",children:(0,a.jsx)(j.Z,{size:12})})]},e.id))}),(0,a.jsx)("div",{className:"p-3 border-t border-[var(--border)] text-[10px] text-[var(--text-tertiary)]",children:x.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-1",children:"Powered by"}),(0,a.jsx)("select",{value:p,onChange:e=>Z(e.target.value),className:"w-full bg-[var(--bg)] border border-[var(--border)] rounded px-2 py-1 text-xs",children:x.map(e=>(0,a.jsx)("option",{value:e,children:e},e))})]}):(0,a.jsxs)("div",{className:"text-yellow-400",children:["No active provider keys. Add one in ",(0,a.jsx)("span",{className:"font-mono",children:"Provider Keys"})," to power the agent."]})})]}),(0,a.jsxs)("main",{className:"flex-1 flex flex-col bg-[var(--bg)] min-w-0",children:[(0,a.jsxs)("header",{className:"border-b border-[var(--border)] px-4 py-3 flex items-center gap-3 bg-[var(--surface)]",children:[(0,a.jsx)(k.Z,{size:20,className:"text-[var(--accent)]"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h1",{className:"text-sm font-semibold truncate",children:(null==R?void 0:R.title)||"NexusAgent"}),(0,a.jsxs)("p",{className:"text-[10px] text-[var(--text-tertiary)]",children:["AI agent \xb7 ",p||"no model selected"," \xb7 secrets stay secret"]})]}),r&&(0,a.jsx)("button",{onClick:()=>H(r),className:"text-[var(--text-tertiary)] hover:text-white p-2",title:"Reload conversation",children:(0,a.jsx)(w.Z,{size:14})})]}),(0,a.jsx)("div",{ref:P,className:"flex-1 overflow-y-auto p-4 space-y-4",children:r?0===l.length?(0,a.jsx)("div",{className:"text-center text-sm text-[var(--text-tertiary)] py-12",children:"Send a message to start."}):(0,a.jsxs)(a.Fragment,{children:[l.map((e,t)=>(0,a.jsx)(M,{role:e.role,content:e.content,transcript:e.transcript},t)),T&&(0,a.jsx)(z,{schema:T.schema,onSubmit:K,onCancel:()=>S(null)}),_&&(0,a.jsx)(E,{schema:_.schema,onConfirm:W,onCancel:()=>A(null)}),u&&(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)("div",{className:"w-7 h-7 rounded-lg bg-gradient-to-br from-[var(--accent)] to-nexus-400 flex items-center justify-center shrink-0",children:(0,a.jsx)(y.Z,{size:14,className:"text-white"})}),(0,a.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-2xl px-4 py-2.5 flex items-center gap-2 text-sm text-[var(--text-secondary)]",children:[(0,a.jsx)(N,{size:14,className:"animate-spin"}),(0,a.jsx)("span",{children:"Agent is thinking…"})]})]})]}):(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-center max-w-md mx-auto",children:[(0,a.jsx)("div",{className:"w-14 h-14 rounded-2xl bg-gradient-to-br from-[var(--accent)] to-nexus-400 flex items-center justify-center mb-4",children:(0,a.jsx)(k.Z,{size:28,className:"text-white"})}),(0,a.jsx)("h2",{className:"text-lg font-semibold mb-2",children:"NexusAgent"}),(0,a.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-6",children:"An AI agent that can manage your gateway directly. Ask it to add API keys, test models, create aliases, inspect stats — anything."}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 w-full text-left",children:["Add my Gemini key and test it","Show me the slowest models",'Create an alias "fast" → gpt-4o-mini',"Why are my requests failing?"].map(e=>(0,a.jsx)("button",{onClick:()=>{F().then(()=>{d(e)})},className:"text-xs text-left px-3 py-2 rounded-lg border border-[var(--border)] hover:border-[var(--accent)] text-[var(--text-secondary)] hover:text-white",children:e},e))})]})}),L&&(0,a.jsxs)("div",{className:"mx-4 mb-2 px-3 py-2 rounded-lg bg-red-500/10 border border-red-500/30 text-xs text-red-300 flex items-start gap-2",children:[(0,a.jsx)(v.Z,{size:14,className:"shrink-0 mt-0.5"}),(0,a.jsx)("span",{className:"flex-1",children:L}),(0,a.jsx)("button",{onClick:()=>q(""),className:"text-red-300/60 hover:text-red-300",children:(0,a.jsx)(m.Z,{size:12})})]}),(0,a.jsxs)("div",{className:"border-t border-[var(--border)] p-4 bg-[var(--surface)]",children:[(0,a.jsxs)("div",{className:"flex items-end gap-2 max-w-4xl mx-auto",children:[(0,a.jsx)("textarea",{ref:O,value:o,onChange:e=>d(e.target.value),onKeyDown:G,placeholder:r?"Tell the agent what to do…":"Click + to start a new conversation",disabled:!r||u,rows:1,className:"flex-1 bg-[var(--bg)] border border-[var(--border)] rounded-xl px-4 py-3 text-sm resize-none focus:outline-none focus:border-[var(--accent)] disabled:opacity-50",style:{minHeight:44,maxHeight:160}}),(0,a.jsx)("button",{onClick:U,disabled:!r||u||!o.trim(),className:"bg-[var(--accent)] hover:opacity-90 text-white p-3 rounded-xl disabled:opacity-30","aria-label":"Send",children:(0,a.jsx)(C.Z,{size:16})})]}),(0,a.jsx)("p",{className:"text-[10px] text-center text-[var(--text-tertiary)] mt-2",children:"Enter to send \xb7 Shift+Enter for newline \xb7 API keys are entered via secure form, never in chat"})]})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return n}});let a=r(257).env.NEXT_PUBLIC_API_BASE||"";function s(){return localStorage.getItem("nexus_token")}function n(){localStorage.removeItem("nexus_token")}function i(){return!!s()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=s(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let u=(async()=>{let s=await fetch("".concat(a).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw n(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let l=await s.json();return"GET"!==r||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===r&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=a.access_token,localStorage.setItem("nexus_token",r),a},getMe:()=>d("/api/auth/me"),logout:()=>{n(),c.clear(),window.location.href="/login"}},h=async e=>{let t=s(),r=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let n=await r.blob(),i=URL.createObjectURL(n),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=9763)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2060],{9763:function(e,t,r){Promise.resolve().then(r.bind(r,5126))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var a=r(2265);let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,a.forwardRef)((e,t)=>{let{color:r="currentColor",size:n=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:l="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...c,width:n,height:n,stroke:r,strokeWidth:o?24*Number(i)/Number(n):i,className:s("lucide",l),...h},[...u.map(e=>{let[t,r]=e;return(0,a.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),o=(e,t)=>{let r=(0,a.forwardRef)((r,c)=>{let{className:o,...l}=r;return(0,a.createElement)(i,{ref:c,iconNode:t,className:s("lucide-".concat(n(e)),o),...l})});return r.displayName="".concat(e),r}},2222:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])},875:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},9388:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},2208:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},4001:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},3417:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},9397:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7168:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},4743:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},2023:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]])},8930:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},2489:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},257:function(e,t,r){"use strict";var a,n;e.exports=(null==(a=r.g.process)?void 0:a.env)&&"object"==typeof(null==(n=r.g.process)?void 0:n.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,a,n=e.exports={};function s(){throw Error("setTimeout has not been defined")}function c(){throw Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:c}catch(e){r=c}}();var o=[],l=!1,d=-1;function u(){l&&a&&(l=!1,a.length?o=a.concat(o):d=-1,o.length&&h())}function h(){if(!l){var e=i(u);l=!0;for(var t=o.length;t;){for(a=o,o=[];++d1)for(var r=1;rs(e=>!e),className:"w-full flex items-center gap-2 px-3 py-2 text-left text-xs hover:bg-[var(--surface-100)]",children:[c?t.ok?(0,a.jsx)(i,{size:14,className:"text-emerald-400 shrink-0"}):(0,a.jsx)(o.Z,{size:14,className:"text-red-400 shrink-0"}):(0,a.jsx)(l,{size:14,className:"text-blue-400 shrink-0"}),(0,a.jsx)("span",{className:"font-mono text-[var(--text-secondary)]",children:t.name}),(0,a.jsx)("span",{className:"text-[var(--text-tertiary)] truncate flex-1",children:c?t.summary:t.args_display}),r?(0,a.jsx)(d.Z,{size:12}):(0,a.jsx)(u,{size:12})]}),r&&(0,a.jsx)("div",{className:"px-3 py-2 border-t border-[var(--border)] bg-[var(--bg)] text-xs font-mono whitespace-pre-wrap break-all",children:c?t.summary:t.args_display})]})}),z=n.memo(function(e){var t;let{schema:r,onSubmit:s,onCancel:c}=e,[i,o]=(0,n.useState)(!1),[l,d]=(0,n.useState)(()=>{let e={};for(let t of r.fields||[])e[t.name]="";return e}),u=null===(t=r.fields)||void 0===t?void 0:t[0],v=(null==u?void 0:u.type)==="password",y=u&&l[u.name]||"",g=!(null==u?void 0:u.required)||y.length>=(u.minLength||0);return(0,a.jsxs)("div",{className:"my-3 rounded-lg border-2 border-[var(--accent)] bg-[var(--surface)] p-4 shadow-lg",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 mb-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-lg bg-[var(--accent)]/20 flex items-center justify-center shrink-0",children:v?(0,a.jsx)(h.Z,{size:20,className:"text-[var(--accent)]"}):(0,a.jsx)(x,{size:20,className:"text-[var(--accent)]"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:r.title}),(0,a.jsx)("p",{className:"text-xs text-[var(--text-secondary)] mt-1",children:r.description})]}),(0,a.jsx)("button",{onClick:c,className:"text-[var(--text-tertiary)] hover:text-white p-1","aria-label":"Cancel",children:(0,a.jsx)(m.Z,{size:16})})]}),u&&(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsxs)("label",{className:"text-xs font-medium text-[var(--text-secondary)] mb-1 block",children:[u.label,u.required&&(0,a.jsx)("span",{className:"text-red-400 ml-1",children:"*"})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:v&&!i?"password":"text",value:y,onChange:e=>d(t=>({...t,[u.name]:e.target.value})),onKeyDown:e=>{"Enter"===e.key&&g&&s(l),"Escape"===e.key&&c()},autoFocus:!0,autoComplete:"off",spellCheck:!1,className:"w-full bg-[var(--bg)] border border-[var(--border)] rounded-lg px-3 py-2 pr-10 text-sm font-mono focus:outline-none focus:border-[var(--accent)]",placeholder:"••••••••"}),v&&(0,a.jsx)("button",{type:"button",onClick:()=>o(e=>!e),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)] hover:text-white p-1","aria-label":i?"Hide":"Show",children:i?(0,a.jsx)(f,{size:14}):(0,a.jsx)(p.Z,{size:14})})]}),v&&(0,a.jsxs)("p",{className:"text-[10px] text-[var(--text-tertiary)] mt-1 flex items-center gap-1",children:[(0,a.jsx)(x,{size:10}),"Sent directly to gateway — never appears in chat history or LLM context"]})]}),(0,a.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,a.jsx)("button",{onClick:c,className:"px-3 py-1.5 text-xs rounded-md border border-[var(--border)] hover:bg-[var(--surface-100)]",children:"Cancel"}),(0,a.jsx)("button",{onClick:()=>s(l),disabled:!g,className:"px-3 py-1.5 text-xs rounded-md bg-[var(--accent)] text-white font-medium disabled:opacity-50 hover:opacity-90",children:r.submit_label||"Submit"})]})]})}),E=n.memo(function(e){let{schema:t,onConfirm:r,onCancel:n}=e;return(0,a.jsxs)("div",{className:"my-3 rounded-lg border-2 border-yellow-500/50 bg-[var(--surface)] p-4 shadow-lg",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 mb-3",children:[(0,a.jsx)("div",{className:"w-10 h-10 rounded-lg bg-yellow-500/20 flex items-center justify-center shrink-0",children:(0,a.jsx)(v.Z,{size:20,className:"text-yellow-400"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:t.title}),(0,a.jsx)("p",{className:"text-xs text-[var(--text-secondary)] mt-1",children:t.description})]})]}),(0,a.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,a.jsx)("button",{onClick:n,className:"px-3 py-1.5 text-xs rounded-md border border-[var(--border)] hover:bg-[var(--surface-100)]",children:"Cancel"}),(0,a.jsx)("button",{onClick:r,className:"px-3 py-1.5 text-xs rounded-md text-white font-medium hover:opacity-90 ".concat(t.danger?"bg-red-500":"bg-[var(--accent)]"),children:t.confirm_label||"Confirm"})]})]})}),M=n.memo(function(e){let{role:t,content:r,transcript:n}=e,s="user"===t;return(0,a.jsxs)("div",{className:"flex gap-3 ".concat(s?"justify-end":"justify-start"),children:[!s&&(0,a.jsx)("div",{className:"w-7 h-7 rounded-lg bg-gradient-to-br from-[var(--accent)] to-nexus-400 flex items-center justify-center shrink-0",children:(0,a.jsx)(y.Z,{size:14,className:"text-white"})}),(0,a.jsxs)("div",{className:"max-w-[80%] ".concat(s?"order-1":""),children:[n&&n.length>0&&(0,a.jsx)("div",{className:"mb-2",children:n.map((e,t)=>(0,a.jsx)(Z,{item:e},t))}),r&&(0,a.jsx)("div",{className:"rounded-2xl px-4 py-2.5 text-sm leading-relaxed ".concat(s?"bg-[var(--accent)] text-white whitespace-pre-wrap":"bg-[var(--surface-100)] text-[var(--text)] whitespace-pre-wrap"),children:r})]}),s&&(0,a.jsx)("div",{className:"w-7 h-7 rounded-lg bg-[var(--surface-200)] flex items-center justify-center shrink-0 text-xs font-semibold order-2",children:"U"})]})});function S(){let[e,t]=(0,n.useState)([]),[r,c]=(0,n.useState)(null),[i,o]=(0,n.useState)([]),[l,d]=(0,n.useState)(""),[u,h]=(0,n.useState)(!1),[x,f]=(0,n.useState)([]),[p,Z]=(0,n.useState)(""),[S,_]=(0,n.useState)(null),[T,A]=(0,n.useState)(null),[L,q]=(0,n.useState)(""),P=(0,n.useRef)(null),R=(0,n.useRef)(null),O=(0,n.useMemo)(()=>e.find(e=>e.id===r)||null,[e,r]),D=(0,n.useCallback)(async()=>{try{let e=await s.hi.get("/api/agent/conversations");t(e.conversations||[])}catch(e){console.error(e)}},[]),H=(0,n.useCallback)(async e=>{try{let t=((await s.hi.get("/api/agent/conversations/".concat(e))).messages||[]).map(e=>{let t=[];for(let n of e.tool_calls||[]){var r,a;let e=(null===(r=n.function)||void 0===r?void 0:r.name)||"tool",s={};try{s=JSON.parse((null===(a=n.function)||void 0===a?void 0:a.arguments)||"{}")}catch(e){}t.push({type:"tool_call",name:e,args_display:"".concat(e,"(").concat(Object.entries(s).map(e=>{let[t,r]=e;return"".concat(t,"=").concat(JSON.stringify(r))}).join(", "),")"),tool_call_id:n.id})}return{role:e.role,content:e.content||"",transcript:t.length?t:void 0}});o(t)}catch(e){console.error(e),o([])}},[]);(0,n.useEffect)(()=>{D(),s.hi.get("/api/agent/models").then(e=>{var t;f(e.models||[]),(null===(t=e.models)||void 0===t?void 0:t[0])&&Z(e.models[0])}).catch(()=>{})},[D]),(0,n.useEffect)(()=>{r?H(r):o([])},[r,H]),(0,n.useEffect)(()=>{let e=P.current;e&&(e.scrollTop=e.scrollHeight)},[i,S,T]);let I=(0,n.useCallback)(async()=>{try{let e=await s.hi.post("/api/agent/conversations",{model:p});await D(),c(e.id),o([]),_(null),A(null)}catch(e){q(e instanceof Error?e.message:"Failed to create conversation")}},[p,D]),U=(0,n.useCallback)(async e=>{if(confirm("Delete this conversation?"))try{await s.hi.delete("/api/agent/conversations/".concat(e)),r===e&&c(null),await D()}catch(e){q(e instanceof Error?e.message:"Failed to delete")}},[r,D]),F=(0,n.useCallback)(async()=>{let e=l.trim();if(e&&!u&&r){d(""),q(""),h(!0),o(t=>[...t,{role:"user",content:e}]);try{let t=await s.hi.post("/api/agent/conversations/".concat(r,"/message"),{message:e,model:p||void 0});B(t)}catch(e){q(e instanceof Error?e.message:"Request failed"),o(e=>[...e,{role:"assistant",content:"❌ Request failed. Check the error above."}])}finally{var t;h(!1),null===(t=R.current)||void 0===t||t.focus()}}},[l,u,r,p]),B=(0,n.useCallback)(e=>{if("error"===e.status){q(e.error||"Unknown error"),o(t=>[...t,{role:"assistant",content:"❌ ".concat(e.error||"Unknown error")}]);return}if("needs_input"===e.status&&e.form_schema){_({schema:e.form_schema,calls:e.pending_calls||[]}),o(t=>[...t,{role:"assistant",content:"",transcript:e.transcript}]);return}if("needs_confirm"===e.status&&e.confirm_schema){A({schema:e.confirm_schema,calls:e.pending_calls||[]}),o(t=>[...t,{role:"assistant",content:"",transcript:e.transcript}]);return}o(t=>[...t,{role:"assistant",content:e.message||"(no response)",transcript:e.transcript}])},[]),K=(0,n.useCallback)(async e=>{if(!S||!r)return;h(!0),q("");let t=S.calls;_(null);try{let a=await s.hi.post("/api/agent/conversations/".concat(r,"/continue"),{pending_calls:t,form_data:e});B(a)}catch(e){q(e instanceof Error?e.message:"Failed to submit")}finally{h(!1)}},[S,r,B]),W=(0,n.useCallback)(async()=>{if(!T||!r)return;h(!0),q("");let e=T.calls;A(null);try{let t=await s.hi.post("/api/agent/conversations/".concat(r,"/continue"),{pending_calls:e,confirmed:!0});B(t)}catch(e){q(e instanceof Error?e.message:"Failed to confirm")}finally{h(!1)}},[T,r,B]),G=(0,n.useCallback)(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),F())},[F]);return(0,a.jsxs)("div",{className:"flex h-[calc(100vh-3rem)] -m-6 lg:-m-8",children:[(0,a.jsxs)("aside",{className:"w-64 border-r border-[var(--border)] bg-[var(--surface)] flex flex-col shrink-0",children:[(0,a.jsx)("div",{className:"p-3 border-b border-[var(--border)]",children:(0,a.jsxs)("button",{onClick:I,className:"w-full flex items-center justify-center gap-2 bg-[var(--accent)] hover:opacity-90 text-white text-sm font-medium py-2 rounded-lg",children:[(0,a.jsx)(g.Z,{size:16}),"New conversation"]})}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:0===e.length?(0,a.jsxs)("div",{className:"text-center text-xs text-[var(--text-tertiary)] py-8 px-3",children:["No conversations yet.",(0,a.jsx)("br",{}),"Click ",(0,a.jsx)("span",{className:"text-[var(--accent)]",children:"+"})," to start."]}):e.map(e=>(0,a.jsxs)("div",{className:"group flex items-center gap-2 px-2 py-2 rounded-md cursor-pointer text-sm ".concat(r===e.id?"bg-[var(--surface-100)] text-white":"hover:bg-[var(--surface-50)] text-[var(--text-secondary)]"),onClick:()=>c(e.id),children:[(0,a.jsx)(b.Z,{size:14,className:"shrink-0"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"truncate text-xs font-medium",children:e.title}),(0,a.jsxs)("div",{className:"text-[10px] text-[var(--text-tertiary)] truncate",children:[e.model?e.model.split("/").pop():"no model"," \xb7 ",function(e){if(!e)return"";try{let t=new Date(e.replace(" ","T")+(e.includes("Z")?"":"Z")).getTime(),r=Date.now()-t;if(r<6e4)return"just now";if(r<36e5)return Math.floor(r/6e4)+"m ago";if(r<864e5)return Math.floor(r/36e5)+"h ago";return Math.floor(r/864e5)+"d ago"}catch(e){return""}}(e.updated_at)]})]}),(0,a.jsx)("button",{onClick:t=>{t.stopPropagation(),U(e.id)},className:"opacity-0 group-hover:opacity-100 text-[var(--text-tertiary)] hover:text-red-400 p-1","aria-label":"Delete",children:(0,a.jsx)(j.Z,{size:12})})]},e.id))}),(0,a.jsx)("div",{className:"p-3 border-t border-[var(--border)] text-[10px] text-[var(--text-tertiary)]",children:x.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-1",children:"Powered by"}),(0,a.jsx)("select",{value:p,onChange:e=>Z(e.target.value),className:"w-full bg-[var(--bg)] border border-[var(--border)] rounded px-2 py-1 text-xs",children:x.map(e=>(0,a.jsx)("option",{value:e,children:e},e))})]}):(0,a.jsxs)("div",{className:"text-yellow-400",children:["No active provider keys. Add one in ",(0,a.jsx)("span",{className:"font-mono",children:"Provider Keys"})," to power the agent."]})})]}),(0,a.jsxs)("main",{className:"flex-1 flex flex-col bg-[var(--bg)] min-w-0",children:[(0,a.jsxs)("header",{className:"border-b border-[var(--border)] px-4 py-3 flex items-center gap-3 bg-[var(--surface)]",children:[(0,a.jsx)(k.Z,{size:20,className:"text-[var(--accent)]"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h1",{className:"text-sm font-semibold truncate",children:(null==O?void 0:O.title)||"NexusAgent"}),(0,a.jsxs)("p",{className:"text-[10px] text-[var(--text-tertiary)]",children:["AI agent \xb7 ",p||"no model selected"," \xb7 secrets stay secret"]})]}),r&&(0,a.jsx)("button",{onClick:()=>H(r),className:"text-[var(--text-tertiary)] hover:text-white p-2",title:"Reload conversation",children:(0,a.jsx)(w.Z,{size:14})})]}),(0,a.jsx)("div",{ref:P,className:"flex-1 overflow-y-auto p-4 space-y-4",children:r?0===i.length?(0,a.jsx)("div",{className:"text-center text-sm text-[var(--text-tertiary)] py-12",children:"Send a message to start."}):(0,a.jsxs)(a.Fragment,{children:[i.map((e,t)=>(0,a.jsx)(M,{role:e.role,content:e.content,transcript:e.transcript},t)),S&&(0,a.jsx)(z,{schema:S.schema,onSubmit:K,onCancel:()=>_(null)}),T&&(0,a.jsx)(E,{schema:T.schema,onConfirm:W,onCancel:()=>A(null)}),u&&(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)("div",{className:"w-7 h-7 rounded-lg bg-gradient-to-br from-[var(--accent)] to-nexus-400 flex items-center justify-center shrink-0",children:(0,a.jsx)(y.Z,{size:14,className:"text-white"})}),(0,a.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-2xl px-4 py-2.5 flex items-center gap-2 text-sm text-[var(--text-secondary)]",children:[(0,a.jsx)(N,{size:14,className:"animate-spin"}),(0,a.jsx)("span",{children:"Agent is thinking…"})]})]})]}):(0,a.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-center max-w-md mx-auto",children:[(0,a.jsx)("div",{className:"w-14 h-14 rounded-2xl bg-gradient-to-br from-[var(--accent)] to-nexus-400 flex items-center justify-center mb-4",children:(0,a.jsx)(k.Z,{size:28,className:"text-white"})}),(0,a.jsx)("h2",{className:"text-lg font-semibold mb-2",children:"NexusAgent"}),(0,a.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-6",children:"An AI agent that can manage your gateway directly. Ask it to add API keys, test models, create aliases, inspect stats — anything."}),(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 w-full text-left",children:["Add my Gemini key and test it","Show me the slowest models",'Create an alias "fast" → gpt-4o-mini',"Why are my requests failing?"].map(e=>(0,a.jsx)("button",{onClick:()=>{I().then(()=>{d(e)})},className:"text-xs text-left px-3 py-2 rounded-lg border border-[var(--border)] hover:border-[var(--accent)] text-[var(--text-secondary)] hover:text-white",children:e},e))})]})}),L&&(0,a.jsxs)("div",{className:"mx-4 mb-2 px-3 py-2 rounded-lg bg-red-500/10 border border-red-500/30 text-xs text-red-300 flex items-start gap-2",children:[(0,a.jsx)(v.Z,{size:14,className:"shrink-0 mt-0.5"}),(0,a.jsx)("span",{className:"flex-1",children:L}),(0,a.jsx)("button",{onClick:()=>q(""),className:"text-red-300/60 hover:text-red-300",children:(0,a.jsx)(m.Z,{size:12})})]}),(0,a.jsxs)("div",{className:"border-t border-[var(--border)] p-4 bg-[var(--surface)]",children:[(0,a.jsxs)("div",{className:"flex items-end gap-2 max-w-4xl mx-auto",children:[(0,a.jsx)("textarea",{ref:R,value:l,onChange:e=>d(e.target.value),onKeyDown:G,placeholder:r?"Tell the agent what to do…":"Click + to start a new conversation",disabled:!r||u,rows:1,className:"flex-1 bg-[var(--bg)] border border-[var(--border)] rounded-xl px-4 py-3 text-sm resize-none focus:outline-none focus:border-[var(--accent)] disabled:opacity-50",style:{minHeight:44,maxHeight:160}}),(0,a.jsx)("button",{onClick:F,disabled:!r||u||!l.trim(),className:"bg-[var(--accent)] hover:opacity-90 text-white p-3 rounded-xl disabled:opacity-30","aria-label":"Send",children:(0,a.jsx)(C.Z,{size:16})})]}),(0,a.jsx)("p",{className:"text-[10px] text-center text-[var(--text-tertiary)] mt-2",children:"Enter to send \xb7 Shift+Enter for newline \xb7 API keys are entered via secure form, never in chat"})]})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return c},qz:function(){return s}});let a=r(257).env.NEXT_PUBLIC_API_BASE||"";function n(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function s(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function c(){return!!n()}let i={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,l=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",c=n(),d={"Content-Type":"application/json",...t.headers};if(c&&(d.Authorization="Bearer ".concat(c)),"GET"===r&&!c){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in i)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return i[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=l.get(e);if(r)return r}let u=(async()=>{let n=await fetch("".concat(a).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return n;if(401===n.status&&c&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!n.ok)throw Error((await n.json().catch(()=>({detail:n.statusText}))).detail||"HTTP ".concat(n.status));if(204===n.status)return;let i=await n.json();return"GET"!==r||c||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,i),i})();if("GET"===r&&!c){l.set(e,u);try{return await u}finally{l.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=a.access_token,localStorage.setItem("nexus_token",r),function(e,t,r){try{let r="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(r)}catch(e){}}("nexus_token",r,0),a},getMe:()=>d("/api/auth/me"),logout:()=>{s(),o.clear(),window.location.href="/login"}},h=async e=>{let t=n(),r=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let s=await r.blob(),c=URL.createObjectURL(s),i=document.createElement("a");i.href=c,i.download=e.split("/").pop()||"export.csv",i.click(),URL.revokeObjectURL(c)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=9763)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/aliases/page-4c00397d46a1ecfd.js b/static/_next/static/chunks/app/aliases/page-41cd8bb4b05195fc.js similarity index 60% rename from static/_next/static/chunks/app/aliases/page-4c00397d46a1ecfd.js rename to static/_next/static/chunks/app/aliases/page-41cd8bb4b05195fc.js index 68977a6b514ef185d289d35e6c1adc5725411daf..39014273bf645cac702167a69f7c3a0f253a8166 100644 --- a/static/_next/static/chunks/app/aliases/page-4c00397d46a1ecfd.js +++ b/static/_next/static/chunks/app/aliases/page-41cd8bb4b05195fc.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5781],{1718:function(e,t,a){Promise.resolve().then(a.bind(a,947))},9205:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var r=a(2265);let l=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),a=0;a!!e&&a.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let n=(0,r.forwardRef)((e,t)=>{let{color:a="currentColor",size:l=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:c="",children:d,iconNode:u,...h}=e;return(0,r.createElement)("svg",{ref:t,...s,width:l,height:l,stroke:a,strokeWidth:o?24*Number(n)/Number(l):n,className:i("lucide",c),...h},[...u.map(e=>{let[t,a]=e;return(0,r.createElement)(t,a)}),...Array.isArray(d)?d:[d]])}),o=(e,t)=>{let a=(0,r.forwardRef)((a,s)=>{let{className:o,...c}=a;return(0,r.createElement)(n,{ref:s,iconNode:t,className:i("lucide-".concat(l(e)),o),...c})});return a.displayName="".concat(e),a}},9397:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},3247:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},8930:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,a){"use strict";var r,l;e.exports=(null==(r=a.g.process)?void 0:r.env)&&"object"==typeof(null==(l=a.g.process)?void 0:l.env)?a.g.process:a(4227)},4227:function(e){!function(){var t={229:function(e){var t,a,r,l=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function n(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(a){try{return t.call(null,e,0)}catch(a){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{a="function"==typeof clearTimeout?clearTimeout:s}catch(e){a=s}}();var o=[],c=!1,d=-1;function u(){c&&r&&(c=!1,r.length?o=r.concat(o):d=-1,o.length&&h())}function h(){if(!c){var e=n(u);c=!0;for(var t=o.length;t;){for(r=o,o=[];++d1)for(var a=1;a{p(!0),i.hi.get("/api/models/aliases").then(t).finally(()=>p(!1))},N=()=>{i.hi.get("/api/providers").then(e=>{Array.isArray(e)?u(e):u(Object.keys(e).map(e=>({name:e})))}).catch(()=>u([]))};(0,l.useEffect)(()=>{k(),N()},[]);let _=async()=>{if(v.alias&&v.provider&&v.provider_model)try{let e={alias:v.alias,provider:v.provider,provider_model:v.provider_model};v.description&&(e.description=v.description),v.max_tokens_override&&(e.max_tokens_override=Number(v.max_tokens_override)),v.prompt_template_id&&(e.prompt_template_id=Number(v.prompt_template_id)),v.fallback_provider&&(e.fallback_provider=v.fallback_provider),v.fallback_model&&(e.fallback_model=v.fallback_model),await i.hi.post("/api/models/aliases",e),x(!1),f(d),k(),y("Alias created")}catch(e){y(e instanceof Error?e.message:"Failed to create alias")}},w=async e=>{await i.hi.patch("/api/models/aliases/".concat(e,"/toggle")),k()},T=async e=>{confirm("Delete this alias?")&&(await i.hi.delete("/api/models/aliases/".concat(e)),k(),y("Alias deleted"))};l.useEffect(()=>{if(b){let e=setTimeout(()=>y(""),3e3);return()=>clearTimeout(e)}},[b]);let C=e.filter(e=>!g||e.alias.toLowerCase().includes(g.toLowerCase())||e.provider.toLowerCase().includes(g.toLowerCase())||e.provider_model.toLowerCase().includes(g.toLowerCase()));return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Model Aliases"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage friendly names for provider models"})]}),(0,r.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(s.Z,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)]"}),(0,r.jsx)("input",{className:"input pl-8 max-w-xs",placeholder:"Search aliases...",value:g,onChange:e=>j(e.target.value)})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>{x(!0),f(d)},children:[(0,r.jsx)(n.Z,{size:16})," New Alias"]})]})]}),m&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>x(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Create Model Alias"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Alias *"}),(0,r.jsx)("input",{className:"input",value:v.alias,onChange:e=>f(t=>({...t,alias:e.target.value})),placeholder:"my-model",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Provider *"}),(0,r.jsxs)("select",{className:"select",value:v.provider,onChange:e=>f(t=>({...t,provider:e.target.value})),children:[(0,r.jsx)("option",{value:"",children:"Select provider"}),a.map(e=>(0,r.jsx)("option",{value:e.name,children:e.name},e.name))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Provider Model *"}),(0,r.jsx)("input",{className:"input",value:v.provider_model,onChange:e=>f(t=>({...t,provider_model:e.target.value})),placeholder:"gpt-4o"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Description"}),(0,r.jsx)("input",{className:"input",value:v.description,onChange:e=>f(t=>({...t,description:e.target.value})),placeholder:"Optional description"})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Max Tokens Override"}),(0,r.jsx)("input",{className:"input",type:"number",value:v.max_tokens_override,onChange:e=>f(t=>({...t,max_tokens_override:e.target.value})),placeholder:"e.g. 4096"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Prompt Template ID"}),(0,r.jsx)("input",{className:"input",type:"number",value:v.prompt_template_id,onChange:e=>f(t=>({...t,prompt_template_id:e.target.value})),placeholder:"Optional ID"})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Fallback Provider"}),(0,r.jsxs)("select",{className:"select",value:v.fallback_provider,onChange:e=>f(t=>({...t,fallback_provider:e.target.value})),children:[(0,r.jsx)("option",{value:"",children:"None"}),a.map(e=>(0,r.jsx)("option",{value:e.name,children:e.name},e.name))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Fallback Model"}),(0,r.jsx)("input",{className:"input",value:v.fallback_model,onChange:e=>f(t=>({...t,fallback_model:e.target.value})),placeholder:"e.g. gpt-3.5-turbo"})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:_,children:"Create"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>x(!1),children:"Cancel"})]})]})]})}),h?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===C.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:g?"No aliases match your search.":"No aliases yet. Create one to get started."})]}):(0,r.jsxs)("div",{className:"card p-0",children:[(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Alias"}),(0,r.jsx)("th",{children:"Provider"}),(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Max Tokens"}),(0,r.jsx)("th",{children:"Fallback"}),(0,r.jsx)("th",{children:"Auto"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:C.map(e=>{var t;return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium max-w-[160px] truncate",title:e.alias,children:e.alias}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"capitalize",children:e.provider})}),(0,r.jsx)("td",{className:"max-w-[200px] truncate text-xs font-mono text-[var(--text-tertiary)]",title:e.provider_model,children:e.provider_model}),(0,r.jsx)("td",{className:"text-xs",children:(null===(t=e.max_tokens_override)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,r.jsx)("td",{className:"text-xs",children:e.fallback_provider&&e.fallback_model?"".concat(e.fallback_provider,"/").concat(e.fallback_model):"-"}),(0,r.jsx)("td",{children:e.auto_select?(0,r.jsx)("span",{className:"badge-green text-xs",children:"auto"}):(0,r.jsx)("span",{className:"text-[var(--text-tertiary)] text-xs",children:"-"})}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>w(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsx)("button",{onClick:()=>T(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(c.Z,{size:14})})})]},e.id)})})]})}),(0,r.jsxs)("div",{className:"px-3 py-2 border-t border-[var(--border)] text-xs text-[var(--text-tertiary)] text-right",children:[C.length," alias",1!==C.length?"es":""]})]}),b&&(0,r.jsx)("div",{className:"toast",children:b})]})}},1837:function(e,t,a){"use strict";a.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return s},qz:function(){return i}});let r=a(257).env.NEXT_PUBLIC_API_BASE||"";function l(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function s(){return!!l()}let n={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,c=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.method||"GET",s=l(),d={"Content-Type":"application/json",...t.headers};if(s&&(d.Authorization="Bearer ".concat(s)),"GET"===a&&!s){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in n)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return n[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let a=c.get(e);if(a)return a}let u=(async()=>{let l=await fetch("".concat(r).concat(e),{method:a,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return l;if(401===l.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!l.ok)throw Error((await l.json().catch(()=>({detail:l.statusText}))).detail||"HTTP ".concat(l.status));if(204===l.status)return;let n=await l.json();return"GET"!==a||s||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,n),n})();if("GET"===a&&!s){c.set(e,u);try{return await u}finally{c.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var a;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return a=r.access_token,localStorage.setItem("nexus_token",a),r},getMe:()=>d("/api/auth/me"),logout:()=>{i(),o.clear(),window.location.href="/login"}},h=async e=>{let t=l(),a=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!a.ok)throw Error("Failed to download");let i=await a.blob(),s=URL.createObjectURL(i),n=document.createElement("a");n.href=s,n.download=e.split("/").pop()||"export.csv",n.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1718)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5781],{1718:function(e,t,a){Promise.resolve().then(a.bind(a,947))},9205:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var r=a(2265);let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),l=function(){for(var e=arguments.length,t=Array(e),a=0;a!!e&&a.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,r.forwardRef)((e,t)=>{let{color:a="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:c="",children:d,iconNode:u,...h}=e;return(0,r.createElement)("svg",{ref:t,...i,width:n,height:n,stroke:a,strokeWidth:o?24*Number(s)/Number(n):s,className:l("lucide",c),...h},[...u.map(e=>{let[t,a]=e;return(0,r.createElement)(t,a)}),...Array.isArray(d)?d:[d]])}),o=(e,t)=>{let a=(0,r.forwardRef)((a,i)=>{let{className:o,...c}=a;return(0,r.createElement)(s,{ref:i,iconNode:t,className:l("lucide-".concat(n(e)),o),...c})});return a.displayName="".concat(e),a}},9397:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},3247:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},8930:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,a){"use strict";var r,n;e.exports=(null==(r=a.g.process)?void 0:r.env)&&"object"==typeof(null==(n=a.g.process)?void 0:n.env)?a.g.process:a(4227)},4227:function(e){!function(){var t={229:function(e){var t,a,r,n=e.exports={};function l(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===l||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(a){try{return t.call(null,e,0)}catch(a){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:l}catch(e){t=l}try{a="function"==typeof clearTimeout?clearTimeout:i}catch(e){a=i}}();var o=[],c=!1,d=-1;function u(){c&&r&&(c=!1,r.length?o=r.concat(o):d=-1,o.length&&h())}function h(){if(!c){var e=s(u);c=!0;for(var t=o.length;t;){for(r=o,o=[];++d1)for(var a=1;a{p(!0),l.hi.get("/api/models/aliases").then(t).finally(()=>p(!1))},_=()=>{l.hi.get("/api/providers").then(e=>{Array.isArray(e)?u(e):u(Object.keys(e).map(e=>({name:e})))}).catch(()=>u([]))};(0,n.useEffect)(()=>{k(),_()},[]);let N=async()=>{if(v.alias&&v.provider&&v.provider_model)try{let e={alias:v.alias,provider:v.provider,provider_model:v.provider_model};v.description&&(e.description=v.description),v.max_tokens_override&&(e.max_tokens_override=Number(v.max_tokens_override)),v.prompt_template_id&&(e.prompt_template_id=Number(v.prompt_template_id)),v.fallback_provider&&(e.fallback_provider=v.fallback_provider),v.fallback_model&&(e.fallback_model=v.fallback_model),await l.hi.post("/api/models/aliases",e),x(!1),f(d),k(),y("Alias created")}catch(e){y(e instanceof Error?e.message:"Failed to create alias")}},w=async e=>{await l.hi.patch("/api/models/aliases/".concat(e,"/toggle")),k()},T=async e=>{confirm("Delete this alias?")&&(await l.hi.delete("/api/models/aliases/".concat(e)),k(),y("Alias deleted"))};n.useEffect(()=>{if(b){let e=setTimeout(()=>y(""),3e3);return()=>clearTimeout(e)}},[b]);let C=e.filter(e=>!g||e.alias.toLowerCase().includes(g.toLowerCase())||e.provider.toLowerCase().includes(g.toLowerCase())||e.provider_model.toLowerCase().includes(g.toLowerCase()));return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Model Aliases"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage friendly names for provider models"})]}),(0,r.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(i.Z,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)]"}),(0,r.jsx)("input",{className:"input pl-8 max-w-xs",placeholder:"Search aliases...",value:g,onChange:e=>j(e.target.value)})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>{x(!0),f(d)},children:[(0,r.jsx)(s.Z,{size:16})," New Alias"]})]})]}),m&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>x(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Create Model Alias"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Alias *"}),(0,r.jsx)("input",{className:"input",value:v.alias,onChange:e=>f(t=>({...t,alias:e.target.value})),placeholder:"my-model",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Provider *"}),(0,r.jsxs)("select",{className:"select",value:v.provider,onChange:e=>f(t=>({...t,provider:e.target.value})),children:[(0,r.jsx)("option",{value:"",children:"Select provider"}),a.map(e=>(0,r.jsx)("option",{value:e.name,children:e.name},e.name))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Provider Model *"}),(0,r.jsx)("input",{className:"input",value:v.provider_model,onChange:e=>f(t=>({...t,provider_model:e.target.value})),placeholder:"gpt-4o"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Description"}),(0,r.jsx)("input",{className:"input",value:v.description,onChange:e=>f(t=>({...t,description:e.target.value})),placeholder:"Optional description"})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Max Tokens Override"}),(0,r.jsx)("input",{className:"input",type:"number",value:v.max_tokens_override,onChange:e=>f(t=>({...t,max_tokens_override:e.target.value})),placeholder:"e.g. 4096"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Prompt Template ID"}),(0,r.jsx)("input",{className:"input",type:"number",value:v.prompt_template_id,onChange:e=>f(t=>({...t,prompt_template_id:e.target.value})),placeholder:"Optional ID"})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Fallback Provider"}),(0,r.jsxs)("select",{className:"select",value:v.fallback_provider,onChange:e=>f(t=>({...t,fallback_provider:e.target.value})),children:[(0,r.jsx)("option",{value:"",children:"None"}),a.map(e=>(0,r.jsx)("option",{value:e.name,children:e.name},e.name))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Fallback Model"}),(0,r.jsx)("input",{className:"input",value:v.fallback_model,onChange:e=>f(t=>({...t,fallback_model:e.target.value})),placeholder:"e.g. gpt-3.5-turbo"})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:N,children:"Create"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>x(!1),children:"Cancel"})]})]})]})}),h?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===C.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:g?"No aliases match your search.":"No aliases yet. Create one to get started."})]}):(0,r.jsxs)("div",{className:"card p-0",children:[(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Alias"}),(0,r.jsx)("th",{children:"Provider"}),(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Max Tokens"}),(0,r.jsx)("th",{children:"Fallback"}),(0,r.jsx)("th",{children:"Auto"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:C.map(e=>{var t;return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium max-w-[160px] truncate",title:e.alias,children:e.alias}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"capitalize",children:e.provider})}),(0,r.jsx)("td",{className:"max-w-[200px] truncate text-xs font-mono text-[var(--text-tertiary)]",title:e.provider_model,children:e.provider_model}),(0,r.jsx)("td",{className:"text-xs",children:(null===(t=e.max_tokens_override)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,r.jsx)("td",{className:"text-xs",children:e.fallback_provider&&e.fallback_model?"".concat(e.fallback_provider,"/").concat(e.fallback_model):"-"}),(0,r.jsx)("td",{children:e.auto_select?(0,r.jsx)("span",{className:"badge-green text-xs",children:"auto"}):(0,r.jsx)("span",{className:"text-[var(--text-tertiary)] text-xs",children:"-"})}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>w(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsx)("button",{onClick:()=>T(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(c.Z,{size:14})})})]},e.id)})})]})}),(0,r.jsxs)("div",{className:"px-3 py-2 border-t border-[var(--border)] text-xs text-[var(--text-tertiary)] text-right",children:[C.length," alias",1!==C.length?"es":""]})]}),b&&(0,r.jsx)("div",{className:"toast",children:b})]})}},1837:function(e,t,a){"use strict";a.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return l}});let r=a(257).env.NEXT_PUBLIC_API_BASE||"";function n(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function l(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!n()}let s={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,c=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.method||"GET",i=n(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===a&&!i){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in s)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return s[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let a=c.get(e);if(a)return a}let u=(async()=>{let n=await fetch("".concat(r).concat(e),{method:a,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return n;if(401===n.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw l(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!n.ok)throw Error((await n.json().catch(()=>({detail:n.statusText}))).detail||"HTTP ".concat(n.status));if(204===n.status)return;let s=await n.json();return"GET"!==a||i||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,s),s})();if("GET"===a&&!i){c.set(e,u);try{return await u}finally{c.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var a;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return a=r.access_token,localStorage.setItem("nexus_token",a),function(e,t,a){try{let a="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(a)}catch(e){}}("nexus_token",a,0),r},getMe:()=>d("/api/auth/me"),logout:()=>{l(),o.clear(),window.location.href="/login"}},h=async e=>{let t=n(),a=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!a.ok)throw Error("Failed to download");let l=await a.blob(),i=URL.createObjectURL(l),s=document.createElement("a");s.href=i,s.download=e.split("/").pop()||"export.csv",s.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1718)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/aliases/page-d7baa78c5be07b1d.js b/static/_next/static/chunks/app/aliases/page-d7baa78c5be07b1d.js deleted file mode 100644 index 68977a6b514ef185d289d35e6c1adc5725411daf..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/aliases/page-d7baa78c5be07b1d.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5781],{1718:function(e,t,a){Promise.resolve().then(a.bind(a,947))},9205:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var r=a(2265);let l=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),a=0;a!!e&&a.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let n=(0,r.forwardRef)((e,t)=>{let{color:a="currentColor",size:l=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:c="",children:d,iconNode:u,...h}=e;return(0,r.createElement)("svg",{ref:t,...s,width:l,height:l,stroke:a,strokeWidth:o?24*Number(n)/Number(l):n,className:i("lucide",c),...h},[...u.map(e=>{let[t,a]=e;return(0,r.createElement)(t,a)}),...Array.isArray(d)?d:[d]])}),o=(e,t)=>{let a=(0,r.forwardRef)((a,s)=>{let{className:o,...c}=a;return(0,r.createElement)(n,{ref:s,iconNode:t,className:i("lucide-".concat(l(e)),o),...c})});return a.displayName="".concat(e),a}},9397:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},3247:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},8930:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,a){"use strict";var r,l;e.exports=(null==(r=a.g.process)?void 0:r.env)&&"object"==typeof(null==(l=a.g.process)?void 0:l.env)?a.g.process:a(4227)},4227:function(e){!function(){var t={229:function(e){var t,a,r,l=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function n(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(a){try{return t.call(null,e,0)}catch(a){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{a="function"==typeof clearTimeout?clearTimeout:s}catch(e){a=s}}();var o=[],c=!1,d=-1;function u(){c&&r&&(c=!1,r.length?o=r.concat(o):d=-1,o.length&&h())}function h(){if(!c){var e=n(u);c=!0;for(var t=o.length;t;){for(r=o,o=[];++d1)for(var a=1;a{p(!0),i.hi.get("/api/models/aliases").then(t).finally(()=>p(!1))},N=()=>{i.hi.get("/api/providers").then(e=>{Array.isArray(e)?u(e):u(Object.keys(e).map(e=>({name:e})))}).catch(()=>u([]))};(0,l.useEffect)(()=>{k(),N()},[]);let _=async()=>{if(v.alias&&v.provider&&v.provider_model)try{let e={alias:v.alias,provider:v.provider,provider_model:v.provider_model};v.description&&(e.description=v.description),v.max_tokens_override&&(e.max_tokens_override=Number(v.max_tokens_override)),v.prompt_template_id&&(e.prompt_template_id=Number(v.prompt_template_id)),v.fallback_provider&&(e.fallback_provider=v.fallback_provider),v.fallback_model&&(e.fallback_model=v.fallback_model),await i.hi.post("/api/models/aliases",e),x(!1),f(d),k(),y("Alias created")}catch(e){y(e instanceof Error?e.message:"Failed to create alias")}},w=async e=>{await i.hi.patch("/api/models/aliases/".concat(e,"/toggle")),k()},T=async e=>{confirm("Delete this alias?")&&(await i.hi.delete("/api/models/aliases/".concat(e)),k(),y("Alias deleted"))};l.useEffect(()=>{if(b){let e=setTimeout(()=>y(""),3e3);return()=>clearTimeout(e)}},[b]);let C=e.filter(e=>!g||e.alias.toLowerCase().includes(g.toLowerCase())||e.provider.toLowerCase().includes(g.toLowerCase())||e.provider_model.toLowerCase().includes(g.toLowerCase()));return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Model Aliases"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage friendly names for provider models"})]}),(0,r.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(s.Z,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)]"}),(0,r.jsx)("input",{className:"input pl-8 max-w-xs",placeholder:"Search aliases...",value:g,onChange:e=>j(e.target.value)})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>{x(!0),f(d)},children:[(0,r.jsx)(n.Z,{size:16})," New Alias"]})]})]}),m&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>x(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Create Model Alias"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Alias *"}),(0,r.jsx)("input",{className:"input",value:v.alias,onChange:e=>f(t=>({...t,alias:e.target.value})),placeholder:"my-model",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Provider *"}),(0,r.jsxs)("select",{className:"select",value:v.provider,onChange:e=>f(t=>({...t,provider:e.target.value})),children:[(0,r.jsx)("option",{value:"",children:"Select provider"}),a.map(e=>(0,r.jsx)("option",{value:e.name,children:e.name},e.name))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Provider Model *"}),(0,r.jsx)("input",{className:"input",value:v.provider_model,onChange:e=>f(t=>({...t,provider_model:e.target.value})),placeholder:"gpt-4o"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Description"}),(0,r.jsx)("input",{className:"input",value:v.description,onChange:e=>f(t=>({...t,description:e.target.value})),placeholder:"Optional description"})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Max Tokens Override"}),(0,r.jsx)("input",{className:"input",type:"number",value:v.max_tokens_override,onChange:e=>f(t=>({...t,max_tokens_override:e.target.value})),placeholder:"e.g. 4096"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Prompt Template ID"}),(0,r.jsx)("input",{className:"input",type:"number",value:v.prompt_template_id,onChange:e=>f(t=>({...t,prompt_template_id:e.target.value})),placeholder:"Optional ID"})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Fallback Provider"}),(0,r.jsxs)("select",{className:"select",value:v.fallback_provider,onChange:e=>f(t=>({...t,fallback_provider:e.target.value})),children:[(0,r.jsx)("option",{value:"",children:"None"}),a.map(e=>(0,r.jsx)("option",{value:e.name,children:e.name},e.name))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Fallback Model"}),(0,r.jsx)("input",{className:"input",value:v.fallback_model,onChange:e=>f(t=>({...t,fallback_model:e.target.value})),placeholder:"e.g. gpt-3.5-turbo"})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:_,children:"Create"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>x(!1),children:"Cancel"})]})]})]})}),h?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===C.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:g?"No aliases match your search.":"No aliases yet. Create one to get started."})]}):(0,r.jsxs)("div",{className:"card p-0",children:[(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Alias"}),(0,r.jsx)("th",{children:"Provider"}),(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Max Tokens"}),(0,r.jsx)("th",{children:"Fallback"}),(0,r.jsx)("th",{children:"Auto"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:C.map(e=>{var t;return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium max-w-[160px] truncate",title:e.alias,children:e.alias}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"capitalize",children:e.provider})}),(0,r.jsx)("td",{className:"max-w-[200px] truncate text-xs font-mono text-[var(--text-tertiary)]",title:e.provider_model,children:e.provider_model}),(0,r.jsx)("td",{className:"text-xs",children:(null===(t=e.max_tokens_override)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,r.jsx)("td",{className:"text-xs",children:e.fallback_provider&&e.fallback_model?"".concat(e.fallback_provider,"/").concat(e.fallback_model):"-"}),(0,r.jsx)("td",{children:e.auto_select?(0,r.jsx)("span",{className:"badge-green text-xs",children:"auto"}):(0,r.jsx)("span",{className:"text-[var(--text-tertiary)] text-xs",children:"-"})}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>w(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsx)("button",{onClick:()=>T(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(c.Z,{size:14})})})]},e.id)})})]})}),(0,r.jsxs)("div",{className:"px-3 py-2 border-t border-[var(--border)] text-xs text-[var(--text-tertiary)] text-right",children:[C.length," alias",1!==C.length?"es":""]})]}),b&&(0,r.jsx)("div",{className:"toast",children:b})]})}},1837:function(e,t,a){"use strict";a.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return s},qz:function(){return i}});let r=a(257).env.NEXT_PUBLIC_API_BASE||"";function l(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function s(){return!!l()}let n={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,c=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.method||"GET",s=l(),d={"Content-Type":"application/json",...t.headers};if(s&&(d.Authorization="Bearer ".concat(s)),"GET"===a&&!s){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in n)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return n[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let a=c.get(e);if(a)return a}let u=(async()=>{let l=await fetch("".concat(r).concat(e),{method:a,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return l;if(401===l.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!l.ok)throw Error((await l.json().catch(()=>({detail:l.statusText}))).detail||"HTTP ".concat(l.status));if(204===l.status)return;let n=await l.json();return"GET"!==a||s||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,n),n})();if("GET"===a&&!s){c.set(e,u);try{return await u}finally{c.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var a;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return a=r.access_token,localStorage.setItem("nexus_token",a),r},getMe:()=>d("/api/auth/me"),logout:()=>{i(),o.clear(),window.location.href="/login"}},h=async e=>{let t=l(),a=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!a.ok)throw Error("Failed to download");let i=await a.blob(),s=URL.createObjectURL(i),n=document.createElement("a");n.href=s,n.download=e.split("/").pop()||"export.csv",n.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1718)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/analytics/page-06a4c26379b4ee7e.js b/static/_next/static/chunks/app/analytics/page-06a4c26379b4ee7e.js new file mode 100644 index 0000000000000000000000000000000000000000..20add5daaa66fa124aefe1678b73cfec3ed550f0 --- /dev/null +++ b/static/_next/static/chunks/app/analytics/page-06a4c26379b4ee7e.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4109],{7880:function(e,t,s){Promise.resolve().then(s.bind(s,6351))},9205:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var a=s(2265);let r=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n=function(){for(var e=arguments.length,t=Array(e),s=0;s!!e&&s.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,a.forwardRef)((e,t)=>{let{color:s="currentColor",size:r=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:o="",children:d,iconNode:x,...h}=e;return(0,a.createElement)("svg",{ref:t,...i,width:r,height:r,stroke:s,strokeWidth:l?24*Number(c)/Number(r):c,className:n("lucide",o),...h},[...x.map(e=>{let[t,s]=e;return(0,a.createElement)(t,s)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let s=(0,a.forwardRef)((s,i)=>{let{className:l,...o}=s;return(0,a.createElement)(c,{ref:i,iconNode:t,className:n("lucide-".concat(r(e)),l),...o})});return s.displayName="".concat(e),s}},6215:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]])},9322:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},4001:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},525:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]])},257:function(e,t,s){"use strict";var a,r;e.exports=(null==(a=s.g.process)?void 0:a.env)&&"object"==typeof(null==(r=s.g.process)?void 0:r.env)?s.g.process:s(4227)},4227:function(e){!function(){var t={229:function(e){var t,s,a,r=e.exports={};function n(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===n||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(s){try{return t.call(null,e,0)}catch(s){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:n}catch(e){t=n}try{s="function"==typeof clearTimeout?clearTimeout:i}catch(e){s=i}}();var l=[],o=!1,d=-1;function x(){o&&a&&(o=!1,a.length?l=a.concat(l):d=-1,l.length&&h())}function h(){if(!o){var e=c(x);o=!0;for(var t=l.length;t;){for(a=l,l=[];++d1)for(var s=1;s{g(!0),Promise.all([n.hi.get("/api/stats/dashboard"),n.hi.get("/api/stats/forecast"),n.hi.get("/api/stats/today").catch(()=>null),n.hi.get("/api/stats/trending-models").catch(()=>[]),n.hi.get("/api/stats/keys").catch(()=>[])]).then(e=>{let[s,a,r,n,i]=e;t(s),x(a),m(r),j(n),f(i)}).catch(e=>y(e instanceof Error?e.message:"Failed to load analytics")).finally(()=>g(!1))},[]),N)?(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"page-header",children:[(0,a.jsx)("h1",{className:"page-title",children:"Analytics"}),(0,a.jsx)("p",{className:"page-sub",children:"Usage statistics and projections"})]}),(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)(i.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,a.jsx)("p",{className:"text-red-400",children:N})]})]}):v?(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"page-header",children:[(0,a.jsx)("h1",{className:"page-title",children:"Analytics"}),(0,a.jsx)("p",{className:"page-sub",children:"Usage statistics and projections"})]}),(0,a.jsx)("div",{className:"card",children:(0,a.jsx)("div",{className:"skeleton h-64 w-full"})})]}):e?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"page-header",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"Analytics"}),(0,a.jsx)("p",{className:"page-sub",children:"Usage statistics and projections"})]})}),(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Total Requests"}),(0,a.jsx)("p",{className:"text-2xl font-semibold",children:e.total_requests.toLocaleString()})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Total Cost"}),(0,a.jsxs)("p",{className:"text-2xl font-semibold",children:["$",e.total_cost.toFixed(2)]})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Today"}),(0,a.jsxs)("p",{className:"text-2xl font-semibold",children:[e.requests_today.toLocaleString()," req / $",e.today_cost.toFixed(2)]})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Avg Latency"}),(0,a.jsxs)("p",{className:"text-2xl font-semibold",children:[e.avg_latency_ms,"ms"]})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Error Rate"}),(0,a.jsxs)("p",{className:"text-2xl font-semibold",children:[e.error_rate.toFixed(1),"%"]})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Active Keys"}),(0,a.jsx)("p",{className:"text-2xl font-semibold",children:e.active_keys})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Cache Hit Rate"}),(0,a.jsxs)("p",{className:"text-2xl font-semibold",children:[e.cache_hit_rate.toFixed(1),"%"]})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Providers"}),(0,a.jsx)("p",{className:"text-2xl font-semibold",children:Object.keys(e.requests_by_provider).length})]})]}),h&&(0,a.jsxs)("div",{className:"card mb-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Today"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Requests"}),(0,a.jsx)("p",{className:"text-xl font-semibold",children:h.requests.toLocaleString()})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Cost"}),(0,a.jsxs)("p",{className:"text-xl font-semibold",children:["$",h.cost.toFixed(4)]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Tokens"}),(0,a.jsx)("p",{className:"text-xl font-semibold",children:h.tokens.toLocaleString()})]})]})]}),u.length>0&&(0,a.jsxs)("div",{className:"card mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,a.jsx)(l,{size:18,className:"text-[var(--accent)]"}),(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Trending Models (7d)"})]}),(0,a.jsx)("div",{className:"table-wrap",children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Model"}),(0,a.jsx)("th",{children:"Requests"}),(0,a.jsx)("th",{children:"Avg Latency"}),(0,a.jsx)("th",{children:"Total Cost"})]})}),(0,a.jsx)("tbody",{children:u.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"font-medium text-sm max-w-[280px] truncate",title:e.model,children:e.model}),(0,a.jsx)("td",{children:e.requests.toLocaleString()}),(0,a.jsxs)("td",{className:"text-xs",children:[Math.round(e.avg_latency),"ms"]}),(0,a.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.total_cost).toFixed(4)]})]},e.model))})]})})]}),p.length>0&&(0,a.jsxs)("div",{className:"card mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,a.jsx)(o.Z,{size:18,className:"text-[var(--accent)]"}),(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Per-Key Statistics"})]}),(0,a.jsx)("div",{className:"table-wrap",children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Provider"}),(0,a.jsx)("th",{children:"Name"}),(0,a.jsx)("th",{children:"Requests"}),(0,a.jsx)("th",{children:"Tokens In"}),(0,a.jsx)("th",{children:"Tokens Out"}),(0,a.jsx)("th",{children:"Cost"}),(0,a.jsx)("th",{children:"Budget"}),(0,a.jsx)("th",{children:"Errors"})]})}),(0,a.jsx)("tbody",{children:p.map((e,t)=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsx)("span",{className:"capitalize text-sm",children:e.provider})}),(0,a.jsx)("td",{className:"text-sm",children:e.name}),(0,a.jsx)("td",{children:(e.total_requests||0).toLocaleString()}),(0,a.jsx)("td",{className:"text-xs",children:(e.total_tokens_in||0).toLocaleString()}),(0,a.jsx)("td",{className:"text-xs",children:(e.total_tokens_out||0).toLocaleString()}),(0,a.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.total_cost||0).toFixed(4)]}),(0,a.jsx)("td",{className:"text-xs font-mono",children:e.cost_budget?"$".concat(e.cost_budget):"∞"}),(0,a.jsx)("td",{className:"text-xs",children:e.error_count||0})]},"".concat(e.provider,"-").concat(e.name,"-").concat(t)))})]})})]}),(0,a.jsxs)("div",{className:"card mb-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Top Models"}),0===e.top_models.length?(0,a.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No model data yet."}):(0,a.jsx)("div",{className:"table-wrap",children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Model"}),(0,a.jsx)("th",{children:"Requests"}),(0,a.jsx)("th",{children:"Avg Latency"}),(0,a.jsx)("th",{children:"Cost"}),(0,a.jsx)("th",{children:"Tokens"}),(0,a.jsx)("th",{children:"Error Rate"})]})}),(0,a.jsx)("tbody",{children:e.top_models.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"font-medium text-sm max-w-[200px] truncate",title:e.model,children:e.model}),(0,a.jsx)("td",{children:e.requests.toLocaleString()}),(0,a.jsxs)("td",{className:"text-xs",children:[e.avg_latency,"ms"]}),(0,a.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.cost).toFixed(4)]}),(0,a.jsx)("td",{className:"text-xs",children:e.tokens.toLocaleString()}),(0,a.jsxs)("td",{className:"text-xs",children:[e.error_rate.toFixed(1),"%"]})]},e.model))})]})})]}),s&&(0,a.jsxs)("div",{className:"card",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,a.jsx)(d.Z,{size:18,className:"text-[var(--accent)]"}),(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Forecast"})]}),s.insufficient_data?(0,a.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:s.message||"Insufficient data for forecast."}):s.forecast?(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4 mb-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Next 30 Days Cost"}),(0,a.jsxs)("p",{className:"text-xl font-semibold",children:["$",s.forecast.next_30_days_cost.toFixed(2)]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Daily Avg"}),(0,a.jsxs)("p",{className:"text-xl font-semibold",children:["$",s.forecast.daily_avg.toFixed(2)]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Trend"}),(0,a.jsx)("p",{className:"text-xl font-semibold capitalize",children:s.forecast.trend})]})]}),s.forecast.by_provider.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-medium mb-2",children:"By Provider"}),(0,a.jsx)("div",{className:"table-wrap",children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Provider"}),(0,a.jsx)("th",{children:"Cost"}),(0,a.jsx)("th",{children:"%"})]})}),(0,a.jsx)("tbody",{children:s.forecast.by_provider.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"capitalize",children:e.provider}),(0,a.jsxs)("td",{className:"font-mono text-xs",children:["$",e.cost.toFixed(2)]}),(0,a.jsxs)("td",{className:"text-xs",children:[e.percentage.toFixed(1),"%"]})]},e.provider))})]})})]})]}):(0,a.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:s.message||"No forecast available."})]})]}):(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"page-header",children:[(0,a.jsx)("h1",{className:"page-title",children:"Analytics"}),(0,a.jsx)("p",{className:"page-sub",children:"Usage statistics and projections"})]}),(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,a.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No analytics data available yet."})]})]})}},1837:function(e,t,s){"use strict";s.d(t,{KF:function(){return h},hi:function(){return x},jl:function(){return i},qz:function(){return n}});let a=s(257).env.NEXT_PUBLIC_API_BASE||"";function r(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function n(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!r()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=t.method||"GET",i=r(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===s&&!i){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let s=o.get(e);if(s)return s}let x=(async()=>{let r=await fetch("".concat(a).concat(e),{method:s,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return r;if(401===r.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw n(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!r.ok)throw Error((await r.json().catch(()=>({detail:r.statusText}))).detail||"HTTP ".concat(r.status));if(204===r.status)return;let c=await r.json();return"GET"!==s||i||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===s&&!i){o.set(e,x);try{return await x}finally{o.delete(e)}}return x}let x={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var s;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return s=a.access_token,localStorage.setItem("nexus_token",s),function(e,t,s){try{let s="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(s)}catch(e){}}("nexus_token",s,0),a},getMe:()=>d("/api/auth/me"),logout:()=>{n(),l.clear(),window.location.href="/login"}},h=async e=>{let t=r(),s=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!s.ok)throw Error("Failed to download");let n=await s.blob(),i=URL.createObjectURL(n),c=document.createElement("a");c.href=i,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=7880)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/analytics/page-a799d4a333cef333.js b/static/_next/static/chunks/app/analytics/page-a799d4a333cef333.js deleted file mode 100644 index 4378fb15acd7064e56d17a3007432e6088d0b086..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/analytics/page-a799d4a333cef333.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4109],{7880:function(e,t,s){Promise.resolve().then(s.bind(s,6351))},9205:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var r=s(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),s=0;s!!e&&s.indexOf(e)===t).join(" ")};var n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((e,t)=>{let{color:s="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:o="",children:d,iconNode:x,...h}=e;return(0,r.createElement)("svg",{ref:t,...n,width:a,height:a,stroke:s,strokeWidth:l?24*Number(c)/Number(a):c,className:i("lucide",o),...h},[...x.map(e=>{let[t,s]=e;return(0,r.createElement)(t,s)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let s=(0,r.forwardRef)((s,n)=>{let{className:l,...o}=s;return(0,r.createElement)(c,{ref:n,iconNode:t,className:i("lucide-".concat(a(e)),l),...o})});return s.displayName="".concat(e),s}},6215:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(9205).Z)("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]])},9322:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},4001:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(9205).Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},525:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(9205).Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]])},257:function(e,t,s){"use strict";var r,a;e.exports=(null==(r=s.g.process)?void 0:r.env)&&"object"==typeof(null==(a=s.g.process)?void 0:a.env)?s.g.process:s(4227)},4227:function(e){!function(){var t={229:function(e){var t,s,r,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function n(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(s){try{return t.call(null,e,0)}catch(s){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{s="function"==typeof clearTimeout?clearTimeout:n}catch(e){s=n}}();var l=[],o=!1,d=-1;function x(){o&&r&&(o=!1,r.length?l=r.concat(l):d=-1,l.length&&h())}function h(){if(!o){var e=c(x);o=!0;for(var t=l.length;t;){for(r=l,l=[];++d1)for(var s=1;s{N(!0),Promise.all([i.hi.get("/api/stats/dashboard"),i.hi.get("/api/stats/forecast"),i.hi.get("/api/stats/today").catch(()=>null),i.hi.get("/api/stats/trending-models").catch(()=>[]),i.hi.get("/api/stats/keys").catch(()=>[])]).then(e=>{let[s,r,a,i,n]=e;t(s),x(r),m(a),j(i),f(n)}).catch(e=>y(e instanceof Error?e.message:"Failed to load analytics")).finally(()=>N(!1))},[]),g)?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsx)("h1",{className:"page-title",children:"Analytics"}),(0,r.jsx)("p",{className:"page-sub",children:"Usage statistics and projections"})]}),(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(n.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:g})]})]}):v?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsx)("h1",{className:"page-title",children:"Analytics"}),(0,r.jsx)("p",{className:"page-sub",children:"Usage statistics and projections"})]}),(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-64 w-full"})})]}):e?(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"page-header",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Analytics"}),(0,r.jsx)("p",{className:"page-sub",children:"Usage statistics and projections"})]})}),(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Total Requests"}),(0,r.jsx)("p",{className:"text-2xl font-semibold",children:e.total_requests.toLocaleString()})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Total Cost"}),(0,r.jsxs)("p",{className:"text-2xl font-semibold",children:["$",e.total_cost.toFixed(2)]})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Today"}),(0,r.jsxs)("p",{className:"text-2xl font-semibold",children:[e.requests_today.toLocaleString()," req / $",e.today_cost.toFixed(2)]})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Avg Latency"}),(0,r.jsxs)("p",{className:"text-2xl font-semibold",children:[e.avg_latency_ms,"ms"]})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Error Rate"}),(0,r.jsxs)("p",{className:"text-2xl font-semibold",children:[e.error_rate.toFixed(1),"%"]})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Active Keys"}),(0,r.jsx)("p",{className:"text-2xl font-semibold",children:e.active_keys})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Cache Hit Rate"}),(0,r.jsxs)("p",{className:"text-2xl font-semibold",children:[e.cache_hit_rate.toFixed(1),"%"]})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Providers"}),(0,r.jsx)("p",{className:"text-2xl font-semibold",children:Object.keys(e.requests_by_provider).length})]})]}),h&&(0,r.jsxs)("div",{className:"card mb-6",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Today"}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Requests"}),(0,r.jsx)("p",{className:"text-xl font-semibold",children:h.requests.toLocaleString()})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Cost"}),(0,r.jsxs)("p",{className:"text-xl font-semibold",children:["$",h.cost.toFixed(4)]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Tokens"}),(0,r.jsx)("p",{className:"text-xl font-semibold",children:h.tokens.toLocaleString()})]})]})]}),u.length>0&&(0,r.jsxs)("div",{className:"card mb-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,r.jsx)(l,{size:18,className:"text-[var(--accent)]"}),(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Trending Models (7d)"})]}),(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Requests"}),(0,r.jsx)("th",{children:"Avg Latency"}),(0,r.jsx)("th",{children:"Total Cost"})]})}),(0,r.jsx)("tbody",{children:u.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium text-sm max-w-[280px] truncate",title:e.model,children:e.model}),(0,r.jsx)("td",{children:e.requests.toLocaleString()}),(0,r.jsxs)("td",{className:"text-xs",children:[Math.round(e.avg_latency),"ms"]}),(0,r.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.total_cost).toFixed(4)]})]},e.model))})]})})]}),p.length>0&&(0,r.jsxs)("div",{className:"card mb-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,r.jsx)(o.Z,{size:18,className:"text-[var(--accent)]"}),(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Per-Key Statistics"})]}),(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Provider"}),(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Requests"}),(0,r.jsx)("th",{children:"Tokens In"}),(0,r.jsx)("th",{children:"Tokens Out"}),(0,r.jsx)("th",{children:"Cost"}),(0,r.jsx)("th",{children:"Budget"}),(0,r.jsx)("th",{children:"Errors"})]})}),(0,r.jsx)("tbody",{children:p.map((e,t)=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"capitalize text-sm",children:e.provider})}),(0,r.jsx)("td",{className:"text-sm",children:e.name}),(0,r.jsx)("td",{children:(e.total_requests||0).toLocaleString()}),(0,r.jsx)("td",{className:"text-xs",children:(e.total_tokens_in||0).toLocaleString()}),(0,r.jsx)("td",{className:"text-xs",children:(e.total_tokens_out||0).toLocaleString()}),(0,r.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.total_cost||0).toFixed(4)]}),(0,r.jsx)("td",{className:"text-xs font-mono",children:e.cost_budget?"$".concat(e.cost_budget):"∞"}),(0,r.jsx)("td",{className:"text-xs",children:e.error_count||0})]},"".concat(e.provider,"-").concat(e.name,"-").concat(t)))})]})})]}),(0,r.jsxs)("div",{className:"card mb-6",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Top Models"}),0===e.top_models.length?(0,r.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No model data yet."}):(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Requests"}),(0,r.jsx)("th",{children:"Avg Latency"}),(0,r.jsx)("th",{children:"Cost"}),(0,r.jsx)("th",{children:"Tokens"}),(0,r.jsx)("th",{children:"Error Rate"})]})}),(0,r.jsx)("tbody",{children:e.top_models.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium text-sm max-w-[200px] truncate",title:e.model,children:e.model}),(0,r.jsx)("td",{children:e.requests.toLocaleString()}),(0,r.jsxs)("td",{className:"text-xs",children:[e.avg_latency,"ms"]}),(0,r.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.cost).toFixed(4)]}),(0,r.jsx)("td",{className:"text-xs",children:e.tokens.toLocaleString()}),(0,r.jsxs)("td",{className:"text-xs",children:[e.error_rate.toFixed(1),"%"]})]},e.model))})]})})]}),s&&(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,r.jsx)(d.Z,{size:18,className:"text-[var(--accent)]"}),(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Forecast"})]}),s.insufficient_data?(0,r.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:s.message||"Insufficient data for forecast."}):s.forecast?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-4 mb-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Next 30 Days Cost"}),(0,r.jsxs)("p",{className:"text-xl font-semibold",children:["$",s.forecast.next_30_days_cost.toFixed(2)]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Daily Avg"}),(0,r.jsxs)("p",{className:"text-xl font-semibold",children:["$",s.forecast.daily_avg.toFixed(2)]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Trend"}),(0,r.jsx)("p",{className:"text-xl font-semibold capitalize",children:s.forecast.trend})]})]}),s.forecast.by_provider.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-medium mb-2",children:"By Provider"}),(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Provider"}),(0,r.jsx)("th",{children:"Cost"}),(0,r.jsx)("th",{children:"%"})]})}),(0,r.jsx)("tbody",{children:s.forecast.by_provider.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"capitalize",children:e.provider}),(0,r.jsxs)("td",{className:"font-mono text-xs",children:["$",e.cost.toFixed(2)]}),(0,r.jsxs)("td",{className:"text-xs",children:[e.percentage.toFixed(1),"%"]})]},e.provider))})]})})]})]}):(0,r.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:s.message||"No forecast available."})]})]}):(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsx)("h1",{className:"page-title",children:"Analytics"}),(0,r.jsx)("p",{className:"page-sub",children:"Usage statistics and projections"})]}),(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No analytics data available yet."})]})]})}},1837:function(e,t,s){"use strict";s.d(t,{KF:function(){return h},hi:function(){return x},jl:function(){return n},qz:function(){return i}});let r=s(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function n(){return!!a()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=t.method||"GET",n=a(),d={"Content-Type":"application/json",...t.headers};if(n&&(d.Authorization="Bearer ".concat(n)),"GET"===s&&!n){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let s=o.get(e);if(s)return s}let x=(async()=>{let a=await fetch("".concat(r).concat(e),{method:s,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&n&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let c=await a.json();return"GET"!==s||n||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===s&&!n){o.set(e,x);try{return await x}finally{o.delete(e)}}return x}let x={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var s;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return s=r.access_token,localStorage.setItem("nexus_token",s),r},getMe:()=>d("/api/auth/me"),logout:()=>{i(),l.clear(),window.location.href="/login"}},h=async e=>{let t=a(),s=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!s.ok)throw Error("Failed to download");let i=await s.blob(),n=URL.createObjectURL(i),c=document.createElement("a");c.href=n,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(n)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=7880)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/analytics/page-d99b46621eeb72d0.js b/static/_next/static/chunks/app/analytics/page-d99b46621eeb72d0.js deleted file mode 100644 index 4378fb15acd7064e56d17a3007432e6088d0b086..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/analytics/page-d99b46621eeb72d0.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4109],{7880:function(e,t,s){Promise.resolve().then(s.bind(s,6351))},9205:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var r=s(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),s=0;s!!e&&s.indexOf(e)===t).join(" ")};var n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((e,t)=>{let{color:s="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:o="",children:d,iconNode:x,...h}=e;return(0,r.createElement)("svg",{ref:t,...n,width:a,height:a,stroke:s,strokeWidth:l?24*Number(c)/Number(a):c,className:i("lucide",o),...h},[...x.map(e=>{let[t,s]=e;return(0,r.createElement)(t,s)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let s=(0,r.forwardRef)((s,n)=>{let{className:l,...o}=s;return(0,r.createElement)(c,{ref:n,iconNode:t,className:i("lucide-".concat(a(e)),l),...o})});return s.displayName="".concat(e),s}},6215:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(9205).Z)("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]])},9322:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},4001:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(9205).Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},525:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(9205).Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]])},257:function(e,t,s){"use strict";var r,a;e.exports=(null==(r=s.g.process)?void 0:r.env)&&"object"==typeof(null==(a=s.g.process)?void 0:a.env)?s.g.process:s(4227)},4227:function(e){!function(){var t={229:function(e){var t,s,r,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function n(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(s){try{return t.call(null,e,0)}catch(s){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{s="function"==typeof clearTimeout?clearTimeout:n}catch(e){s=n}}();var l=[],o=!1,d=-1;function x(){o&&r&&(o=!1,r.length?l=r.concat(l):d=-1,l.length&&h())}function h(){if(!o){var e=c(x);o=!0;for(var t=l.length;t;){for(r=l,l=[];++d1)for(var s=1;s{N(!0),Promise.all([i.hi.get("/api/stats/dashboard"),i.hi.get("/api/stats/forecast"),i.hi.get("/api/stats/today").catch(()=>null),i.hi.get("/api/stats/trending-models").catch(()=>[]),i.hi.get("/api/stats/keys").catch(()=>[])]).then(e=>{let[s,r,a,i,n]=e;t(s),x(r),m(a),j(i),f(n)}).catch(e=>y(e instanceof Error?e.message:"Failed to load analytics")).finally(()=>N(!1))},[]),g)?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsx)("h1",{className:"page-title",children:"Analytics"}),(0,r.jsx)("p",{className:"page-sub",children:"Usage statistics and projections"})]}),(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(n.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:g})]})]}):v?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsx)("h1",{className:"page-title",children:"Analytics"}),(0,r.jsx)("p",{className:"page-sub",children:"Usage statistics and projections"})]}),(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-64 w-full"})})]}):e?(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"page-header",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Analytics"}),(0,r.jsx)("p",{className:"page-sub",children:"Usage statistics and projections"})]})}),(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Total Requests"}),(0,r.jsx)("p",{className:"text-2xl font-semibold",children:e.total_requests.toLocaleString()})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Total Cost"}),(0,r.jsxs)("p",{className:"text-2xl font-semibold",children:["$",e.total_cost.toFixed(2)]})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Today"}),(0,r.jsxs)("p",{className:"text-2xl font-semibold",children:[e.requests_today.toLocaleString()," req / $",e.today_cost.toFixed(2)]})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Avg Latency"}),(0,r.jsxs)("p",{className:"text-2xl font-semibold",children:[e.avg_latency_ms,"ms"]})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Error Rate"}),(0,r.jsxs)("p",{className:"text-2xl font-semibold",children:[e.error_rate.toFixed(1),"%"]})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Active Keys"}),(0,r.jsx)("p",{className:"text-2xl font-semibold",children:e.active_keys})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Cache Hit Rate"}),(0,r.jsxs)("p",{className:"text-2xl font-semibold",children:[e.cache_hit_rate.toFixed(1),"%"]})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Providers"}),(0,r.jsx)("p",{className:"text-2xl font-semibold",children:Object.keys(e.requests_by_provider).length})]})]}),h&&(0,r.jsxs)("div",{className:"card mb-6",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Today"}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Requests"}),(0,r.jsx)("p",{className:"text-xl font-semibold",children:h.requests.toLocaleString()})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Cost"}),(0,r.jsxs)("p",{className:"text-xl font-semibold",children:["$",h.cost.toFixed(4)]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Tokens"}),(0,r.jsx)("p",{className:"text-xl font-semibold",children:h.tokens.toLocaleString()})]})]})]}),u.length>0&&(0,r.jsxs)("div",{className:"card mb-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,r.jsx)(l,{size:18,className:"text-[var(--accent)]"}),(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Trending Models (7d)"})]}),(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Requests"}),(0,r.jsx)("th",{children:"Avg Latency"}),(0,r.jsx)("th",{children:"Total Cost"})]})}),(0,r.jsx)("tbody",{children:u.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium text-sm max-w-[280px] truncate",title:e.model,children:e.model}),(0,r.jsx)("td",{children:e.requests.toLocaleString()}),(0,r.jsxs)("td",{className:"text-xs",children:[Math.round(e.avg_latency),"ms"]}),(0,r.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.total_cost).toFixed(4)]})]},e.model))})]})})]}),p.length>0&&(0,r.jsxs)("div",{className:"card mb-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,r.jsx)(o.Z,{size:18,className:"text-[var(--accent)]"}),(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Per-Key Statistics"})]}),(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Provider"}),(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Requests"}),(0,r.jsx)("th",{children:"Tokens In"}),(0,r.jsx)("th",{children:"Tokens Out"}),(0,r.jsx)("th",{children:"Cost"}),(0,r.jsx)("th",{children:"Budget"}),(0,r.jsx)("th",{children:"Errors"})]})}),(0,r.jsx)("tbody",{children:p.map((e,t)=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"capitalize text-sm",children:e.provider})}),(0,r.jsx)("td",{className:"text-sm",children:e.name}),(0,r.jsx)("td",{children:(e.total_requests||0).toLocaleString()}),(0,r.jsx)("td",{className:"text-xs",children:(e.total_tokens_in||0).toLocaleString()}),(0,r.jsx)("td",{className:"text-xs",children:(e.total_tokens_out||0).toLocaleString()}),(0,r.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.total_cost||0).toFixed(4)]}),(0,r.jsx)("td",{className:"text-xs font-mono",children:e.cost_budget?"$".concat(e.cost_budget):"∞"}),(0,r.jsx)("td",{className:"text-xs",children:e.error_count||0})]},"".concat(e.provider,"-").concat(e.name,"-").concat(t)))})]})})]}),(0,r.jsxs)("div",{className:"card mb-6",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-3",children:"Top Models"}),0===e.top_models.length?(0,r.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No model data yet."}):(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Requests"}),(0,r.jsx)("th",{children:"Avg Latency"}),(0,r.jsx)("th",{children:"Cost"}),(0,r.jsx)("th",{children:"Tokens"}),(0,r.jsx)("th",{children:"Error Rate"})]})}),(0,r.jsx)("tbody",{children:e.top_models.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium text-sm max-w-[200px] truncate",title:e.model,children:e.model}),(0,r.jsx)("td",{children:e.requests.toLocaleString()}),(0,r.jsxs)("td",{className:"text-xs",children:[e.avg_latency,"ms"]}),(0,r.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.cost).toFixed(4)]}),(0,r.jsx)("td",{className:"text-xs",children:e.tokens.toLocaleString()}),(0,r.jsxs)("td",{className:"text-xs",children:[e.error_rate.toFixed(1),"%"]})]},e.model))})]})})]}),s&&(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,r.jsx)(d.Z,{size:18,className:"text-[var(--accent)]"}),(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Forecast"})]}),s.insufficient_data?(0,r.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:s.message||"Insufficient data for forecast."}):s.forecast?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-4 mb-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Next 30 Days Cost"}),(0,r.jsxs)("p",{className:"text-xl font-semibold",children:["$",s.forecast.next_30_days_cost.toFixed(2)]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Daily Avg"}),(0,r.jsxs)("p",{className:"text-xl font-semibold",children:["$",s.forecast.daily_avg.toFixed(2)]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Trend"}),(0,r.jsx)("p",{className:"text-xl font-semibold capitalize",children:s.forecast.trend})]})]}),s.forecast.by_provider.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-medium mb-2",children:"By Provider"}),(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Provider"}),(0,r.jsx)("th",{children:"Cost"}),(0,r.jsx)("th",{children:"%"})]})}),(0,r.jsx)("tbody",{children:s.forecast.by_provider.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"capitalize",children:e.provider}),(0,r.jsxs)("td",{className:"font-mono text-xs",children:["$",e.cost.toFixed(2)]}),(0,r.jsxs)("td",{className:"text-xs",children:[e.percentage.toFixed(1),"%"]})]},e.provider))})]})})]})]}):(0,r.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:s.message||"No forecast available."})]})]}):(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsx)("h1",{className:"page-title",children:"Analytics"}),(0,r.jsx)("p",{className:"page-sub",children:"Usage statistics and projections"})]}),(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No analytics data available yet."})]})]})}},1837:function(e,t,s){"use strict";s.d(t,{KF:function(){return h},hi:function(){return x},jl:function(){return n},qz:function(){return i}});let r=s(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function n(){return!!a()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=t.method||"GET",n=a(),d={"Content-Type":"application/json",...t.headers};if(n&&(d.Authorization="Bearer ".concat(n)),"GET"===s&&!n){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let s=o.get(e);if(s)return s}let x=(async()=>{let a=await fetch("".concat(r).concat(e),{method:s,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&n&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let c=await a.json();return"GET"!==s||n||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===s&&!n){o.set(e,x);try{return await x}finally{o.delete(e)}}return x}let x={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var s;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return s=r.access_token,localStorage.setItem("nexus_token",s),r},getMe:()=>d("/api/auth/me"),logout:()=>{i(),l.clear(),window.location.href="/login"}},h=async e=>{let t=a(),s=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!s.ok)throw Error("Failed to download");let i=await s.blob(),n=URL.createObjectURL(i),c=document.createElement("a");c.href=n,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(n)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=7880)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/batch-api/page-93e9632550aa7e6c.js b/static/_next/static/chunks/app/batch-api/page-93e9632550aa7e6c.js deleted file mode 100644 index 8056ff7b8b162359f6b5d06a0bd21bc022904e46..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/batch-api/page-93e9632550aa7e6c.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5668],{8305:function(e,t,n){Promise.resolve().then(n.bind(n,8273))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:i=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...s,width:i,height:i,stroke:n,strokeWidth:o?24*Number(c)/Number(i):c,className:a("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let n=(0,r.forwardRef)((n,s)=>{let{className:o,...l}=n;return(0,r.createElement)(c,{ref:s,iconNode:t,className:a("lucide-".concat(i(e)),o),...l})});return n.displayName="".concat(e),n}},1671:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},9388:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},1723:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},8124:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},257:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function a(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var o=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?o=r.concat(o):u=-1,o.length&&h())}function h(){if(!l){var e=c(d);l=!0;for(var t=o.length;t;){for(r=o,o=[];++u1)for(var n=1;n{s(!0),l(null);try{let e=await a.hi.get("/api/batch/history");t(e)}catch(e){l(String(e))}finally{s(!1)}};(0,i.useEffect)(()=>{v()},[]);let w=async()=>{if(p.trim()&&g){b(!0);try{await a.hi.post("/api/batch",{jsonl:p,model:g}),m(!1),x(""),v()}catch(e){l(String(e))}finally{b(!1)}}};return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Batch API"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage batch inference jobs"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>m(!0),children:[(0,r.jsx)(u.Z,{size:16})," New Batch"]})]}),f&&(0,r.jsxs)("div",{className:"card mb-6",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold mb-3",children:"Create Batch Job"}),(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Model"}),(0,r.jsx)("input",{className:"input",value:g,onChange:e=>y(e.target.value),placeholder:"gpt-4o-mini"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"JSONL Input"}),(0,r.jsx)("textarea",{className:"input font-mono text-xs !min-h-[200px]",rows:8,value:p,onChange:e=>x(e.target.value),placeholder:'{"custom_id":"1","method":"POST","url":"/v1/chat/completions","body":{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hello"}]}}'})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary",onClick:w,disabled:j||!p.trim()||!g,children:j?"Creating...":"Create Batch"}),(0,r.jsx)("button",{className:"btn-secondary",onClick:()=>{m(!1),x("")},children:"Cancel"})]})]})]}),n&&(0,r.jsxs)("div",{className:"text-center py-16 text-[var(--text-tertiary)]",children:[(0,r.jsx)(c.Z,{size:40,className:"mx-auto mb-4 opacity-40"}),(0,r.jsx)("p",{children:"Loading batch jobs..."})]}),o&&(0,r.jsxs)("div",{className:"card border border-red-500/30",children:[(0,r.jsx)("p",{className:"text-red-400 text-sm",children:o}),(0,r.jsx)("button",{className:"btn-ghost btn-xs mt-2",onClick:v,children:"Retry"})]}),!n&&!o&&0===e.length&&(0,r.jsxs)("div",{className:"text-center py-16 text-[var(--text-tertiary)]",children:[(0,r.jsx)(c.Z,{size:40,className:"mx-auto mb-4 opacity-40"}),(0,r.jsx)("p",{children:"No batch jobs yet"}),(0,r.jsxs)("button",{className:"btn-primary mt-4",onClick:()=>m(!0),children:[(0,r.jsx)(u.Z,{size:16})," Create your first batch"]})]}),!n&&!o&&e.length>0&&(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"ID"}),(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Requests"}),(0,r.jsx)("th",{children:"Completed"}),(0,r.jsx)("th",{children:"Failed"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{children:"Created"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsxs)("td",{className:"font-mono text-xs",children:[e.id.slice(0,12),"..."]}),(0,r.jsx)("td",{children:e.model}),(0,r.jsx)("td",{children:e.request_count}),(0,r.jsx)("td",{children:e.completed_count}),(0,r.jsx)("td",{children:e.failed_count}),(0,r.jsx)("td",{children:(0,r.jsxs)("span",{className:"badge ".concat(d[e.status]||""),children:[h[e.status]," ",e.status]})}),(0,r.jsx)("td",{className:"text-xs text-[var(--text-secondary)]",children:new Date(e.created_at).toLocaleString()})]},e.id))})]})})})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return s},qz:function(){return a}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function i(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function s(){return!!i()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",s=i(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===n&&!s){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let i=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let c=await i.json();return"GET"!==n||s||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===n&&!s){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>u("/api/auth/me"),logout:()=>{a(),o.clear(),window.location.href="/login"}},h=async e=>{let t=i(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let a=await n.blob(),s=URL.createObjectURL(a),c=document.createElement("a");c.href=s,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=8305)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/batch-api/page-77c5fb2136ff3a1a.js b/static/_next/static/chunks/app/batch-api/page-efde9eb1301afc84.js similarity index 57% rename from static/_next/static/chunks/app/batch-api/page-77c5fb2136ff3a1a.js rename to static/_next/static/chunks/app/batch-api/page-efde9eb1301afc84.js index 8056ff7b8b162359f6b5d06a0bd21bc022904e46..a11788e876fab769f0c285e6769c791906914b76 100644 --- a/static/_next/static/chunks/app/batch-api/page-77c5fb2136ff3a1a.js +++ b/static/_next/static/chunks/app/batch-api/page-efde9eb1301afc84.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5668],{8305:function(e,t,n){Promise.resolve().then(n.bind(n,8273))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:i=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...s,width:i,height:i,stroke:n,strokeWidth:o?24*Number(c)/Number(i):c,className:a("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let n=(0,r.forwardRef)((n,s)=>{let{className:o,...l}=n;return(0,r.createElement)(c,{ref:s,iconNode:t,className:a("lucide-".concat(i(e)),o),...l})});return n.displayName="".concat(e),n}},1671:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},9388:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},1723:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},8124:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},257:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function a(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var o=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?o=r.concat(o):u=-1,o.length&&h())}function h(){if(!l){var e=c(d);l=!0;for(var t=o.length;t;){for(r=o,o=[];++u1)for(var n=1;n{s(!0),l(null);try{let e=await a.hi.get("/api/batch/history");t(e)}catch(e){l(String(e))}finally{s(!1)}};(0,i.useEffect)(()=>{v()},[]);let w=async()=>{if(p.trim()&&g){b(!0);try{await a.hi.post("/api/batch",{jsonl:p,model:g}),m(!1),x(""),v()}catch(e){l(String(e))}finally{b(!1)}}};return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Batch API"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage batch inference jobs"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>m(!0),children:[(0,r.jsx)(u.Z,{size:16})," New Batch"]})]}),f&&(0,r.jsxs)("div",{className:"card mb-6",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold mb-3",children:"Create Batch Job"}),(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Model"}),(0,r.jsx)("input",{className:"input",value:g,onChange:e=>y(e.target.value),placeholder:"gpt-4o-mini"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"JSONL Input"}),(0,r.jsx)("textarea",{className:"input font-mono text-xs !min-h-[200px]",rows:8,value:p,onChange:e=>x(e.target.value),placeholder:'{"custom_id":"1","method":"POST","url":"/v1/chat/completions","body":{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hello"}]}}'})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary",onClick:w,disabled:j||!p.trim()||!g,children:j?"Creating...":"Create Batch"}),(0,r.jsx)("button",{className:"btn-secondary",onClick:()=>{m(!1),x("")},children:"Cancel"})]})]})]}),n&&(0,r.jsxs)("div",{className:"text-center py-16 text-[var(--text-tertiary)]",children:[(0,r.jsx)(c.Z,{size:40,className:"mx-auto mb-4 opacity-40"}),(0,r.jsx)("p",{children:"Loading batch jobs..."})]}),o&&(0,r.jsxs)("div",{className:"card border border-red-500/30",children:[(0,r.jsx)("p",{className:"text-red-400 text-sm",children:o}),(0,r.jsx)("button",{className:"btn-ghost btn-xs mt-2",onClick:v,children:"Retry"})]}),!n&&!o&&0===e.length&&(0,r.jsxs)("div",{className:"text-center py-16 text-[var(--text-tertiary)]",children:[(0,r.jsx)(c.Z,{size:40,className:"mx-auto mb-4 opacity-40"}),(0,r.jsx)("p",{children:"No batch jobs yet"}),(0,r.jsxs)("button",{className:"btn-primary mt-4",onClick:()=>m(!0),children:[(0,r.jsx)(u.Z,{size:16})," Create your first batch"]})]}),!n&&!o&&e.length>0&&(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"ID"}),(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Requests"}),(0,r.jsx)("th",{children:"Completed"}),(0,r.jsx)("th",{children:"Failed"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{children:"Created"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsxs)("td",{className:"font-mono text-xs",children:[e.id.slice(0,12),"..."]}),(0,r.jsx)("td",{children:e.model}),(0,r.jsx)("td",{children:e.request_count}),(0,r.jsx)("td",{children:e.completed_count}),(0,r.jsx)("td",{children:e.failed_count}),(0,r.jsx)("td",{children:(0,r.jsxs)("span",{className:"badge ".concat(d[e.status]||""),children:[h[e.status]," ",e.status]})}),(0,r.jsx)("td",{className:"text-xs text-[var(--text-secondary)]",children:new Date(e.created_at).toLocaleString()})]},e.id))})]})})})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return s},qz:function(){return a}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function i(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function s(){return!!i()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",s=i(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===n&&!s){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let i=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let c=await i.json();return"GET"!==n||s||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===n&&!s){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>u("/api/auth/me"),logout:()=>{a(),o.clear(),window.location.href="/login"}},h=async e=>{let t=i(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let a=await n.blob(),s=URL.createObjectURL(a),c=document.createElement("a");c.href=s,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=8305)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5668],{8305:function(e,t,n){Promise.resolve().then(n.bind(n,8273))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:n,strokeWidth:o?24*Number(c)/Number(a):c,className:i("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let n=(0,r.forwardRef)((n,s)=>{let{className:o,...l}=n;return(0,r.createElement)(c,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),o),...l})});return n.displayName="".concat(e),n}},1671:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},9388:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},1723:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},8124:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var o=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?o=r.concat(o):u=-1,o.length&&h())}function h(){if(!l){var e=c(d);l=!0;for(var t=o.length;t;){for(r=o,o=[];++u1)for(var n=1;n{s(!0),l(null);try{let e=await i.hi.get("/api/batch/history");t(e)}catch(e){l(String(e))}finally{s(!1)}};(0,a.useEffect)(()=>{v()},[]);let w=async()=>{if(p.trim()&&g){b(!0);try{await i.hi.post("/api/batch",{jsonl:p,model:g}),m(!1),x(""),v()}catch(e){l(String(e))}finally{b(!1)}}};return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Batch API"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage batch inference jobs"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>m(!0),children:[(0,r.jsx)(u.Z,{size:16})," New Batch"]})]}),f&&(0,r.jsxs)("div",{className:"card mb-6",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold mb-3",children:"Create Batch Job"}),(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Model"}),(0,r.jsx)("input",{className:"input",value:g,onChange:e=>y(e.target.value),placeholder:"gpt-4o-mini"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"JSONL Input"}),(0,r.jsx)("textarea",{className:"input font-mono text-xs !min-h-[200px]",rows:8,value:p,onChange:e=>x(e.target.value),placeholder:'{"custom_id":"1","method":"POST","url":"/v1/chat/completions","body":{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hello"}]}}'})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary",onClick:w,disabled:j||!p.trim()||!g,children:j?"Creating...":"Create Batch"}),(0,r.jsx)("button",{className:"btn-secondary",onClick:()=>{m(!1),x("")},children:"Cancel"})]})]})]}),n&&(0,r.jsxs)("div",{className:"text-center py-16 text-[var(--text-tertiary)]",children:[(0,r.jsx)(c.Z,{size:40,className:"mx-auto mb-4 opacity-40"}),(0,r.jsx)("p",{children:"Loading batch jobs..."})]}),o&&(0,r.jsxs)("div",{className:"card border border-red-500/30",children:[(0,r.jsx)("p",{className:"text-red-400 text-sm",children:o}),(0,r.jsx)("button",{className:"btn-ghost btn-xs mt-2",onClick:v,children:"Retry"})]}),!n&&!o&&0===e.length&&(0,r.jsxs)("div",{className:"text-center py-16 text-[var(--text-tertiary)]",children:[(0,r.jsx)(c.Z,{size:40,className:"mx-auto mb-4 opacity-40"}),(0,r.jsx)("p",{children:"No batch jobs yet"}),(0,r.jsxs)("button",{className:"btn-primary mt-4",onClick:()=>m(!0),children:[(0,r.jsx)(u.Z,{size:16})," Create your first batch"]})]}),!n&&!o&&e.length>0&&(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"ID"}),(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Requests"}),(0,r.jsx)("th",{children:"Completed"}),(0,r.jsx)("th",{children:"Failed"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{children:"Created"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsxs)("td",{className:"font-mono text-xs",children:[e.id.slice(0,12),"..."]}),(0,r.jsx)("td",{children:e.model}),(0,r.jsx)("td",{children:e.request_count}),(0,r.jsx)("td",{children:e.completed_count}),(0,r.jsx)("td",{children:e.failed_count}),(0,r.jsx)("td",{children:(0,r.jsxs)("span",{className:"badge ".concat(d[e.status]||""),children:[h[e.status]," ",e.status]})}),(0,r.jsx)("td",{className:"text-xs text-[var(--text-secondary)]",children:new Date(e.created_at).toLocaleString()})]},e.id))})]})})})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return s},qz:function(){return i}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function i(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function s(){return!!a()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",s=a(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===n&&!s){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let c=await a.json();return"GET"!==n||s||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===n&&!s){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>u("/api/auth/me"),logout:()=>{i(),o.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let i=await n.blob(),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=8305)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/benchmarks/page-af8fe334210c6570.js b/static/_next/static/chunks/app/benchmarks/page-2971e504ea962b1e.js similarity index 67% rename from static/_next/static/chunks/app/benchmarks/page-af8fe334210c6570.js rename to static/_next/static/chunks/app/benchmarks/page-2971e504ea962b1e.js index 0ee4a97826fa750a2f16759853f411e2e4400a5a..6227616b1ef2ae0d050e1f6cd7c81054f5f7fb68 100644 --- a/static/_next/static/chunks/app/benchmarks/page-af8fe334210c6570.js +++ b/static/_next/static/chunks/app/benchmarks/page-2971e504ea962b1e.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1821],{5910:function(e,t,r){Promise.resolve().then(r.bind(r,4202))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:s=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,n.createElement)("svg",{ref:t,...i,width:s,height:s,stroke:r,strokeWidth:c?24*Number(l)/Number(s):l,className:a("lucide",o),...h},[...u.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:c,...o}=r;return(0,n.createElement)(l,{ref:i,iconNode:t,className:a("lucide-".concat(s(e)),c),...o})});return r.displayName="".concat(e),r}},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},8220:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]])},5621:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])},3276:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},8930:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},1239:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},257:function(e,t,r){"use strict";var n,s;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(s=r.g.process)?void 0:s.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,s=e.exports={};function a(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var c=[],o=!1,d=-1;function u(){o&&n&&(o=!1,n.length?c=n.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(n=c,c=[];++d1)for(var r=1;r{g(!0),N(""),a.hi.get("/api/benchmark/history").then(e=>{v(Array.isArray(e)?e:e.history||[])}).catch(e=>N(e instanceof Error?e.message:"Failed to load history")).finally(()=>g(!1))};(0,s.useEffect)(()=>{T()},[]);let E=async()=>{p(!0);try{let t=await a.hi.post("/api/benchmark/run",{test_prompt:e,max_tokens:r});m(t.results),T()}catch(e){m([])}finally{p(!1)}},Z=async()=>{if(confirm("Clear all benchmark history? This cannot be undone.")){w(!0);try{await a.hi.delete("/api/benchmark/history"),v([])}catch(e){N(e instanceof Error?e.message:"Failed to clear history")}finally{w(!1)}}};return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Benchmarks"}),(0,n.jsx)("p",{className:"page-sub",children:"Run test prompts across all configured providers and models"})]})}),(0,n.jsx)("div",{className:"card mb-6",children:(0,n.jsxs)("div",{className:"flex flex-wrap gap-4 items-end",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-[300px]",children:[(0,n.jsx)("label",{className:"label",children:"Test Prompt"}),(0,n.jsx)("textarea",{className:"input font-mono text-sm resize-none h-20",value:e,onChange:e=>t(e.target.value)})]}),(0,n.jsxs)("div",{className:"w-24",children:[(0,n.jsx)("label",{className:"label",children:"Max Tokens"}),(0,n.jsx)("input",{className:"input",type:"number",min:1,max:4096,value:r,onChange:e=>h(parseInt(e.target.value)||5)})]}),(0,n.jsxs)("div",{className:"flex gap-2 pb-1",children:[(0,n.jsxs)("button",{className:"btn-primary",onClick:E,disabled:f,children:[f?(0,n.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,n.jsx)(i.Z,{size:16}),"Run Benchmark"]}),x&&x.length>0&&(0,n.jsx)("button",{className:"btn-ghost btn-sm",onClick:()=>m(null),title:"Clear results",children:(0,n.jsx)(l.Z,{size:16})})]})]})}),f?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-48 w-full"})}):x?0===x.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"Benchmark completed but returned no results."})]}):(0,n.jsxs)("div",{className:"card p-0",children:[(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Key Name"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Model"}),(0,n.jsx)("th",{children:"Status"}),(0,n.jsx)("th",{children:"Latency"}),(0,n.jsx)("th",{children:"Cost"}),(0,n.jsx)("th",{children:"Error"})]})}),(0,n.jsx)("tbody",{children:x.map((e,t)=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"text-sm max-w-[160px] truncate",title:e.key_name,children:e.key_name}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"text-sm capitalize",children:e.provider})}),(0,n.jsx)("td",{className:"text-sm max-w-[200px] truncate",title:e.model,children:e.model}),(0,n.jsx)("td",{children:e.success?(0,n.jsxs)("span",{className:"badge-green",children:[(0,n.jsx)(o.Z,{size:12})," Success"]}):(0,n.jsx)("span",{className:"badge-red",children:"Fail"})}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:[e.latency_ms,"ms"]}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.cost).toFixed(6)]}),(0,n.jsx)("td",{className:"text-xs text-red-400 max-w-[200px] truncate",title:e.error||"",children:e.error||(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"—"})})]},t))})]})}),(0,n.jsxs)("div",{className:"px-4 py-2 text-xs text-[var(--text-tertiary)] border-t border-[var(--border)]",children:[x.length," result",1!==x.length?"s":""]})]}):(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No benchmarks run yet. Configure a prompt and click Run."})]}),(0,n.jsxs)("div",{className:"card mt-6",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(d.Z,{size:18,className:"text-[var(--text-tertiary)]"}),(0,n.jsx)("h2",{className:"text-lg font-semibold",children:"Benchmark History"})]}),y.length>0&&(0,n.jsxs)("button",{className:"btn-danger btn-sm",onClick:Z,disabled:k,children:[(0,n.jsx)(l.Z,{size:14}),k?"Clearing...":"Clear History"]})]}),b?(0,n.jsxs)("div",{className:"flex items-center gap-2 text-red-400 text-sm",children:[(0,n.jsx)(u.Z,{size:14})," ",b]}):j?(0,n.jsx)("div",{className:"skeleton h-24 w-full"}):0===y.length?(0,n.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No benchmark history yet. Run a benchmark to see results here."}):(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Run At"}),(0,n.jsx)("th",{children:"Prompt"}),(0,n.jsx)("th",{children:"Max Tokens"}),(0,n.jsx)("th",{children:"Total"}),(0,n.jsx)("th",{children:"Success"}),(0,n.jsx)("th",{children:"Avg Latency"}),(0,n.jsx)("th",{children:"Avg Cost"})]})}),(0,n.jsx)("tbody",{children:y.map(e=>{var t,r,s,a;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"text-xs text-[var(--text-tertiary)] whitespace-nowrap",children:e.run_at}),(0,n.jsx)("td",{className:"text-xs max-w-[200px] truncate",title:e.prompt,children:e.prompt}),(0,n.jsx)("td",{className:"text-xs",children:e.max_tokens}),(0,n.jsx)("td",{className:"text-xs",children:null!==(s=null===(t=e.summary)||void 0===t?void 0:t.total)&&void 0!==s?s:0}),(0,n.jsx)("td",{className:"text-xs",children:null!==(a=null===(r=e.summary)||void 0===r?void 0:r.success)&&void 0!==a?a:0}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:[e.summary?Math.round(e.summary.avg_latency):0,"ms"]}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:["$",e.summary?e.summary.avg_cost.toFixed(6):"0.000000"]})]},e.id)})})]})})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return a}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function s(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function i(){return!!s()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=s(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let u=(async()=>{let s=await fetch("".concat(n).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let l=await s.json();return"GET"!==r||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===r&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>d("/api/auth/me"),logout:()=>{a(),c.clear(),window.location.href="/login"}},h=async e=>{let t=s(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let a=await r.blob(),i=URL.createObjectURL(a),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=5910)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1821],{5910:function(e,t,r){Promise.resolve().then(r.bind(r,4202))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:s=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:o="",children:d,iconNode:u,...h}=e;return(0,n.createElement)("svg",{ref:t,...i,width:s,height:s,stroke:r,strokeWidth:l?24*Number(c)/Number(s):c,className:a("lucide",o),...h},[...u.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:l,...o}=r;return(0,n.createElement)(c,{ref:i,iconNode:t,className:a("lucide-".concat(s(e)),l),...o})});return r.displayName="".concat(e),r}},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},8220:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]])},5621:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])},3276:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},8930:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},1239:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},257:function(e,t,r){"use strict";var n,s;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(s=r.g.process)?void 0:s.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,s=e.exports={};function a(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var l=[],o=!1,d=-1;function u(){o&&n&&(o=!1,n.length?l=n.concat(l):d=-1,l.length&&h())}function h(){if(!o){var e=c(u);o=!0;for(var t=l.length;t;){for(n=l,l=[];++d1)for(var r=1;r{g(!0),k(""),a.hi.get("/api/benchmark/history").then(e=>{v(Array.isArray(e)?e:e.history||[])}).catch(e=>k(e instanceof Error?e.message:"Failed to load history")).finally(()=>g(!1))};(0,s.useEffect)(()=>{T()},[]);let E=async()=>{f(!0);try{let t=await a.hi.post("/api/benchmark/run",{test_prompt:e,max_tokens:r});m(t.results),T()}catch(e){m([])}finally{f(!1)}},_=async()=>{if(confirm("Clear all benchmark history? This cannot be undone.")){N(!0);try{await a.hi.delete("/api/benchmark/history"),v([])}catch(e){k(e instanceof Error?e.message:"Failed to clear history")}finally{N(!1)}}};return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Benchmarks"}),(0,n.jsx)("p",{className:"page-sub",children:"Run test prompts across all configured providers and models"})]})}),(0,n.jsx)("div",{className:"card mb-6",children:(0,n.jsxs)("div",{className:"flex flex-wrap gap-4 items-end",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-[300px]",children:[(0,n.jsx)("label",{className:"label",children:"Test Prompt"}),(0,n.jsx)("textarea",{className:"input font-mono text-sm resize-none h-20",value:e,onChange:e=>t(e.target.value)})]}),(0,n.jsxs)("div",{className:"w-24",children:[(0,n.jsx)("label",{className:"label",children:"Max Tokens"}),(0,n.jsx)("input",{className:"input",type:"number",min:1,max:4096,value:r,onChange:e=>h(parseInt(e.target.value)||5)})]}),(0,n.jsxs)("div",{className:"flex gap-2 pb-1",children:[(0,n.jsxs)("button",{className:"btn-primary",onClick:E,disabled:p,children:[p?(0,n.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,n.jsx)(i.Z,{size:16}),"Run Benchmark"]}),x&&x.length>0&&(0,n.jsx)("button",{className:"btn-ghost btn-sm",onClick:()=>m(null),title:"Clear results",children:(0,n.jsx)(c.Z,{size:16})})]})]})}),p?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-48 w-full"})}):x?0===x.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"Benchmark completed but returned no results."})]}):(0,n.jsxs)("div",{className:"card p-0",children:[(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Key Name"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Model"}),(0,n.jsx)("th",{children:"Status"}),(0,n.jsx)("th",{children:"Latency"}),(0,n.jsx)("th",{children:"Cost"}),(0,n.jsx)("th",{children:"Error"})]})}),(0,n.jsx)("tbody",{children:x.map((e,t)=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"text-sm max-w-[160px] truncate",title:e.key_name,children:e.key_name}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"text-sm capitalize",children:e.provider})}),(0,n.jsx)("td",{className:"text-sm max-w-[200px] truncate",title:e.model,children:e.model}),(0,n.jsx)("td",{children:e.success?(0,n.jsxs)("span",{className:"badge-green",children:[(0,n.jsx)(o.Z,{size:12})," Success"]}):(0,n.jsx)("span",{className:"badge-red",children:"Fail"})}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:[e.latency_ms,"ms"]}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.cost).toFixed(6)]}),(0,n.jsx)("td",{className:"text-xs text-red-400 max-w-[200px] truncate",title:e.error||"",children:e.error||(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"—"})})]},t))})]})}),(0,n.jsxs)("div",{className:"px-4 py-2 text-xs text-[var(--text-tertiary)] border-t border-[var(--border)]",children:[x.length," result",1!==x.length?"s":""]})]}):(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No benchmarks run yet. Configure a prompt and click Run."})]}),(0,n.jsxs)("div",{className:"card mt-6",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(d.Z,{size:18,className:"text-[var(--text-tertiary)]"}),(0,n.jsx)("h2",{className:"text-lg font-semibold",children:"Benchmark History"})]}),y.length>0&&(0,n.jsxs)("button",{className:"btn-danger btn-sm",onClick:_,disabled:w,children:[(0,n.jsx)(c.Z,{size:14}),w?"Clearing...":"Clear History"]})]}),b?(0,n.jsxs)("div",{className:"flex items-center gap-2 text-red-400 text-sm",children:[(0,n.jsx)(u.Z,{size:14})," ",b]}):j?(0,n.jsx)("div",{className:"skeleton h-24 w-full"}):0===y.length?(0,n.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No benchmark history yet. Run a benchmark to see results here."}):(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Run At"}),(0,n.jsx)("th",{children:"Prompt"}),(0,n.jsx)("th",{children:"Max Tokens"}),(0,n.jsx)("th",{children:"Total"}),(0,n.jsx)("th",{children:"Success"}),(0,n.jsx)("th",{children:"Avg Latency"}),(0,n.jsx)("th",{children:"Avg Cost"})]})}),(0,n.jsx)("tbody",{children:y.map(e=>{var t,r,s,a;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"text-xs text-[var(--text-tertiary)] whitespace-nowrap",children:e.run_at}),(0,n.jsx)("td",{className:"text-xs max-w-[200px] truncate",title:e.prompt,children:e.prompt}),(0,n.jsx)("td",{className:"text-xs",children:e.max_tokens}),(0,n.jsx)("td",{className:"text-xs",children:null!==(s=null===(t=e.summary)||void 0===t?void 0:t.total)&&void 0!==s?s:0}),(0,n.jsx)("td",{className:"text-xs",children:null!==(a=null===(r=e.summary)||void 0===r?void 0:r.success)&&void 0!==a?a:0}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:[e.summary?Math.round(e.summary.avg_latency):0,"ms"]}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:["$",e.summary?e.summary.avg_cost.toFixed(6):"0.000000"]})]},e.id)})})]})})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return a}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function s(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function a(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!s()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=s(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let u=(async()=>{let s=await fetch("".concat(n).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let c=await s.json();return"GET"!==r||i||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===r&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),function(e,t,r){try{let r="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(r)}catch(e){}}("nexus_token",r,0),n},getMe:()=>d("/api/auth/me"),logout:()=>{a(),l.clear(),window.location.href="/login"}},h=async e=>{let t=s(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let a=await r.blob(),i=URL.createObjectURL(a),c=document.createElement("a");c.href=i,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=5910)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/benchmarks/page-d6e2b98299937e6a.js b/static/_next/static/chunks/app/benchmarks/page-d6e2b98299937e6a.js deleted file mode 100644 index 0ee4a97826fa750a2f16759853f411e2e4400a5a..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/benchmarks/page-d6e2b98299937e6a.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1821],{5910:function(e,t,r){Promise.resolve().then(r.bind(r,4202))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:s=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,n.createElement)("svg",{ref:t,...i,width:s,height:s,stroke:r,strokeWidth:c?24*Number(l)/Number(s):l,className:a("lucide",o),...h},[...u.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:c,...o}=r;return(0,n.createElement)(l,{ref:i,iconNode:t,className:a("lucide-".concat(s(e)),c),...o})});return r.displayName="".concat(e),r}},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},8220:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]])},5621:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])},3276:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},8930:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},1239:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},257:function(e,t,r){"use strict";var n,s;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(s=r.g.process)?void 0:s.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,s=e.exports={};function a(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var c=[],o=!1,d=-1;function u(){o&&n&&(o=!1,n.length?c=n.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(n=c,c=[];++d1)for(var r=1;r{g(!0),N(""),a.hi.get("/api/benchmark/history").then(e=>{v(Array.isArray(e)?e:e.history||[])}).catch(e=>N(e instanceof Error?e.message:"Failed to load history")).finally(()=>g(!1))};(0,s.useEffect)(()=>{T()},[]);let E=async()=>{p(!0);try{let t=await a.hi.post("/api/benchmark/run",{test_prompt:e,max_tokens:r});m(t.results),T()}catch(e){m([])}finally{p(!1)}},Z=async()=>{if(confirm("Clear all benchmark history? This cannot be undone.")){w(!0);try{await a.hi.delete("/api/benchmark/history"),v([])}catch(e){N(e instanceof Error?e.message:"Failed to clear history")}finally{w(!1)}}};return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Benchmarks"}),(0,n.jsx)("p",{className:"page-sub",children:"Run test prompts across all configured providers and models"})]})}),(0,n.jsx)("div",{className:"card mb-6",children:(0,n.jsxs)("div",{className:"flex flex-wrap gap-4 items-end",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-[300px]",children:[(0,n.jsx)("label",{className:"label",children:"Test Prompt"}),(0,n.jsx)("textarea",{className:"input font-mono text-sm resize-none h-20",value:e,onChange:e=>t(e.target.value)})]}),(0,n.jsxs)("div",{className:"w-24",children:[(0,n.jsx)("label",{className:"label",children:"Max Tokens"}),(0,n.jsx)("input",{className:"input",type:"number",min:1,max:4096,value:r,onChange:e=>h(parseInt(e.target.value)||5)})]}),(0,n.jsxs)("div",{className:"flex gap-2 pb-1",children:[(0,n.jsxs)("button",{className:"btn-primary",onClick:E,disabled:f,children:[f?(0,n.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,n.jsx)(i.Z,{size:16}),"Run Benchmark"]}),x&&x.length>0&&(0,n.jsx)("button",{className:"btn-ghost btn-sm",onClick:()=>m(null),title:"Clear results",children:(0,n.jsx)(l.Z,{size:16})})]})]})}),f?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-48 w-full"})}):x?0===x.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"Benchmark completed but returned no results."})]}):(0,n.jsxs)("div",{className:"card p-0",children:[(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Key Name"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Model"}),(0,n.jsx)("th",{children:"Status"}),(0,n.jsx)("th",{children:"Latency"}),(0,n.jsx)("th",{children:"Cost"}),(0,n.jsx)("th",{children:"Error"})]})}),(0,n.jsx)("tbody",{children:x.map((e,t)=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"text-sm max-w-[160px] truncate",title:e.key_name,children:e.key_name}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"text-sm capitalize",children:e.provider})}),(0,n.jsx)("td",{className:"text-sm max-w-[200px] truncate",title:e.model,children:e.model}),(0,n.jsx)("td",{children:e.success?(0,n.jsxs)("span",{className:"badge-green",children:[(0,n.jsx)(o.Z,{size:12})," Success"]}):(0,n.jsx)("span",{className:"badge-red",children:"Fail"})}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:[e.latency_ms,"ms"]}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.cost).toFixed(6)]}),(0,n.jsx)("td",{className:"text-xs text-red-400 max-w-[200px] truncate",title:e.error||"",children:e.error||(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"—"})})]},t))})]})}),(0,n.jsxs)("div",{className:"px-4 py-2 text-xs text-[var(--text-tertiary)] border-t border-[var(--border)]",children:[x.length," result",1!==x.length?"s":""]})]}):(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No benchmarks run yet. Configure a prompt and click Run."})]}),(0,n.jsxs)("div",{className:"card mt-6",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(d.Z,{size:18,className:"text-[var(--text-tertiary)]"}),(0,n.jsx)("h2",{className:"text-lg font-semibold",children:"Benchmark History"})]}),y.length>0&&(0,n.jsxs)("button",{className:"btn-danger btn-sm",onClick:Z,disabled:k,children:[(0,n.jsx)(l.Z,{size:14}),k?"Clearing...":"Clear History"]})]}),b?(0,n.jsxs)("div",{className:"flex items-center gap-2 text-red-400 text-sm",children:[(0,n.jsx)(u.Z,{size:14})," ",b]}):j?(0,n.jsx)("div",{className:"skeleton h-24 w-full"}):0===y.length?(0,n.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No benchmark history yet. Run a benchmark to see results here."}):(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Run At"}),(0,n.jsx)("th",{children:"Prompt"}),(0,n.jsx)("th",{children:"Max Tokens"}),(0,n.jsx)("th",{children:"Total"}),(0,n.jsx)("th",{children:"Success"}),(0,n.jsx)("th",{children:"Avg Latency"}),(0,n.jsx)("th",{children:"Avg Cost"})]})}),(0,n.jsx)("tbody",{children:y.map(e=>{var t,r,s,a;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"text-xs text-[var(--text-tertiary)] whitespace-nowrap",children:e.run_at}),(0,n.jsx)("td",{className:"text-xs max-w-[200px] truncate",title:e.prompt,children:e.prompt}),(0,n.jsx)("td",{className:"text-xs",children:e.max_tokens}),(0,n.jsx)("td",{className:"text-xs",children:null!==(s=null===(t=e.summary)||void 0===t?void 0:t.total)&&void 0!==s?s:0}),(0,n.jsx)("td",{className:"text-xs",children:null!==(a=null===(r=e.summary)||void 0===r?void 0:r.success)&&void 0!==a?a:0}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:[e.summary?Math.round(e.summary.avg_latency):0,"ms"]}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:["$",e.summary?e.summary.avg_cost.toFixed(6):"0.000000"]})]},e.id)})})]})})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return a}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function s(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function i(){return!!s()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=s(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let u=(async()=>{let s=await fetch("".concat(n).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let l=await s.json();return"GET"!==r||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===r&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>d("/api/auth/me"),logout:()=>{a(),c.clear(),window.location.href="/login"}},h=async e=>{let t=s(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let a=await r.blob(),i=URL.createObjectURL(a),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=5910)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/cache/page-02c4a057138aaaad.js b/static/_next/static/chunks/app/cache/page-02c4a057138aaaad.js deleted file mode 100644 index 32e7ecfe10beccb9b800fbfb4fd7ce8bddb9ae05..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/cache/page-02c4a057138aaaad.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4231],{6977:function(e,t,r){Promise.resolve().then(r.bind(r,6593))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var a=r(2265);let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,a.forwardRef)((e,t)=>{let{color:r="currentColor",size:n=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:o="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...s,width:n,height:n,stroke:r,strokeWidth:l?24*Number(c)/Number(n):c,className:i("lucide",o),...h},[...u.map(e=>{let[t,r]=e;return(0,a.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let r=(0,a.forwardRef)((r,s)=>{let{className:l,...o}=r;return(0,a.createElement)(c,{ref:s,iconNode:t,className:i("lucide-".concat(n(e)),l),...o})});return r.displayName="".concat(e),r}},91:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},7168:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},8930:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},1239:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},257:function(e,t,r){"use strict";var a,n;e.exports=(null==(a=r.g.process)?void 0:a.env)&&"object"==typeof(null==(n=r.g.process)?void 0:n.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,a,n=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var l=[],o=!1,d=-1;function u(){o&&a&&(o=!1,a.length?l=a.concat(l):d=-1,l.length&&h())}function h(){if(!o){var e=c(u);o=!0;for(var t=l.length;t;){for(a=l,l=[];++d1)for(var r=1;r{h(!0),f("");try{let e=await i.hi.get("/api/cache/stats");t(e)}catch(e){f(e instanceof Error?e.message:"Failed to load cache stats")}finally{h(!1)}};(0,n.useEffect)(()=>{v()},[]);let y=async(e,t,r)=>{if(window.confirm("Are you sure you want to clear the ".concat(t,"?"))){p(e);try{await i.hi.delete(r),await v()}catch(e){f(e instanceof Error?e.message:"Failed to clear ".concat(t))}finally{p(null)}}};return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)("div",{className:"page-header",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"Cache Management"}),(0,a.jsx)("p",{className:"page-sub",children:"View and manage BYOK AI Gateway cache entries"})]}),(0,a.jsxs)("button",{className:"btn-secondary",onClick:v,disabled:r,children:[(0,a.jsx)(s.Z,{size:16,className:r?"animate-spin":""}),"Refresh"]})]}),x&&(0,a.jsx)("div",{className:"card border border-red-500/30 bg-red-500/10 p-4 text-red-400 text-sm",children:x}),r&&!e?(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[1,2,3,4].map(e=>(0,a.jsxs)("div",{className:"card animate-pulse p-6",children:[(0,a.jsx)("div",{className:"h-4 w-24 bg-[var(--surface-100)] rounded mb-3"}),(0,a.jsx)("div",{className:"h-8 w-16 bg-[var(--surface-100)] rounded mb-2"}),(0,a.jsx)("div",{className:"h-3 w-32 bg-[var(--surface-100)] rounded"})]},e))}):e?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[var(--text-secondary)] text-sm mb-3",children:[(0,a.jsx)(c.Z,{size:16}),(0,a.jsx)("span",{children:"Exact Cache"})]}),(0,a.jsx)("div",{className:"text-2xl font-bold text-white mb-1",children:e.exact_count}),(0,a.jsx)("div",{className:"text-xs text-[var(--text-tertiary)]",children:u(e.exact_size_bytes)})]}),(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[var(--text-secondary)] text-sm mb-3",children:[(0,a.jsx)(l.Z,{size:16}),(0,a.jsx)("span",{children:"Semantic Cache"})]}),(0,a.jsx)("div",{className:"text-2xl font-bold text-white mb-1",children:e.semantic_count}),(0,a.jsx)("div",{className:"text-xs text-[var(--text-tertiary)]",children:u(e.semantic_size_bytes)})]}),(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[var(--text-secondary)] text-sm mb-3",children:[(0,a.jsx)(o,{size:16}),(0,a.jsx)("span",{children:"Hit Rate"})]}),(0,a.jsxs)("div",{className:"text-2xl font-bold text-white mb-1",children:[(100*e.hit_rate).toFixed(1),"%"]}),(0,a.jsx)("div",{className:"text-xs text-[var(--text-tertiary)]",children:"Cache efficiency"})]}),(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[var(--text-secondary)] text-sm mb-3",children:[(0,a.jsx)(s.Z,{size:16}),(0,a.jsx)("span",{children:"TTL"})]}),(0,a.jsxs)("div",{className:"text-2xl font-bold text-white mb-1",children:[e.ttl,"s"]}),(0,a.jsx)("div",{className:"text-xs text-[var(--text-tertiary)]",children:"Cache expiry"})]})]}),(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white mb-4",children:"Clear Cache"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,a.jsxs)("button",{className:"btn-secondary",onClick:()=>y("exact","Exact Cache","/api/cache/exact"),disabled:null!==m,children:[(0,a.jsx)(d.Z,{size:16}),"exact"===m?"Clearing...":"Clear Exact Cache"]}),(0,a.jsxs)("button",{className:"btn-secondary",onClick:()=>y("semantic","Semantic Cache","/api/cache/semantic"),disabled:null!==m,children:[(0,a.jsx)(d.Z,{size:16}),"semantic"===m?"Clearing...":"Clear Semantic Cache"]}),(0,a.jsxs)("button",{className:"btn-danger",onClick:()=>y("all","All Cache","/api/cache/clear"),disabled:null!==m,children:[(0,a.jsx)(d.Z,{size:16}),"all"===m?"Clearing...":"Clear All Cache"]})]})]})]}):null]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return s},qz:function(){return i}});let a=r(257).env.NEXT_PUBLIC_API_BASE||"";function n(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function s(){return!!n()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",s=n(),d={"Content-Type":"application/json",...t.headers};if(s&&(d.Authorization="Bearer ".concat(s)),"GET"===r&&!s){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let u=(async()=>{let n=await fetch("".concat(a).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return n;if(401===n.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!n.ok)throw Error((await n.json().catch(()=>({detail:n.statusText}))).detail||"HTTP ".concat(n.status));if(204===n.status)return;let c=await n.json();return"GET"!==r||s||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===r&&!s){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=a.access_token,localStorage.setItem("nexus_token",r),a},getMe:()=>d("/api/auth/me"),logout:()=>{i(),l.clear(),window.location.href="/login"}},h=async e=>{let t=n(),r=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let i=await r.blob(),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=6977)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/cache/page-16bf5ae5f751e0ae.js b/static/_next/static/chunks/app/cache/page-16bf5ae5f751e0ae.js new file mode 100644 index 0000000000000000000000000000000000000000..a0822d66d780f4ac70e984fe14ec94a3846f0496 --- /dev/null +++ b/static/_next/static/chunks/app/cache/page-16bf5ae5f751e0ae.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4231],{6977:function(e,t,n){Promise.resolve().then(n.bind(n,6593))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var a=n(2265);let r=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),c=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,a.forwardRef)((e,t)=>{let{color:n="currentColor",size:r=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:l="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...i,width:r,height:r,stroke:n,strokeWidth:o?24*Number(s)/Number(r):s,className:c("lucide",l),...h},[...u.map(e=>{let[t,n]=e;return(0,a.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),o=(e,t)=>{let n=(0,a.forwardRef)((n,i)=>{let{className:o,...l}=n;return(0,a.createElement)(s,{ref:i,iconNode:t,className:c("lucide-".concat(r(e)),o),...l})});return n.displayName="".concat(e),n}},91:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},7168:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},1239:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},257:function(e,t,n){"use strict";var a,r;e.exports=(null==(a=n.g.process)?void 0:a.env)&&"object"==typeof(null==(r=n.g.process)?void 0:r.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,a,r=e.exports={};function c(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===c||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:c}catch(e){t=c}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var o=[],l=!1,d=-1;function u(){l&&a&&(l=!1,a.length?o=a.concat(o):d=-1,o.length&&h())}function h(){if(!l){var e=s(u);l=!0;for(var t=o.length;t;){for(a=o,o=[];++d1)for(var n=1;n{h(!0),f("");try{let e=await c.hi.get("/api/cache/stats");t(e)}catch(e){f(e instanceof Error?e.message:"Failed to load cache stats")}finally{h(!1)}};(0,r.useEffect)(()=>{v()},[]);let y=async(e,t,n)=>{if(window.confirm("Are you sure you want to clear the ".concat(t,"?"))){p(e);try{await c.hi.delete(n),await v()}catch(e){f(e instanceof Error?e.message:"Failed to clear ".concat(t))}finally{p(null)}}};return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)("div",{className:"page-header",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"Cache Management"}),(0,a.jsx)("p",{className:"page-sub",children:"View and manage BYOK AI Gateway cache entries"})]}),(0,a.jsxs)("button",{className:"btn-secondary",onClick:v,disabled:n,children:[(0,a.jsx)(i.Z,{size:16,className:n?"animate-spin":""}),"Refresh"]})]}),x&&(0,a.jsx)("div",{className:"card border border-red-500/30 bg-red-500/10 p-4 text-red-400 text-sm",children:x}),n&&!e?(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[1,2,3,4].map(e=>(0,a.jsxs)("div",{className:"card animate-pulse p-6",children:[(0,a.jsx)("div",{className:"h-4 w-24 bg-[var(--surface-100)] rounded mb-3"}),(0,a.jsx)("div",{className:"h-8 w-16 bg-[var(--surface-100)] rounded mb-2"}),(0,a.jsx)("div",{className:"h-3 w-32 bg-[var(--surface-100)] rounded"})]},e))}):e?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[var(--text-secondary)] text-sm mb-3",children:[(0,a.jsx)(s.Z,{size:16}),(0,a.jsx)("span",{children:"Exact Cache"})]}),(0,a.jsx)("div",{className:"text-2xl font-bold text-white mb-1",children:e.exact_count}),(0,a.jsx)("div",{className:"text-xs text-[var(--text-tertiary)]",children:u(e.exact_size_bytes)})]}),(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[var(--text-secondary)] text-sm mb-3",children:[(0,a.jsx)(o.Z,{size:16}),(0,a.jsx)("span",{children:"Semantic Cache"})]}),(0,a.jsx)("div",{className:"text-2xl font-bold text-white mb-1",children:e.semantic_count}),(0,a.jsx)("div",{className:"text-xs text-[var(--text-tertiary)]",children:u(e.semantic_size_bytes)})]}),(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[var(--text-secondary)] text-sm mb-3",children:[(0,a.jsx)(l,{size:16}),(0,a.jsx)("span",{children:"Hit Rate"})]}),(0,a.jsxs)("div",{className:"text-2xl font-bold text-white mb-1",children:[(100*e.hit_rate).toFixed(1),"%"]}),(0,a.jsx)("div",{className:"text-xs text-[var(--text-tertiary)]",children:"Cache efficiency"})]}),(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[var(--text-secondary)] text-sm mb-3",children:[(0,a.jsx)(i.Z,{size:16}),(0,a.jsx)("span",{children:"TTL"})]}),(0,a.jsxs)("div",{className:"text-2xl font-bold text-white mb-1",children:[e.ttl,"s"]}),(0,a.jsx)("div",{className:"text-xs text-[var(--text-tertiary)]",children:"Cache expiry"})]})]}),(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white mb-4",children:"Clear Cache"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,a.jsxs)("button",{className:"btn-secondary",onClick:()=>y("exact","Exact Cache","/api/cache/exact"),disabled:null!==m,children:[(0,a.jsx)(d.Z,{size:16}),"exact"===m?"Clearing...":"Clear Exact Cache"]}),(0,a.jsxs)("button",{className:"btn-secondary",onClick:()=>y("semantic","Semantic Cache","/api/cache/semantic"),disabled:null!==m,children:[(0,a.jsx)(d.Z,{size:16}),"semantic"===m?"Clearing...":"Clear Semantic Cache"]}),(0,a.jsxs)("button",{className:"btn-danger",onClick:()=>y("all","All Cache","/api/cache/clear"),disabled:null!==m,children:[(0,a.jsx)(d.Z,{size:16}),"all"===m?"Clearing...":"Clear All Cache"]})]})]})]}):null]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return c}});let a=n(257).env.NEXT_PUBLIC_API_BASE||"";function r(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function c(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!r()}let s={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,l=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=r(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in s)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return s[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let u=(async()=>{let r=await fetch("".concat(a).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return r;if(401===r.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw c(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!r.ok)throw Error((await r.json().catch(()=>({detail:r.statusText}))).detail||"HTTP ".concat(r.status));if(204===r.status)return;let s=await r.json();return"GET"!==n||i||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,s),s})();if("GET"===n&&!i){l.set(e,u);try{return await u}finally{l.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=a.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),a},getMe:()=>d("/api/auth/me"),logout:()=>{c(),o.clear(),window.location.href="/login"}},h=async e=>{let t=r(),n=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let c=await n.blob(),i=URL.createObjectURL(c),s=document.createElement("a");s.href=i,s.download=e.split("/").pop()||"export.csv",s.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=6977)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/cache/page-1dceb2a7e680cdb2.js b/static/_next/static/chunks/app/cache/page-1dceb2a7e680cdb2.js deleted file mode 100644 index 32e7ecfe10beccb9b800fbfb4fd7ce8bddb9ae05..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/cache/page-1dceb2a7e680cdb2.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4231],{6977:function(e,t,r){Promise.resolve().then(r.bind(r,6593))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var a=r(2265);let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,a.forwardRef)((e,t)=>{let{color:r="currentColor",size:n=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:o="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...s,width:n,height:n,stroke:r,strokeWidth:l?24*Number(c)/Number(n):c,className:i("lucide",o),...h},[...u.map(e=>{let[t,r]=e;return(0,a.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let r=(0,a.forwardRef)((r,s)=>{let{className:l,...o}=r;return(0,a.createElement)(c,{ref:s,iconNode:t,className:i("lucide-".concat(n(e)),l),...o})});return r.displayName="".concat(e),r}},91:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},7168:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},8930:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},1239:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(9205).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},257:function(e,t,r){"use strict";var a,n;e.exports=(null==(a=r.g.process)?void 0:a.env)&&"object"==typeof(null==(n=r.g.process)?void 0:n.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,a,n=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var l=[],o=!1,d=-1;function u(){o&&a&&(o=!1,a.length?l=a.concat(l):d=-1,l.length&&h())}function h(){if(!o){var e=c(u);o=!0;for(var t=l.length;t;){for(a=l,l=[];++d1)for(var r=1;r{h(!0),f("");try{let e=await i.hi.get("/api/cache/stats");t(e)}catch(e){f(e instanceof Error?e.message:"Failed to load cache stats")}finally{h(!1)}};(0,n.useEffect)(()=>{v()},[]);let y=async(e,t,r)=>{if(window.confirm("Are you sure you want to clear the ".concat(t,"?"))){p(e);try{await i.hi.delete(r),await v()}catch(e){f(e instanceof Error?e.message:"Failed to clear ".concat(t))}finally{p(null)}}};return(0,a.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,a.jsxs)("div",{className:"page-header",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"Cache Management"}),(0,a.jsx)("p",{className:"page-sub",children:"View and manage BYOK AI Gateway cache entries"})]}),(0,a.jsxs)("button",{className:"btn-secondary",onClick:v,disabled:r,children:[(0,a.jsx)(s.Z,{size:16,className:r?"animate-spin":""}),"Refresh"]})]}),x&&(0,a.jsx)("div",{className:"card border border-red-500/30 bg-red-500/10 p-4 text-red-400 text-sm",children:x}),r&&!e?(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[1,2,3,4].map(e=>(0,a.jsxs)("div",{className:"card animate-pulse p-6",children:[(0,a.jsx)("div",{className:"h-4 w-24 bg-[var(--surface-100)] rounded mb-3"}),(0,a.jsx)("div",{className:"h-8 w-16 bg-[var(--surface-100)] rounded mb-2"}),(0,a.jsx)("div",{className:"h-3 w-32 bg-[var(--surface-100)] rounded"})]},e))}):e?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[var(--text-secondary)] text-sm mb-3",children:[(0,a.jsx)(c.Z,{size:16}),(0,a.jsx)("span",{children:"Exact Cache"})]}),(0,a.jsx)("div",{className:"text-2xl font-bold text-white mb-1",children:e.exact_count}),(0,a.jsx)("div",{className:"text-xs text-[var(--text-tertiary)]",children:u(e.exact_size_bytes)})]}),(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[var(--text-secondary)] text-sm mb-3",children:[(0,a.jsx)(l.Z,{size:16}),(0,a.jsx)("span",{children:"Semantic Cache"})]}),(0,a.jsx)("div",{className:"text-2xl font-bold text-white mb-1",children:e.semantic_count}),(0,a.jsx)("div",{className:"text-xs text-[var(--text-tertiary)]",children:u(e.semantic_size_bytes)})]}),(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[var(--text-secondary)] text-sm mb-3",children:[(0,a.jsx)(o,{size:16}),(0,a.jsx)("span",{children:"Hit Rate"})]}),(0,a.jsxs)("div",{className:"text-2xl font-bold text-white mb-1",children:[(100*e.hit_rate).toFixed(1),"%"]}),(0,a.jsx)("div",{className:"text-xs text-[var(--text-tertiary)]",children:"Cache efficiency"})]}),(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-[var(--text-secondary)] text-sm mb-3",children:[(0,a.jsx)(s.Z,{size:16}),(0,a.jsx)("span",{children:"TTL"})]}),(0,a.jsxs)("div",{className:"text-2xl font-bold text-white mb-1",children:[e.ttl,"s"]}),(0,a.jsx)("div",{className:"text-xs text-[var(--text-tertiary)]",children:"Cache expiry"})]})]}),(0,a.jsxs)("div",{className:"card p-6",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white mb-4",children:"Clear Cache"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,a.jsxs)("button",{className:"btn-secondary",onClick:()=>y("exact","Exact Cache","/api/cache/exact"),disabled:null!==m,children:[(0,a.jsx)(d.Z,{size:16}),"exact"===m?"Clearing...":"Clear Exact Cache"]}),(0,a.jsxs)("button",{className:"btn-secondary",onClick:()=>y("semantic","Semantic Cache","/api/cache/semantic"),disabled:null!==m,children:[(0,a.jsx)(d.Z,{size:16}),"semantic"===m?"Clearing...":"Clear Semantic Cache"]}),(0,a.jsxs)("button",{className:"btn-danger",onClick:()=>y("all","All Cache","/api/cache/clear"),disabled:null!==m,children:[(0,a.jsx)(d.Z,{size:16}),"all"===m?"Clearing...":"Clear All Cache"]})]})]})]}):null]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return s},qz:function(){return i}});let a=r(257).env.NEXT_PUBLIC_API_BASE||"";function n(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function s(){return!!n()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",s=n(),d={"Content-Type":"application/json",...t.headers};if(s&&(d.Authorization="Bearer ".concat(s)),"GET"===r&&!s){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let u=(async()=>{let n=await fetch("".concat(a).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return n;if(401===n.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!n.ok)throw Error((await n.json().catch(()=>({detail:n.statusText}))).detail||"HTTP ".concat(n.status));if(204===n.status)return;let c=await n.json();return"GET"!==r||s||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===r&&!s){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=a.access_token,localStorage.setItem("nexus_token",r),a},getMe:()=>d("/api/auth/me"),logout:()=>{i(),l.clear(),window.location.href="/login"}},h=async e=>{let t=n(),r=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let i=await r.blob(),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=6977)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/chat/page-eccb2a38589380fd.js b/static/_next/static/chunks/app/chat/page-eccb2a38589380fd.js deleted file mode 100644 index 7f409c69366d5b63fc80ad161f203eba9a934cb0..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/chat/page-eccb2a38589380fd.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{2468:function(e,t,n){Promise.resolve().then(n.bind(n,628))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var a=n(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,a.forwardRef)((e,t)=>{let{color:n="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:c="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...l,width:s,height:s,stroke:n,strokeWidth:o?24*Number(i)/Number(s):i,className:r("lucide",c),...h},[...u.map(e=>{let[t,n]=e;return(0,a.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),o=(e,t)=>{let n=(0,a.forwardRef)((n,l)=>{let{className:o,...c}=n;return(0,a.createElement)(i,{ref:l,iconNode:t,className:r("lucide-".concat(s(e)),o),...c})});return n.displayName="".concat(e),n}},4743:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var a,s;e.exports=(null==(a=n.g.process)?void 0:a.env)&&"object"==typeof(null==(s=n.g.process)?void 0:s.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,a,s=e.exports={};function r(){throw Error("setTimeout has not been defined")}function l(){throw Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{n="function"==typeof clearTimeout?clearTimeout:l}catch(e){n=l}}();var o=[],c=!1,d=-1;function u(){c&&a&&(c=!1,a.length?o=a.concat(o):d=-1,o.length&&h())}function h(){if(!c){var e=i(u);c=!0;for(var t=o.length;t;){for(a=o,o=[];++d1)for(var n=1;n{r.hi.get("/v1/models").then(e=>{let t=e.data.map(e=>e.id).sort();_(t),t.length>0&&!n&&o(t[0])}).catch(()=>{}),r.hi.get("/api/providers").then(e=>I(Object.keys(e))).catch(()=>{})},[]),(0,s.useEffect)(()=>{var e;null===(e=J.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[E]);let F=()=>localStorage.getItem("nexus_token"),Z=async()=>{let e=m.trim();if(!n||!e)return;M(!0),O(""),L(null),z(!1);let t=[];u.trim()&&t.push({role:"system",content:u.trim()}),t.push({role:"user",content:e});let a={model:n,messages:t,max_tokens:x,temperature:v};c&&(a.provider=c);let s=F(),r=Date.now();try{var l,i,o,d,h;let e=await fetch("/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",...s?{Authorization:"Bearer ".concat(s)}:{}},body:JSON.stringify(a)}),t=Date.now()-r;if(L(t),z(!e.ok),!e.ok){let t=await e.text();try{let e=JSON.parse(t);O(JSON.stringify(e,null,2))}catch(e){O(t)}return}let c=await e.json(),u=(null===(o=c.choices)||void 0===o?void 0:null===(i=o[0])||void 0===i?void 0:null===(l=i.message)||void 0===l?void 0:l.content)||"(no content)",m=c.x_nexus||{};O("Provider: ".concat(m.provider||"?","\n")+"Model Used: ".concat(m.model_used||n,"\n")+"Key: ".concat(m.key_name||"?","\n")+"Tokens: ".concat((null===(d=c.usage)||void 0===d?void 0:d.prompt_tokens)||0," in / ").concat((null===(h=c.usage)||void 0===h?void 0:h.completion_tokens)||0," out\n")+"Cost: $".concat(m.cost_usd?Number(m.cost_usd).toFixed(6):"0.000000","\n")+"Latency: ".concat(m.latency_ms||t,"ms\n")+"Fallbacks: ".concat(m.fallback_count||0,"\n")+"Injection: ".concat(m.injection_flagged?"FLAGGED":"clean","\n")+"".concat(m.ab_test_id?"A/B: #".concat(m.ab_test_id," Variant ").concat(m.ab_variant):"","\n")+"".concat("-".repeat(40),"\n")+"".concat(u))}catch(e){L(Date.now()-r),z(!0),O(String(e))}finally{M(!1)}},B=async()=>{let e;M(!0),O(""),L(null),z(!1);try{e=JSON.parse(b)}catch(e){O("Invalid JSON"),M(!1);return}let t=F(),n=Date.now();try{let a=await fetch("/v1/messages",{method:"POST",headers:{"Content-Type":"application/json",...t?{Authorization:"Bearer ".concat(t)}:{}},body:JSON.stringify(e)}),s=Date.now()-n;L(s),z(!a.ok);let r=await a.json();O(JSON.stringify(r,null,2))}catch(e){L(Date.now()-n),z(!0),O(String(e))}finally{M(!1)}},U=async()=>{M(!0),O(""),L(null),z(!1);let e=F(),t=Date.now();try{var n;let a=await fetch("/v1/embeddings",{method:"POST",headers:{"Content-Type":"application/json",...e?{Authorization:"Bearer ".concat(e)}:{}},body:JSON.stringify({model:j,input:N,provider:S})}),s=Date.now()-t;L(s),z(!a.ok);let r=await a.json();if(null===(n=r.data)||void 0===n?void 0:n[0]){let e=r.data[0].embedding;O("Embedding received!\nDimensions: ".concat(e.length,"\nFirst 5: [").concat(e.slice(0,5).map(e=>e.toFixed(6)).join(", "),"]\nModel: ").concat(r.model))}else O(JSON.stringify(r,null,2))}catch(e){L(Date.now()-t),z(!0),O(String(e))}finally{M(!1)}};return(0,a.jsxs)("div",{className:"flex flex-col h-[calc(100vh-6rem)]",children:[(0,a.jsx)("div",{className:"page-header flex-shrink-0",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"Proxy Test"}),(0,a.jsx)("p",{className:"page-sub",children:"Live endpoint testing with model autocomplete"})]})}),(0,a.jsxs)("div",{className:"flex gap-1 bg-[var(--surface-100)] p-1 rounded-lg w-fit mb-4",children:[(0,a.jsx)("button",{className:"px-4 py-2 rounded-lg text-sm font-medium transition-all ".concat("chat"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("chat"),children:"Chat"}),(0,a.jsx)("button",{className:"px-4 py-2 rounded-lg text-sm font-medium transition-all ".concat("native"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("native"),children:"Anthropic"}),(0,a.jsx)("button",{className:"px-4 py-2 rounded-lg text-sm font-medium transition-all ".concat("embed"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("embed"),children:"Embeddings"})]}),(0,a.jsxs)("div",{className:"flex-1 flex gap-4 min-h-0",children:[(0,a.jsxs)("div",{className:"flex-1 flex flex-col gap-4 overflow-y-auto",children:["chat"===e&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"card",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("label",{className:"label !mb-0",children:"Model"}),(0,a.jsx)("button",{className:"btn-ghost btn-xs",onClick:()=>{r.hi.get("/v1/models").then(e=>{_(e.data.map(e=>e.id).sort())}).catch(()=>{})},children:"Refresh Models"})]}),(0,a.jsx)("input",{className:"input",list:"model-datalist",value:n,onChange:e=>o(e.target.value),placeholder:"gpt-4o, claude-sonnet-4-6, ..."}),(0,a.jsx)("datalist",{id:"model-datalist",children:C.map(e=>(0,a.jsx)("option",{value:e},e))})]}),(0,a.jsx)("div",{className:"card",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Provider Override"}),(0,a.jsxs)("select",{className:"select",value:c,onChange:e=>d(e.target.value),children:[(0,a.jsx)("option",{value:"",children:"Auto-detect"}),R.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Max Tokens"}),(0,a.jsx)("input",{className:"input",type:"number",value:x,onChange:e=>f(parseInt(e.target.value)||256)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Temperature"}),(0,a.jsx)("input",{className:"input",type:"number",step:"0.1",value:v,onChange:e=>g(parseFloat(e.target.value)||.7)})]})]})]})}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"System Prompt"}),(0,a.jsx)("textarea",{className:"input !min-h-[60px]",rows:2,value:u,onChange:e=>h(e.target.value),placeholder:"Optional"})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"User Message"}),(0,a.jsx)("textarea",{className:"input !min-h-[80px]",rows:3,value:m,onChange:e=>p(e.target.value)})]}),(0,a.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:Z,disabled:D||!n||!m.trim(),children:[D?(0,a.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(l.Z,{size:16}),D?" Sending...":" Send"]})]}),"native"===e&&(0,a.jsxs)("div",{className:"card flex flex-col gap-4",children:[(0,a.jsx)("label",{className:"label",children:"Request JSON"}),(0,a.jsx)("textarea",{className:"input font-mono text-xs !min-h-[300px]",rows:12,value:b,onChange:e=>y(e.target.value)}),(0,a.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:B,disabled:D,children:[D?(0,a.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(l.Z,{size:16}),D?" Sending...":" Send"]})]}),"embed"===e&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"Model"}),(0,a.jsx)("input",{className:"input",value:j,onChange:e=>w(e.target.value)})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"Input"}),(0,a.jsx)("textarea",{className:"input !min-h-[80px]",rows:3,value:N,onChange:e=>k(e.target.value)})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"Provider"}),(0,a.jsxs)("select",{className:"select",value:S,onChange:e=>T(e.target.value),children:[R.map(e=>(0,a.jsx)("option",{value:e,children:e},e)),0===R.length&&(0,a.jsx)("option",{value:"openai",children:"openai"})]})]}),(0,a.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:U,disabled:D,children:[D?(0,a.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(l.Z,{size:16}),D?" Sending...":" Send"]})]})]}),(0,a.jsx)("div",{className:"w-[480px] flex flex-col",children:(0,a.jsxs)("div",{className:"card flex-1 flex flex-col",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("span",{className:"text-sm font-semibold",children:"Response"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[null!==A&&(0,a.jsxs)("span",{className:"badge ".concat(P?"badge-red":"badge-green"),children:[P?"ERR":"OK"," ",A,"ms"]}),(0,a.jsx)("button",{className:"btn-ghost btn-xs",onClick:()=>{O(""),L(null),z(!1)},children:(0,a.jsx)(i.Z,{size:14})})]})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto font-mono text-xs whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed",children:E||(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Send a request to see the response"})})]})})]}),(0,a.jsx)("div",{ref:J})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return l},qz:function(){return r}});let a=n(257).env.NEXT_PUBLIC_API_BASE||"";function s(){return localStorage.getItem("nexus_token")}function r(){localStorage.removeItem("nexus_token")}function l(){return!!s()}let i={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,c=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",l=s(),d={"Content-Type":"application/json",...t.headers};if(l&&(d.Authorization="Bearer ".concat(l)),"GET"===n&&!l){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in i)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return i[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=c.get(e);if(n)return n}let u=(async()=>{let s=await fetch("".concat(a).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&l&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw r(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let i=await s.json();return"GET"!==n||l||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,i),i})();if("GET"===n&&!l){c.set(e,u);try{return await u}finally{c.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=a.access_token,localStorage.setItem("nexus_token",n),a},getMe:()=>d("/api/auth/me"),logout:()=>{r(),o.clear(),window.location.href="/login"}},h=async e=>{let t=s(),n=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let r=await n.blob(),l=URL.createObjectURL(r),i=document.createElement("a");i.href=l,i.download=e.split("/").pop()||"export.csv",i.click(),URL.revokeObjectURL(l)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=2468)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/chat/page-ba53668baba0967f.js b/static/_next/static/chunks/app/chat/page-fd7d09a808f0f08f.js similarity index 59% rename from static/_next/static/chunks/app/chat/page-ba53668baba0967f.js rename to static/_next/static/chunks/app/chat/page-fd7d09a808f0f08f.js index 7f409c69366d5b63fc80ad161f203eba9a934cb0..37b2b080c0bf7563321fcf90ecd537537f77e2cb 100644 --- a/static/_next/static/chunks/app/chat/page-ba53668baba0967f.js +++ b/static/_next/static/chunks/app/chat/page-fd7d09a808f0f08f.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{2468:function(e,t,n){Promise.resolve().then(n.bind(n,628))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var a=n(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,a.forwardRef)((e,t)=>{let{color:n="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:c="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...l,width:s,height:s,stroke:n,strokeWidth:o?24*Number(i)/Number(s):i,className:r("lucide",c),...h},[...u.map(e=>{let[t,n]=e;return(0,a.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),o=(e,t)=>{let n=(0,a.forwardRef)((n,l)=>{let{className:o,...c}=n;return(0,a.createElement)(i,{ref:l,iconNode:t,className:r("lucide-".concat(s(e)),o),...c})});return n.displayName="".concat(e),n}},4743:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var a,s;e.exports=(null==(a=n.g.process)?void 0:a.env)&&"object"==typeof(null==(s=n.g.process)?void 0:s.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,a,s=e.exports={};function r(){throw Error("setTimeout has not been defined")}function l(){throw Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{n="function"==typeof clearTimeout?clearTimeout:l}catch(e){n=l}}();var o=[],c=!1,d=-1;function u(){c&&a&&(c=!1,a.length?o=a.concat(o):d=-1,o.length&&h())}function h(){if(!c){var e=i(u);c=!0;for(var t=o.length;t;){for(a=o,o=[];++d1)for(var n=1;n{r.hi.get("/v1/models").then(e=>{let t=e.data.map(e=>e.id).sort();_(t),t.length>0&&!n&&o(t[0])}).catch(()=>{}),r.hi.get("/api/providers").then(e=>I(Object.keys(e))).catch(()=>{})},[]),(0,s.useEffect)(()=>{var e;null===(e=J.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[E]);let F=()=>localStorage.getItem("nexus_token"),Z=async()=>{let e=m.trim();if(!n||!e)return;M(!0),O(""),L(null),z(!1);let t=[];u.trim()&&t.push({role:"system",content:u.trim()}),t.push({role:"user",content:e});let a={model:n,messages:t,max_tokens:x,temperature:v};c&&(a.provider=c);let s=F(),r=Date.now();try{var l,i,o,d,h;let e=await fetch("/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",...s?{Authorization:"Bearer ".concat(s)}:{}},body:JSON.stringify(a)}),t=Date.now()-r;if(L(t),z(!e.ok),!e.ok){let t=await e.text();try{let e=JSON.parse(t);O(JSON.stringify(e,null,2))}catch(e){O(t)}return}let c=await e.json(),u=(null===(o=c.choices)||void 0===o?void 0:null===(i=o[0])||void 0===i?void 0:null===(l=i.message)||void 0===l?void 0:l.content)||"(no content)",m=c.x_nexus||{};O("Provider: ".concat(m.provider||"?","\n")+"Model Used: ".concat(m.model_used||n,"\n")+"Key: ".concat(m.key_name||"?","\n")+"Tokens: ".concat((null===(d=c.usage)||void 0===d?void 0:d.prompt_tokens)||0," in / ").concat((null===(h=c.usage)||void 0===h?void 0:h.completion_tokens)||0," out\n")+"Cost: $".concat(m.cost_usd?Number(m.cost_usd).toFixed(6):"0.000000","\n")+"Latency: ".concat(m.latency_ms||t,"ms\n")+"Fallbacks: ".concat(m.fallback_count||0,"\n")+"Injection: ".concat(m.injection_flagged?"FLAGGED":"clean","\n")+"".concat(m.ab_test_id?"A/B: #".concat(m.ab_test_id," Variant ").concat(m.ab_variant):"","\n")+"".concat("-".repeat(40),"\n")+"".concat(u))}catch(e){L(Date.now()-r),z(!0),O(String(e))}finally{M(!1)}},B=async()=>{let e;M(!0),O(""),L(null),z(!1);try{e=JSON.parse(b)}catch(e){O("Invalid JSON"),M(!1);return}let t=F(),n=Date.now();try{let a=await fetch("/v1/messages",{method:"POST",headers:{"Content-Type":"application/json",...t?{Authorization:"Bearer ".concat(t)}:{}},body:JSON.stringify(e)}),s=Date.now()-n;L(s),z(!a.ok);let r=await a.json();O(JSON.stringify(r,null,2))}catch(e){L(Date.now()-n),z(!0),O(String(e))}finally{M(!1)}},U=async()=>{M(!0),O(""),L(null),z(!1);let e=F(),t=Date.now();try{var n;let a=await fetch("/v1/embeddings",{method:"POST",headers:{"Content-Type":"application/json",...e?{Authorization:"Bearer ".concat(e)}:{}},body:JSON.stringify({model:j,input:N,provider:S})}),s=Date.now()-t;L(s),z(!a.ok);let r=await a.json();if(null===(n=r.data)||void 0===n?void 0:n[0]){let e=r.data[0].embedding;O("Embedding received!\nDimensions: ".concat(e.length,"\nFirst 5: [").concat(e.slice(0,5).map(e=>e.toFixed(6)).join(", "),"]\nModel: ").concat(r.model))}else O(JSON.stringify(r,null,2))}catch(e){L(Date.now()-t),z(!0),O(String(e))}finally{M(!1)}};return(0,a.jsxs)("div",{className:"flex flex-col h-[calc(100vh-6rem)]",children:[(0,a.jsx)("div",{className:"page-header flex-shrink-0",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"Proxy Test"}),(0,a.jsx)("p",{className:"page-sub",children:"Live endpoint testing with model autocomplete"})]})}),(0,a.jsxs)("div",{className:"flex gap-1 bg-[var(--surface-100)] p-1 rounded-lg w-fit mb-4",children:[(0,a.jsx)("button",{className:"px-4 py-2 rounded-lg text-sm font-medium transition-all ".concat("chat"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("chat"),children:"Chat"}),(0,a.jsx)("button",{className:"px-4 py-2 rounded-lg text-sm font-medium transition-all ".concat("native"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("native"),children:"Anthropic"}),(0,a.jsx)("button",{className:"px-4 py-2 rounded-lg text-sm font-medium transition-all ".concat("embed"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("embed"),children:"Embeddings"})]}),(0,a.jsxs)("div",{className:"flex-1 flex gap-4 min-h-0",children:[(0,a.jsxs)("div",{className:"flex-1 flex flex-col gap-4 overflow-y-auto",children:["chat"===e&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"card",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("label",{className:"label !mb-0",children:"Model"}),(0,a.jsx)("button",{className:"btn-ghost btn-xs",onClick:()=>{r.hi.get("/v1/models").then(e=>{_(e.data.map(e=>e.id).sort())}).catch(()=>{})},children:"Refresh Models"})]}),(0,a.jsx)("input",{className:"input",list:"model-datalist",value:n,onChange:e=>o(e.target.value),placeholder:"gpt-4o, claude-sonnet-4-6, ..."}),(0,a.jsx)("datalist",{id:"model-datalist",children:C.map(e=>(0,a.jsx)("option",{value:e},e))})]}),(0,a.jsx)("div",{className:"card",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Provider Override"}),(0,a.jsxs)("select",{className:"select",value:c,onChange:e=>d(e.target.value),children:[(0,a.jsx)("option",{value:"",children:"Auto-detect"}),R.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Max Tokens"}),(0,a.jsx)("input",{className:"input",type:"number",value:x,onChange:e=>f(parseInt(e.target.value)||256)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Temperature"}),(0,a.jsx)("input",{className:"input",type:"number",step:"0.1",value:v,onChange:e=>g(parseFloat(e.target.value)||.7)})]})]})]})}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"System Prompt"}),(0,a.jsx)("textarea",{className:"input !min-h-[60px]",rows:2,value:u,onChange:e=>h(e.target.value),placeholder:"Optional"})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"User Message"}),(0,a.jsx)("textarea",{className:"input !min-h-[80px]",rows:3,value:m,onChange:e=>p(e.target.value)})]}),(0,a.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:Z,disabled:D||!n||!m.trim(),children:[D?(0,a.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(l.Z,{size:16}),D?" Sending...":" Send"]})]}),"native"===e&&(0,a.jsxs)("div",{className:"card flex flex-col gap-4",children:[(0,a.jsx)("label",{className:"label",children:"Request JSON"}),(0,a.jsx)("textarea",{className:"input font-mono text-xs !min-h-[300px]",rows:12,value:b,onChange:e=>y(e.target.value)}),(0,a.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:B,disabled:D,children:[D?(0,a.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(l.Z,{size:16}),D?" Sending...":" Send"]})]}),"embed"===e&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"Model"}),(0,a.jsx)("input",{className:"input",value:j,onChange:e=>w(e.target.value)})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"Input"}),(0,a.jsx)("textarea",{className:"input !min-h-[80px]",rows:3,value:N,onChange:e=>k(e.target.value)})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"Provider"}),(0,a.jsxs)("select",{className:"select",value:S,onChange:e=>T(e.target.value),children:[R.map(e=>(0,a.jsx)("option",{value:e,children:e},e)),0===R.length&&(0,a.jsx)("option",{value:"openai",children:"openai"})]})]}),(0,a.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:U,disabled:D,children:[D?(0,a.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(l.Z,{size:16}),D?" Sending...":" Send"]})]})]}),(0,a.jsx)("div",{className:"w-[480px] flex flex-col",children:(0,a.jsxs)("div",{className:"card flex-1 flex flex-col",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("span",{className:"text-sm font-semibold",children:"Response"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[null!==A&&(0,a.jsxs)("span",{className:"badge ".concat(P?"badge-red":"badge-green"),children:[P?"ERR":"OK"," ",A,"ms"]}),(0,a.jsx)("button",{className:"btn-ghost btn-xs",onClick:()=>{O(""),L(null),z(!1)},children:(0,a.jsx)(i.Z,{size:14})})]})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto font-mono text-xs whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed",children:E||(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Send a request to see the response"})})]})})]}),(0,a.jsx)("div",{ref:J})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return l},qz:function(){return r}});let a=n(257).env.NEXT_PUBLIC_API_BASE||"";function s(){return localStorage.getItem("nexus_token")}function r(){localStorage.removeItem("nexus_token")}function l(){return!!s()}let i={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,c=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",l=s(),d={"Content-Type":"application/json",...t.headers};if(l&&(d.Authorization="Bearer ".concat(l)),"GET"===n&&!l){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in i)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return i[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=c.get(e);if(n)return n}let u=(async()=>{let s=await fetch("".concat(a).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&l&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw r(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let i=await s.json();return"GET"!==n||l||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,i),i})();if("GET"===n&&!l){c.set(e,u);try{return await u}finally{c.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=a.access_token,localStorage.setItem("nexus_token",n),a},getMe:()=>d("/api/auth/me"),logout:()=>{r(),o.clear(),window.location.href="/login"}},h=async e=>{let t=s(),n=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let r=await n.blob(),l=URL.createObjectURL(r),i=document.createElement("a");i.href=l,i.download=e.split("/").pop()||"export.csv",i.click(),URL.revokeObjectURL(l)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=2468)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{2468:function(e,t,n){Promise.resolve().then(n.bind(n,628))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var a=n(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,a.forwardRef)((e,t)=>{let{color:n="currentColor",size:s=24,strokeWidth:l=2,absoluteStrokeWidth:i,className:c="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...o,width:s,height:s,stroke:n,strokeWidth:i?24*Number(l)/Number(s):l,className:r("lucide",c),...h},[...u.map(e=>{let[t,n]=e;return(0,a.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),i=(e,t)=>{let n=(0,a.forwardRef)((n,o)=>{let{className:i,...c}=n;return(0,a.createElement)(l,{ref:o,iconNode:t,className:r("lucide-".concat(s(e)),i),...c})});return n.displayName="".concat(e),n}},4743:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var a,s;e.exports=(null==(a=n.g.process)?void 0:a.env)&&"object"==typeof(null==(s=n.g.process)?void 0:s.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,a,s=e.exports={};function r(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var i=[],c=!1,d=-1;function u(){c&&a&&(c=!1,a.length?i=a.concat(i):d=-1,i.length&&h())}function h(){if(!c){var e=l(u);c=!0;for(var t=i.length;t;){for(a=i,i=[];++d1)for(var n=1;n{r.hi.get("/v1/models").then(e=>{let t=e.data.map(e=>e.id).sort();C(t),t.length>0&&!n&&i(t[0])}).catch(()=>{}),r.hi.get("/api/providers").then(e=>M(Object.keys(e))).catch(()=>{})},[]),(0,s.useEffect)(()=>{var e;null===(e=J.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[E]);let F=()=>localStorage.getItem("nexus_token"),U=async()=>{let e=m.trim();if(!n||!e)return;D(!0),O(""),L(null),R(!1);let t=[];u.trim()&&t.push({role:"system",content:u.trim()}),t.push({role:"user",content:e});let a={model:n,messages:t,max_tokens:x,temperature:v};c&&(a.provider=c);let s=F(),r=Date.now();try{var o,l,i,d,h;let e=await fetch("/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",...s?{Authorization:"Bearer ".concat(s)}:{}},body:JSON.stringify(a)}),t=Date.now()-r;if(L(t),R(!e.ok),!e.ok){let t=await e.text();try{let e=JSON.parse(t);O(JSON.stringify(e,null,2))}catch(e){O(t)}return}let c=await e.json(),u=(null===(i=c.choices)||void 0===i?void 0:null===(l=i[0])||void 0===l?void 0:null===(o=l.message)||void 0===o?void 0:o.content)||"(no content)",m=c.x_nexus||{};O("Provider: ".concat(m.provider||"?","\n")+"Model Used: ".concat(m.model_used||n,"\n")+"Key: ".concat(m.key_name||"?","\n")+"Tokens: ".concat((null===(d=c.usage)||void 0===d?void 0:d.prompt_tokens)||0," in / ").concat((null===(h=c.usage)||void 0===h?void 0:h.completion_tokens)||0," out\n")+"Cost: $".concat(m.cost_usd?Number(m.cost_usd).toFixed(6):"0.000000","\n")+"Latency: ".concat(m.latency_ms||t,"ms\n")+"Fallbacks: ".concat(m.fallback_count||0,"\n")+"Injection: ".concat(m.injection_flagged?"FLAGGED":"clean","\n")+"".concat(m.ab_test_id?"A/B: #".concat(m.ab_test_id," Variant ").concat(m.ab_variant):"","\n")+"".concat("-".repeat(40),"\n")+"".concat(u))}catch(e){L(Date.now()-r),R(!0),O(String(e))}finally{D(!1)}},Z=async()=>{let e;D(!0),O(""),L(null),R(!1);try{e=JSON.parse(y)}catch(e){O("Invalid JSON"),D(!1);return}let t=F(),n=Date.now();try{let a=await fetch("/v1/messages",{method:"POST",headers:{"Content-Type":"application/json",...t?{Authorization:"Bearer ".concat(t)}:{}},body:JSON.stringify(e)}),s=Date.now()-n;L(s),R(!a.ok);let r=await a.json();O(JSON.stringify(r,null,2))}catch(e){L(Date.now()-n),R(!0),O(String(e))}finally{D(!1)}},B=async()=>{D(!0),O(""),L(null),R(!1);let e=F(),t=Date.now();try{var n;let a=await fetch("/v1/embeddings",{method:"POST",headers:{"Content-Type":"application/json",...e?{Authorization:"Bearer ".concat(e)}:{}},body:JSON.stringify({model:j,input:N,provider:S})}),s=Date.now()-t;L(s),R(!a.ok);let r=await a.json();if(null===(n=r.data)||void 0===n?void 0:n[0]){let e=r.data[0].embedding;O("Embedding received!\nDimensions: ".concat(e.length,"\nFirst 5: [").concat(e.slice(0,5).map(e=>e.toFixed(6)).join(", "),"]\nModel: ").concat(r.model))}else O(JSON.stringify(r,null,2))}catch(e){L(Date.now()-t),R(!0),O(String(e))}finally{D(!1)}};return(0,a.jsxs)("div",{className:"flex flex-col h-[calc(100vh-6rem)]",children:[(0,a.jsx)("div",{className:"page-header flex-shrink-0",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"Proxy Test"}),(0,a.jsx)("p",{className:"page-sub",children:"Live endpoint testing with model autocomplete"})]})}),(0,a.jsxs)("div",{className:"flex gap-1 bg-[var(--surface-100)] p-1 rounded-lg w-fit mb-4",children:[(0,a.jsx)("button",{className:"px-4 py-2 rounded-lg text-sm font-medium transition-all ".concat("chat"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("chat"),children:"Chat"}),(0,a.jsx)("button",{className:"px-4 py-2 rounded-lg text-sm font-medium transition-all ".concat("native"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("native"),children:"Anthropic"}),(0,a.jsx)("button",{className:"px-4 py-2 rounded-lg text-sm font-medium transition-all ".concat("embed"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("embed"),children:"Embeddings"})]}),(0,a.jsxs)("div",{className:"flex-1 flex gap-4 min-h-0",children:[(0,a.jsxs)("div",{className:"flex-1 flex flex-col gap-4 overflow-y-auto",children:["chat"===e&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"card",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("label",{className:"label !mb-0",children:"Model"}),(0,a.jsx)("button",{className:"btn-ghost btn-xs",onClick:()=>{r.hi.get("/v1/models").then(e=>{C(e.data.map(e=>e.id).sort())}).catch(()=>{})},children:"Refresh Models"})]}),(0,a.jsx)("input",{className:"input",list:"model-datalist",value:n,onChange:e=>i(e.target.value),placeholder:"gpt-4o, claude-sonnet-4-6, ..."}),(0,a.jsx)("datalist",{id:"model-datalist",children:_.map(e=>(0,a.jsx)("option",{value:e},e))})]}),(0,a.jsx)("div",{className:"card",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Provider Override"}),(0,a.jsxs)("select",{className:"select",value:c,onChange:e=>d(e.target.value),children:[(0,a.jsx)("option",{value:"",children:"Auto-detect"}),I.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Max Tokens"}),(0,a.jsx)("input",{className:"input",type:"number",value:x,onChange:e=>f(parseInt(e.target.value)||256)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Temperature"}),(0,a.jsx)("input",{className:"input",type:"number",step:"0.1",value:v,onChange:e=>g(parseFloat(e.target.value)||.7)})]})]})]})}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"System Prompt"}),(0,a.jsx)("textarea",{className:"input !min-h-[60px]",rows:2,value:u,onChange:e=>h(e.target.value),placeholder:"Optional"})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"User Message"}),(0,a.jsx)("textarea",{className:"input !min-h-[80px]",rows:3,value:m,onChange:e=>p(e.target.value)})]}),(0,a.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:U,disabled:z||!n||!m.trim(),children:[z?(0,a.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(o.Z,{size:16}),z?" Sending...":" Send"]})]}),"native"===e&&(0,a.jsxs)("div",{className:"card flex flex-col gap-4",children:[(0,a.jsx)("label",{className:"label",children:"Request JSON"}),(0,a.jsx)("textarea",{className:"input font-mono text-xs !min-h-[300px]",rows:12,value:y,onChange:e=>b(e.target.value)}),(0,a.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:Z,disabled:z,children:[z?(0,a.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(o.Z,{size:16}),z?" Sending...":" Send"]})]}),"embed"===e&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"Model"}),(0,a.jsx)("input",{className:"input",value:j,onChange:e=>w(e.target.value)})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"Input"}),(0,a.jsx)("textarea",{className:"input !min-h-[80px]",rows:3,value:N,onChange:e=>k(e.target.value)})]}),(0,a.jsxs)("div",{className:"card",children:[(0,a.jsx)("label",{className:"label",children:"Provider"}),(0,a.jsxs)("select",{className:"select",value:S,onChange:e=>T(e.target.value),children:[I.map(e=>(0,a.jsx)("option",{value:e,children:e},e)),0===I.length&&(0,a.jsx)("option",{value:"openai",children:"openai"})]})]}),(0,a.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:B,disabled:z,children:[z?(0,a.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(o.Z,{size:16}),z?" Sending...":" Send"]})]})]}),(0,a.jsx)("div",{className:"w-[480px] flex flex-col",children:(0,a.jsxs)("div",{className:"card flex-1 flex flex-col",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("span",{className:"text-sm font-semibold",children:"Response"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[null!==A&&(0,a.jsxs)("span",{className:"badge ".concat(P?"badge-red":"badge-green"),children:[P?"ERR":"OK"," ",A,"ms"]}),(0,a.jsx)("button",{className:"btn-ghost btn-xs",onClick:()=>{O(""),L(null),R(!1)},children:(0,a.jsx)(l.Z,{size:14})})]})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto font-mono text-xs whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed",children:E||(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Send a request to see the response"})})]})})]}),(0,a.jsx)("div",{ref:J})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return o},qz:function(){return r}});let a=n(257).env.NEXT_PUBLIC_API_BASE||"";function s(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function r(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function o(){return!!s()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},i=new Map,c=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",o=s(),d={"Content-Type":"application/json",...t.headers};if(o&&(d.Authorization="Bearer ".concat(o)),"GET"===n&&!o){let t=function(e){let t=i.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){i.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=c.get(e);if(n)return n}let u=(async()=>{let s=await fetch("".concat(a).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&o&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw r(),i.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let l=await s.json();return"GET"!==n||o||function(e,t){if(i.size>=200){let e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===n&&!o){c.set(e,u);try{return await u}finally{c.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=a.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),a},getMe:()=>d("/api/auth/me"),logout:()=>{r(),i.clear(),window.location.href="/login"}},h=async e=>{let t=s(),n=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let r=await n.blob(),o=URL.createObjectURL(r),l=document.createElement("a");l.href=o,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(o)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=2468)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/code-interpreter/page-2365e842d504748d.js b/static/_next/static/chunks/app/code-interpreter/page-2365e842d504748d.js deleted file mode 100644 index bb74d5bb33d13ac6de9b7babbb37587778614ca2..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/code-interpreter/page-2365e842d504748d.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5866],{9671:function(e,t,r){Promise.resolve().then(r.bind(r,2763))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:c="",children:u,iconNode:d,...f}=e;return(0,n.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:r,strokeWidth:l?24*Number(o)/Number(a):o,className:s("lucide",c),...f},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),l=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:l,...c}=r;return(0,n.createElement)(o,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),l),...c})});return r.displayName="".concat(e),r}},3276:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},7168:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},221:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var l=[],c=!1,u=-1;function d(){c&&n&&(c=!1,n.length?l=n.concat(l):u=-1,l.length&&f())}function f(){if(!c){var e=o(d);c=!0;for(var t=l.length;t;){for(n=l,l=[];++u1)for(var r=1;r{p(!0),w(null);try{let e=await s.hi.get("/api/code-interpreter/status");t(e)}catch(e){w(String(e))}finally{p(!1)}};(0,a.useEffect)(()=>{b()},[]);let j=async()=>{x(!0),w(null);try{let e=await s.hi.post("/api/code-interpreter/restart");t(e)}catch(e){w(String(e))}finally{x(!1)}},N=async()=>{if(r.trim()){v(!0),f(null),w(null);try{let e=await s.hi.post("/api/code-interpreter/execute",{code:r});f(e)}catch(e){w(String(e))}finally{v(!1)}}},k=e?c[e.status]:null;return(0,n.jsxs)("div",{className:"flex flex-col h-[calc(100vh-6rem)]",children:[(0,n.jsx)("div",{className:"page-header flex-shrink-0",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Code Interpreter"}),(0,n.jsx)("p",{className:"page-sub",children:"Execute Python code in an isolated Jupyter kernel"})]})}),(0,n.jsxs)("div",{className:"flex-1 flex gap-4 min-h-0",children:[(0,n.jsxs)("div",{className:"flex-1 flex flex-col gap-4 overflow-y-auto",children:[(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(i.Z,{size:18}),(0,n.jsx)("span",{className:"text-sm font-semibold",children:"Kernel Status"}),h?(0,n.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):k?(0,n.jsx)("span",{className:"badge ".concat(k.className),children:k.label}):(0,n.jsx)("span",{className:"badge badge-red",children:"Offline"})]}),(0,n.jsxs)("button",{className:"btn-secondary btn-sm",onClick:j,disabled:m,children:[(0,n.jsx)(o.Z,{size:14,className:m?"animate-spin":""}),m?" Restarting...":" Restart Kernel"]})]}),e&&(0,n.jsxs)("div",{className:"text-xs text-[var(--text-secondary)] space-y-1",children:[e.kernel_id&&(0,n.jsxs)("p",{children:["Kernel: ",(0,n.jsx)("span",{className:"font-mono",children:e.kernel_id})]}),void 0!==e.uptime&&(0,n.jsxs)("p",{children:["Uptime: ",e.uptime,"s"]})]})]}),(0,n.jsxs)("div",{className:"card",children:[(0,n.jsx)("label",{className:"label",children:"Python Code"}),(0,n.jsx)("textarea",{className:"input font-mono text-xs !min-h-[200px]",rows:10,value:r,onChange:e=>u(e.target.value),placeholder:"Enter Python code here..."})]}),(0,n.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:N,disabled:y||!r.trim(),children:[y?(0,n.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,n.jsx)(l.Z,{size:16}),y?" Running...":" Run"]}),g&&(0,n.jsx)("div",{className:"card border border-red-500/30",children:(0,n.jsx)("p",{className:"text-red-400 text-sm font-mono whitespace-pre-wrap",children:g})})]}),(0,n.jsx)("div",{className:"w-[480px] flex flex-col",children:(0,n.jsxs)("div",{className:"card flex-1 flex flex-col",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsx)("span",{className:"text-sm font-semibold",children:"Output"}),(null==d?void 0:d.execution_time)!==void 0&&(0,n.jsxs)("span",{className:"badge badge-green",children:[d.execution_time,"ms"]})]}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto",children:d?(0,n.jsxs)("pre",{className:"font-mono text-xs whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed",children:[(0,n.jsx)("code",{children:d.output||""}),d.error&&(0,n.jsx)("code",{className:"text-red-400",children:d.error}),!d.output&&!d.error&&(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"(no output)"})]}):(0,n.jsx)("span",{className:"text-[var(--text-tertiary)] text-xs",children:"Run code to see output"})})]})})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return f},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=a(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=c.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==r||i||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===r&&!i){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{s(),l.clear(),window.location.href="/login"}},f=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let s=await r.blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=9671)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/code-interpreter/page-616c2499443c23ee.js b/static/_next/static/chunks/app/code-interpreter/page-616c2499443c23ee.js deleted file mode 100644 index bb74d5bb33d13ac6de9b7babbb37587778614ca2..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/code-interpreter/page-616c2499443c23ee.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5866],{9671:function(e,t,r){Promise.resolve().then(r.bind(r,2763))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:c="",children:u,iconNode:d,...f}=e;return(0,n.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:r,strokeWidth:l?24*Number(o)/Number(a):o,className:s("lucide",c),...f},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),l=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:l,...c}=r;return(0,n.createElement)(o,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),l),...c})});return r.displayName="".concat(e),r}},3276:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},7168:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},221:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var l=[],c=!1,u=-1;function d(){c&&n&&(c=!1,n.length?l=n.concat(l):u=-1,l.length&&f())}function f(){if(!c){var e=o(d);c=!0;for(var t=l.length;t;){for(n=l,l=[];++u1)for(var r=1;r{p(!0),w(null);try{let e=await s.hi.get("/api/code-interpreter/status");t(e)}catch(e){w(String(e))}finally{p(!1)}};(0,a.useEffect)(()=>{b()},[]);let j=async()=>{x(!0),w(null);try{let e=await s.hi.post("/api/code-interpreter/restart");t(e)}catch(e){w(String(e))}finally{x(!1)}},N=async()=>{if(r.trim()){v(!0),f(null),w(null);try{let e=await s.hi.post("/api/code-interpreter/execute",{code:r});f(e)}catch(e){w(String(e))}finally{v(!1)}}},k=e?c[e.status]:null;return(0,n.jsxs)("div",{className:"flex flex-col h-[calc(100vh-6rem)]",children:[(0,n.jsx)("div",{className:"page-header flex-shrink-0",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Code Interpreter"}),(0,n.jsx)("p",{className:"page-sub",children:"Execute Python code in an isolated Jupyter kernel"})]})}),(0,n.jsxs)("div",{className:"flex-1 flex gap-4 min-h-0",children:[(0,n.jsxs)("div",{className:"flex-1 flex flex-col gap-4 overflow-y-auto",children:[(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)(i.Z,{size:18}),(0,n.jsx)("span",{className:"text-sm font-semibold",children:"Kernel Status"}),h?(0,n.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):k?(0,n.jsx)("span",{className:"badge ".concat(k.className),children:k.label}):(0,n.jsx)("span",{className:"badge badge-red",children:"Offline"})]}),(0,n.jsxs)("button",{className:"btn-secondary btn-sm",onClick:j,disabled:m,children:[(0,n.jsx)(o.Z,{size:14,className:m?"animate-spin":""}),m?" Restarting...":" Restart Kernel"]})]}),e&&(0,n.jsxs)("div",{className:"text-xs text-[var(--text-secondary)] space-y-1",children:[e.kernel_id&&(0,n.jsxs)("p",{children:["Kernel: ",(0,n.jsx)("span",{className:"font-mono",children:e.kernel_id})]}),void 0!==e.uptime&&(0,n.jsxs)("p",{children:["Uptime: ",e.uptime,"s"]})]})]}),(0,n.jsxs)("div",{className:"card",children:[(0,n.jsx)("label",{className:"label",children:"Python Code"}),(0,n.jsx)("textarea",{className:"input font-mono text-xs !min-h-[200px]",rows:10,value:r,onChange:e=>u(e.target.value),placeholder:"Enter Python code here..."})]}),(0,n.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:N,disabled:y||!r.trim(),children:[y?(0,n.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,n.jsx)(l.Z,{size:16}),y?" Running...":" Run"]}),g&&(0,n.jsx)("div",{className:"card border border-red-500/30",children:(0,n.jsx)("p",{className:"text-red-400 text-sm font-mono whitespace-pre-wrap",children:g})})]}),(0,n.jsx)("div",{className:"w-[480px] flex flex-col",children:(0,n.jsxs)("div",{className:"card flex-1 flex flex-col",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsx)("span",{className:"text-sm font-semibold",children:"Output"}),(null==d?void 0:d.execution_time)!==void 0&&(0,n.jsxs)("span",{className:"badge badge-green",children:[d.execution_time,"ms"]})]}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto",children:d?(0,n.jsxs)("pre",{className:"font-mono text-xs whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed",children:[(0,n.jsx)("code",{children:d.output||""}),d.error&&(0,n.jsx)("code",{className:"text-red-400",children:d.error}),!d.output&&!d.error&&(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"(no output)"})]}):(0,n.jsx)("span",{className:"text-[var(--text-tertiary)] text-xs",children:"Run code to see output"})})]})})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return f},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=a(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=c.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==r||i||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===r&&!i){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{s(),l.clear(),window.location.href="/login"}},f=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let s=await r.blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=9671)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/code-interpreter/page-6263999561ce9799.js b/static/_next/static/chunks/app/code-interpreter/page-6263999561ce9799.js new file mode 100644 index 0000000000000000000000000000000000000000..4927e65064bb5bdab727a1c57d90bbae6df2319d --- /dev/null +++ b/static/_next/static/chunks/app/code-interpreter/page-6263999561ce9799.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5866],{9671:function(e,t,n){Promise.resolve().then(n.bind(n,2763))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),o=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:i=2,absoluteStrokeWidth:l,className:c="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:n,strokeWidth:l?24*Number(i)/Number(a):i,className:o("lucide",c),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),l=(e,t)=>{let n=(0,r.forwardRef)((n,s)=>{let{className:l,...c}=n;return(0,r.createElement)(i,{ref:s,iconNode:t,className:o("lucide-".concat(a(e)),l),...c})});return n.displayName="".concat(e),n}},3276:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},7168:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},221:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function o(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var l=[],c=!1,u=-1;function d(){c&&r&&(c=!1,r.length?l=r.concat(l):u=-1,l.length&&h())}function h(){if(!c){var e=i(d);c=!0;for(var t=l.length;t;){for(r=l,l=[];++u1)for(var n=1;n{p(!0),w(null);try{let e=await o.hi.get("/api/code-interpreter/status");t(e)}catch(e){w(String(e))}finally{p(!1)}};(0,a.useEffect)(()=>{b()},[]);let j=async()=>{x(!0),w(null);try{let e=await o.hi.post("/api/code-interpreter/restart");t(e)}catch(e){w(String(e))}finally{x(!1)}},N=async()=>{if(n.trim()){g(!0),h(null),w(null);try{let e=await o.hi.post("/api/code-interpreter/execute",{code:n});h(e)}catch(e){w(String(e))}finally{g(!1)}}},k=e?c[e.status]:null;return(0,r.jsxs)("div",{className:"flex flex-col h-[calc(100vh-6rem)]",children:[(0,r.jsx)("div",{className:"page-header flex-shrink-0",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Code Interpreter"}),(0,r.jsx)("p",{className:"page-sub",children:"Execute Python code in an isolated Jupyter kernel"})]})}),(0,r.jsxs)("div",{className:"flex-1 flex gap-4 min-h-0",children:[(0,r.jsxs)("div",{className:"flex-1 flex flex-col gap-4 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(s.Z,{size:18}),(0,r.jsx)("span",{className:"text-sm font-semibold",children:"Kernel Status"}),f?(0,r.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):k?(0,r.jsx)("span",{className:"badge ".concat(k.className),children:k.label}):(0,r.jsx)("span",{className:"badge badge-red",children:"Offline"})]}),(0,r.jsxs)("button",{className:"btn-secondary btn-sm",onClick:j,disabled:m,children:[(0,r.jsx)(i.Z,{size:14,className:m?"animate-spin":""}),m?" Restarting...":" Restart Kernel"]})]}),e&&(0,r.jsxs)("div",{className:"text-xs text-[var(--text-secondary)] space-y-1",children:[e.kernel_id&&(0,r.jsxs)("p",{children:["Kernel: ",(0,r.jsx)("span",{className:"font-mono",children:e.kernel_id})]}),void 0!==e.uptime&&(0,r.jsxs)("p",{children:["Uptime: ",e.uptime,"s"]})]})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("label",{className:"label",children:"Python Code"}),(0,r.jsx)("textarea",{className:"input font-mono text-xs !min-h-[200px]",rows:10,value:n,onChange:e=>u(e.target.value),placeholder:"Enter Python code here..."})]}),(0,r.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:N,disabled:y||!n.trim(),children:[y?(0,r.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,r.jsx)(l.Z,{size:16}),y?" Running...":" Run"]}),v&&(0,r.jsx)("div",{className:"card border border-red-500/30",children:(0,r.jsx)("p",{className:"text-red-400 text-sm font-mono whitespace-pre-wrap",children:v})})]}),(0,r.jsx)("div",{className:"w-[480px] flex flex-col",children:(0,r.jsxs)("div",{className:"card flex-1 flex flex-col",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)("span",{className:"text-sm font-semibold",children:"Output"}),(null==d?void 0:d.execution_time)!==void 0&&(0,r.jsxs)("span",{className:"badge badge-green",children:[d.execution_time,"ms"]})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto",children:d?(0,r.jsxs)("pre",{className:"font-mono text-xs whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed",children:[(0,r.jsx)("code",{children:d.output||""}),d.error&&(0,r.jsx)("code",{className:"text-red-400",children:d.error}),!d.output&&!d.error&&(0,r.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"(no output)"})]}):(0,r.jsx)("span",{className:"text-[var(--text-tertiary)] text-xs",children:"Run code to see output"})})]})})]})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return s},qz:function(){return o}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function o(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function s(){return!!a()}let i={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",s=a(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===n&&!s){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in i)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return i[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=c.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw o(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let i=await a.json();return"GET"!==n||s||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,i),i})();if("GET"===n&&!s){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>u("/api/auth/me"),logout:()=>{o(),l.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let o=await n.blob(),s=URL.createObjectURL(o),i=document.createElement("a");i.href=s,i.download=e.split("/").pop()||"export.csv",i.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=9671)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/config-backup/page-3da24ba3742904fe.js b/static/_next/static/chunks/app/config-backup/page-3da24ba3742904fe.js new file mode 100644 index 0000000000000000000000000000000000000000..cd37740e0471e0c01d62c594b62fcbb311fdb6fb --- /dev/null +++ b/static/_next/static/chunks/app/config-backup/page-3da24ba3742904fe.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2378],{6434:function(e,t,n){Promise.resolve().then(n.bind(n,9928))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:s=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...f}=e;return(0,r.createElement)("svg",{ref:t,...o,width:a,height:a,stroke:n,strokeWidth:c?24*Number(s)/Number(a):s,className:i("lucide",l),...f},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,o)=>{let{className:c,...l}=n;return(0,r.createElement)(s,{ref:o,iconNode:t,className:i("lucide-".concat(a(e)),c),...l})});return n.displayName="".concat(e),n}},1671:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},8867:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},2735:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},6865:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},7689:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var c=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?c=r.concat(c):u=-1,c.length&&f())}function f(){if(!l){var e=s(d);l=!0;for(var t=c.length;t;){for(r=c,c=[];++u1)for(var n=1;n{N()},[]);let N=async()=>{f(!0),m("");try{let e=await i.hi.get("/api/config/export");t(e)}catch(e){m(e instanceof Error?e.message:"Failed to export configuration")}finally{f(!1)}},T=async()=>{if(e)try{await navigator.clipboard.writeText(JSON.stringify(e,null,2))}catch(e){}},C=async()=>{if(v){x(!0),y(null),w(!1);try{let e=await v.text(),t=JSON.parse(e);await i.hi.post("/api/config/import",t),y({ok:!0,message:"Configuration restored successfully."}),await N(),b(null),k.current&&(k.current.value="")}catch(e){y({ok:!1,message:e instanceof Error?e.message:"Import failed"})}finally{x(!1)}}};return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"page-header",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Configuration Backup & Restore"}),(0,r.jsx)("p",{className:"page-sub",children:"Export or import your full gateway configuration"})]})}),(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,r.jsx)(o,{size:18}),(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Export Configuration"})]}),(0,r.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:"Download a JSON file containing all current configuration settings."}),n&&(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsx)("span",{className:"w-5 h-5 border-2 border-[var(--accent)] border-t-transparent rounded-full animate-spin"})}),h&&(0,r.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-red-500/10 text-red-400 mb-4",children:[(0,r.jsx)(s.Z,{size:16,className:"mt-0.5 shrink-0"}),(0,r.jsx)("span",{className:"text-sm",children:h})]}),!n&&!h&&e&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("pre",{className:"bg-[var(--surface-100)] rounded-lg p-4 overflow-x-auto text-xs font-mono leading-relaxed max-h-80 mb-4 text-[var(--text-secondary)]",children:(0,r.jsx)("code",{children:JSON.stringify(e,null,2)})}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>{if(!e)return;let t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download="nexus-config-backup.json",r.click(),URL.revokeObjectURL(n)},disabled:!e,children:[(0,r.jsx)(c.Z,{size:16}),"Download Config"]}),(0,r.jsxs)("button",{className:"btn-secondary",onClick:T,children:[(0,r.jsx)(l.Z,{size:16}),"Copy to Clipboard"]})]})]}),!n&&!h&&!e&&(0,r.jsx)("div",{className:"text-center py-12 text-[var(--text-tertiary)]",children:(0,r.jsx)("p",{className:"text-sm",children:"No configuration data available."})})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,r.jsx)(u.Z,{size:18}),(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Import Configuration"})]}),(0,r.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:"Upload a previously exported JSON file to restore configuration."}),(0,r.jsxs)("div",{className:"border-2 border-dashed border-[var(--border)] rounded-lg p-8 text-center cursor-pointer hover:border-[var(--accent)] transition-colors",onClick:()=>{var e;return null===(e=k.current)||void 0===e?void 0:e.click()},children:[(0,r.jsx)(u.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-1",children:v?v.name:"Click to select a JSON file"}),(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)]",children:".json files only"}),(0,r.jsx)("input",{ref:k,type:"file",accept:".json",className:"hidden",onChange:e=>{var t;b((null===(t=e.target.files)||void 0===t?void 0:t[0])||null),y(null)}})]}),v&&!j&&(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsx)("button",{className:"btn-danger w-full justify-center",onClick:()=>w(!0),disabled:p,children:p?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Importing..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.Z,{size:16}),"Restore from ",v.name]})})}),j&&(0,r.jsxs)("div",{className:"mt-4 p-4 rounded-lg bg-yellow-500/10 border border-yellow-500/20",children:[(0,r.jsxs)("div",{className:"flex items-start gap-3 mb-3",children:[(0,r.jsx)(s.Z,{size:18,className:"text-yellow-400 mt-0.5 shrink-0"}),(0,r.jsx)("p",{className:"text-sm text-yellow-300",children:"This will overwrite current configuration. Continue?"})]}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)("button",{className:"btn-danger",onClick:C,disabled:p,children:"Yes, Restore"}),(0,r.jsx)("button",{className:"btn-secondary",onClick:()=>w(!1),disabled:p,children:"Cancel"})]})]}),g&&(0,r.jsxs)("div",{className:"mt-4 flex items-start gap-3 p-3 rounded-lg ".concat(g.ok?"bg-emerald-500/10 text-emerald-400":"bg-red-500/10 text-red-400"),children:[g.ok?(0,r.jsx)(d.Z,{size:16,className:"mt-0.5 shrink-0"}):(0,r.jsx)(s.Z,{size:16,className:"mt-0.5 shrink-0"}),(0,r.jsx)("span",{className:"text-sm",children:g.message})]})]})]})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return f},hi:function(){return d},jl:function(){return o},qz:function(){return i}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function i(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function o(){return!!a()}let s={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",o=a(),u={"Content-Type":"application/json",...t.headers};if(o&&(u.Authorization="Bearer ".concat(o)),"GET"===n&&!o){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in s)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return s[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&o&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let s=await a.json();return"GET"!==n||o||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,s),s})();if("GET"===n&&!o){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>u("/api/auth/me"),logout:()=>{i(),c.clear(),window.location.href="/login"}},f=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let i=await n.blob(),o=URL.createObjectURL(i),s=document.createElement("a");s.href=o,s.download=e.split("/").pop()||"export.csv",s.click(),URL.revokeObjectURL(o)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=6434)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/config-backup/page-7792b5bc4dc19a5f.js b/static/_next/static/chunks/app/config-backup/page-7792b5bc4dc19a5f.js deleted file mode 100644 index befb486ce1c308ca34219277964ea51c6ae994c9..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/config-backup/page-7792b5bc4dc19a5f.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2378],{6434:function(e,t,r){Promise.resolve().then(r.bind(r,9928))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:c="",children:u,iconNode:d,...f}=e;return(0,n.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:r,strokeWidth:l?24*Number(o)/Number(a):o,className:i("lucide",c),...f},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),l=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:l,...c}=r;return(0,n.createElement)(o,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),l),...c})});return r.displayName="".concat(e),r}},1671:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},8867:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},2735:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},6865:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},7689:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var l=[],c=!1,u=-1;function d(){c&&n&&(c=!1,n.length?l=n.concat(l):u=-1,l.length&&f())}function f(){if(!c){var e=o(d);c=!0;for(var t=l.length;t;){for(n=l,l=[];++u1)for(var r=1;r{N()},[]);let N=async()=>{f(!0),m("");try{let e=await i.hi.get("/api/config/export");t(e)}catch(e){m(e instanceof Error?e.message:"Failed to export configuration")}finally{f(!1)}},T=async()=>{if(e)try{await navigator.clipboard.writeText(JSON.stringify(e,null,2))}catch(e){}},E=async()=>{if(v){x(!0),y(null),w(!1);try{let e=await v.text(),t=JSON.parse(e);await i.hi.post("/api/config/import",t),y({ok:!0,message:"Configuration restored successfully."}),await N(),b(null),k.current&&(k.current.value="")}catch(e){y({ok:!1,message:e instanceof Error?e.message:"Import failed"})}finally{x(!1)}}};return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Configuration Backup & Restore"}),(0,n.jsx)("p",{className:"page-sub",children:"Export or import your full gateway configuration"})]})}),(0,n.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,n.jsx)(s,{size:18}),(0,n.jsx)("h2",{className:"text-lg font-semibold",children:"Export Configuration"})]}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:"Download a JSON file containing all current configuration settings."}),r&&(0,n.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,n.jsx)("span",{className:"w-5 h-5 border-2 border-[var(--accent)] border-t-transparent rounded-full animate-spin"})}),h&&(0,n.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-red-500/10 text-red-400 mb-4",children:[(0,n.jsx)(o.Z,{size:16,className:"mt-0.5 shrink-0"}),(0,n.jsx)("span",{className:"text-sm",children:h})]}),!r&&!h&&e&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("pre",{className:"bg-[var(--surface-100)] rounded-lg p-4 overflow-x-auto text-xs font-mono leading-relaxed max-h-80 mb-4 text-[var(--text-secondary)]",children:(0,n.jsx)("code",{children:JSON.stringify(e,null,2)})}),(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsxs)("button",{className:"btn-primary",onClick:()=>{if(!e)return;let t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),r=URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download="nexus-config-backup.json",n.click(),URL.revokeObjectURL(r)},disabled:!e,children:[(0,n.jsx)(l.Z,{size:16}),"Download Config"]}),(0,n.jsxs)("button",{className:"btn-secondary",onClick:T,children:[(0,n.jsx)(c.Z,{size:16}),"Copy to Clipboard"]})]})]}),!r&&!h&&!e&&(0,n.jsx)("div",{className:"text-center py-12 text-[var(--text-tertiary)]",children:(0,n.jsx)("p",{className:"text-sm",children:"No configuration data available."})})]}),(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,n.jsx)(u.Z,{size:18}),(0,n.jsx)("h2",{className:"text-lg font-semibold",children:"Import Configuration"})]}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:"Upload a previously exported JSON file to restore configuration."}),(0,n.jsxs)("div",{className:"border-2 border-dashed border-[var(--border)] rounded-lg p-8 text-center cursor-pointer hover:border-[var(--accent)] transition-colors",onClick:()=>{var e;return null===(e=k.current)||void 0===e?void 0:e.click()},children:[(0,n.jsx)(u.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-1",children:v?v.name:"Click to select a JSON file"}),(0,n.jsx)("p",{className:"text-xs text-[var(--text-tertiary)]",children:".json files only"}),(0,n.jsx)("input",{ref:k,type:"file",accept:".json",className:"hidden",onChange:e=>{var t;b((null===(t=e.target.files)||void 0===t?void 0:t[0])||null),y(null)}})]}),v&&!j&&(0,n.jsx)("div",{className:"mt-4",children:(0,n.jsx)("button",{className:"btn-danger w-full justify-center",onClick:()=>w(!0),disabled:p,children:p?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Importing..."]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.Z,{size:16}),"Restore from ",v.name]})})}),j&&(0,n.jsxs)("div",{className:"mt-4 p-4 rounded-lg bg-yellow-500/10 border border-yellow-500/20",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3 mb-3",children:[(0,n.jsx)(o.Z,{size:18,className:"text-yellow-400 mt-0.5 shrink-0"}),(0,n.jsx)("p",{className:"text-sm text-yellow-300",children:"This will overwrite current configuration. Continue?"})]}),(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)("button",{className:"btn-danger",onClick:E,disabled:p,children:"Yes, Restore"}),(0,n.jsx)("button",{className:"btn-secondary",onClick:()=>w(!1),disabled:p,children:"Cancel"})]})]}),g&&(0,n.jsxs)("div",{className:"mt-4 flex items-start gap-3 p-3 rounded-lg ".concat(g.ok?"bg-emerald-500/10 text-emerald-400":"bg-red-500/10 text-red-400"),children:[g.ok?(0,n.jsx)(d.Z,{size:16,className:"mt-0.5 shrink-0"}):(0,n.jsx)(o.Z,{size:16,className:"mt-0.5 shrink-0"}),(0,n.jsx)("span",{className:"text-sm",children:g.message})]})]})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return f},hi:function(){return d},jl:function(){return s},qz:function(){return i}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function s(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",s=a(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===r&&!s){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=c.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==r||s||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===r&&!s){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{i(),l.clear(),window.location.href="/login"}},f=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let i=await r.blob(),s=URL.createObjectURL(i),o=document.createElement("a");o.href=s,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=6434)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/config-backup/page-f8aede07552f28f7.js b/static/_next/static/chunks/app/config-backup/page-f8aede07552f28f7.js deleted file mode 100644 index befb486ce1c308ca34219277964ea51c6ae994c9..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/config-backup/page-f8aede07552f28f7.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2378],{6434:function(e,t,r){Promise.resolve().then(r.bind(r,9928))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:c="",children:u,iconNode:d,...f}=e;return(0,n.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:r,strokeWidth:l?24*Number(o)/Number(a):o,className:i("lucide",c),...f},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),l=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:l,...c}=r;return(0,n.createElement)(o,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),l),...c})});return r.displayName="".concat(e),r}},1671:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},8867:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},2735:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},6865:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},7689:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var l=[],c=!1,u=-1;function d(){c&&n&&(c=!1,n.length?l=n.concat(l):u=-1,l.length&&f())}function f(){if(!c){var e=o(d);c=!0;for(var t=l.length;t;){for(n=l,l=[];++u1)for(var r=1;r{N()},[]);let N=async()=>{f(!0),m("");try{let e=await i.hi.get("/api/config/export");t(e)}catch(e){m(e instanceof Error?e.message:"Failed to export configuration")}finally{f(!1)}},T=async()=>{if(e)try{await navigator.clipboard.writeText(JSON.stringify(e,null,2))}catch(e){}},E=async()=>{if(v){x(!0),y(null),w(!1);try{let e=await v.text(),t=JSON.parse(e);await i.hi.post("/api/config/import",t),y({ok:!0,message:"Configuration restored successfully."}),await N(),b(null),k.current&&(k.current.value="")}catch(e){y({ok:!1,message:e instanceof Error?e.message:"Import failed"})}finally{x(!1)}}};return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Configuration Backup & Restore"}),(0,n.jsx)("p",{className:"page-sub",children:"Export or import your full gateway configuration"})]})}),(0,n.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,n.jsx)(s,{size:18}),(0,n.jsx)("h2",{className:"text-lg font-semibold",children:"Export Configuration"})]}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:"Download a JSON file containing all current configuration settings."}),r&&(0,n.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,n.jsx)("span",{className:"w-5 h-5 border-2 border-[var(--accent)] border-t-transparent rounded-full animate-spin"})}),h&&(0,n.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-red-500/10 text-red-400 mb-4",children:[(0,n.jsx)(o.Z,{size:16,className:"mt-0.5 shrink-0"}),(0,n.jsx)("span",{className:"text-sm",children:h})]}),!r&&!h&&e&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("pre",{className:"bg-[var(--surface-100)] rounded-lg p-4 overflow-x-auto text-xs font-mono leading-relaxed max-h-80 mb-4 text-[var(--text-secondary)]",children:(0,n.jsx)("code",{children:JSON.stringify(e,null,2)})}),(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsxs)("button",{className:"btn-primary",onClick:()=>{if(!e)return;let t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),r=URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download="nexus-config-backup.json",n.click(),URL.revokeObjectURL(r)},disabled:!e,children:[(0,n.jsx)(l.Z,{size:16}),"Download Config"]}),(0,n.jsxs)("button",{className:"btn-secondary",onClick:T,children:[(0,n.jsx)(c.Z,{size:16}),"Copy to Clipboard"]})]})]}),!r&&!h&&!e&&(0,n.jsx)("div",{className:"text-center py-12 text-[var(--text-tertiary)]",children:(0,n.jsx)("p",{className:"text-sm",children:"No configuration data available."})})]}),(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,n.jsx)(u.Z,{size:18}),(0,n.jsx)("h2",{className:"text-lg font-semibold",children:"Import Configuration"})]}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:"Upload a previously exported JSON file to restore configuration."}),(0,n.jsxs)("div",{className:"border-2 border-dashed border-[var(--border)] rounded-lg p-8 text-center cursor-pointer hover:border-[var(--accent)] transition-colors",onClick:()=>{var e;return null===(e=k.current)||void 0===e?void 0:e.click()},children:[(0,n.jsx)(u.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-1",children:v?v.name:"Click to select a JSON file"}),(0,n.jsx)("p",{className:"text-xs text-[var(--text-tertiary)]",children:".json files only"}),(0,n.jsx)("input",{ref:k,type:"file",accept:".json",className:"hidden",onChange:e=>{var t;b((null===(t=e.target.files)||void 0===t?void 0:t[0])||null),y(null)}})]}),v&&!j&&(0,n.jsx)("div",{className:"mt-4",children:(0,n.jsx)("button",{className:"btn-danger w-full justify-center",onClick:()=>w(!0),disabled:p,children:p?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Importing..."]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.Z,{size:16}),"Restore from ",v.name]})})}),j&&(0,n.jsxs)("div",{className:"mt-4 p-4 rounded-lg bg-yellow-500/10 border border-yellow-500/20",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3 mb-3",children:[(0,n.jsx)(o.Z,{size:18,className:"text-yellow-400 mt-0.5 shrink-0"}),(0,n.jsx)("p",{className:"text-sm text-yellow-300",children:"This will overwrite current configuration. Continue?"})]}),(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)("button",{className:"btn-danger",onClick:E,disabled:p,children:"Yes, Restore"}),(0,n.jsx)("button",{className:"btn-secondary",onClick:()=>w(!1),disabled:p,children:"Cancel"})]})]}),g&&(0,n.jsxs)("div",{className:"mt-4 flex items-start gap-3 p-3 rounded-lg ".concat(g.ok?"bg-emerald-500/10 text-emerald-400":"bg-red-500/10 text-red-400"),children:[g.ok?(0,n.jsx)(d.Z,{size:16,className:"mt-0.5 shrink-0"}):(0,n.jsx)(o.Z,{size:16,className:"mt-0.5 shrink-0"}),(0,n.jsx)("span",{className:"text-sm",children:g.message})]})]})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return f},hi:function(){return d},jl:function(){return s},qz:function(){return i}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function s(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",s=a(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===r&&!s){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=c.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==r||s||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===r&&!s){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{i(),l.clear(),window.location.href="/login"}},f=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let i=await r.blob(),s=URL.createObjectURL(i),o=document.createElement("a");o.href=s,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=6434)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/conversations/page-832c737bd9527622.js b/static/_next/static/chunks/app/conversations/page-c7a6b871b4413f88.js similarity index 51% rename from static/_next/static/chunks/app/conversations/page-832c737bd9527622.js rename to static/_next/static/chunks/app/conversations/page-c7a6b871b4413f88.js index 7f0f66cf07d403c5453b63a1232b43ca598a40dd..d53b029a2ecca80d7c6ab825d17b04fac4be9745 100644 --- a/static/_next/static/chunks/app/conversations/page-832c737bd9527622.js +++ b/static/_next/static/chunks/app/conversations/page-c7a6b871b4413f88.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5195],{4714:function(e,t,n){Promise.resolve().then(n.bind(n,5683))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...i,width:s,height:s,stroke:n,strokeWidth:c?24*Number(o)/Number(s):o,className:a("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,i)=>{let{className:c,...l}=n;return(0,r.createElement)(o,{ref:i,iconNode:t,className:a("lucide-".concat(s(e)),c),...l})});return n.displayName="".concat(e),n}},1723:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},2208:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},3417:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var r,s;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(s=n.g.process)?void 0:s.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,s=e.exports={};function a(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var c=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?c=r.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(r=c,c=[];++u1)for(var n=1;n{a.hi.get("/api/conversations").then(t).catch(e=>h(e.message)).finally(()=>u(!1))},[]);let w=async e=>{x(e),g(!0),j(""),p(null);try{let t=await a.hi.get("/api/conversations/".concat(e));p(t)}catch(e){j(e instanceof Error?e.message:"Failed to load conversation")}finally{g(!1)}},N=async e=>{try{await a.hi.delete("/api/conversations/".concat(e)),t(t=>t.filter(t=>t.id!==e)),f===e&&(x(null),p(null))}catch(e){h(e instanceof Error?e.message:"Failed to delete")}},b=e=>new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"});return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"page-header",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Conversations"}),(0,r.jsx)("p",{className:"page-sub",children:"View and manage your conversation history"})]})}),d&&(0,r.jsx)("div",{className:"card mb-4 text-red-400 border-red-500/20",children:d}),n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"flex flex-col gap-3",children:[1,2,3,4,5].map(e=>(0,r.jsx)("div",{className:"skeleton h-8 w-full"},e))})}):0===e.length?(0,r.jsxs)("div",{className:"card flex flex-col items-center justify-center py-12 gap-3",children:[(0,r.jsx)(i.Z,{size:40,className:"text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No conversations yet"})]}):(0,r.jsx)("div",{className:"card !p-0 overflow-hidden",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Title"}),(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Messages"}),(0,r.jsx)("th",{children:"Created"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{className:"cursor-pointer",onClick:()=>w(e.id),children:[(0,r.jsx)("td",{className:"font-medium",children:e.title||"Untitled"}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"badge badge-blue",children:e.model})}),(0,r.jsx)("td",{children:(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,r.jsx)(i.Z,{size:14,className:"text-[var(--text-tertiary)]"}),e.message_count]})}),(0,r.jsx)("td",{children:(0,r.jsxs)("span",{className:"flex items-center gap-1.5 text-[var(--text-secondary)]",children:[(0,r.jsx)(o.Z,{size:14}),b(e.created_at)]})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,r.jsx)("button",{className:"btn-ghost btn-xs",onClick:t=>{t.stopPropagation(),w(e.id)},children:(0,r.jsx)(c.Z,{size:14})}),(0,r.jsx)("button",{className:"btn-danger btn-xs",onClick:t=>{t.stopPropagation(),N(e.id)},children:(0,r.jsx)(l.Z,{size:14})})]})})]},e.id))})]})})}),f&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>{x(null),p(null)},children:(0,r.jsxs)("div",{className:"modal max-w-2xl max-h-[80vh] flex flex-col",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Conversation Messages"}),(0,r.jsx)("button",{className:"btn-ghost btn-xs",onClick:()=>{x(null),p(null)},children:"✕"})]}),v?(0,r.jsx)("div",{className:"flex flex-col gap-3",children:[1,2,3].map(e=>(0,r.jsx)("div",{className:"skeleton h-16 w-full"},e))}):y?(0,r.jsx)("p",{className:"text-red-400",children:y}):m?(0,r.jsx)("div",{className:"flex-1 overflow-y-auto space-y-3",children:0===m.messages.length?(0,r.jsx)("p",{className:"text-[var(--text-tertiary)] text-center py-8",children:"No messages in this conversation"}):m.messages.map((e,t)=>(0,r.jsxs)("div",{className:"card !p-3 ".concat("user"===e.role?"border-nexus-500/20":""),children:[(0,r.jsx)("div",{className:"text-xs font-medium uppercase tracking-wider text-[var(--text-tertiary)] mb-1",children:e.role}),(0,r.jsx)("div",{className:"text-sm whitespace-pre-wrap text-[var(--text-secondary)]",children:e.content})]},t))}):null]})})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return a}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function s(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function i(){return!!s()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=s(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let s=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let o=await s.json();return"GET"!==n||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===n&&!i){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>u("/api/auth/me"),logout:()=>{a(),c.clear(),window.location.href="/login"}},h=async e=>{let t=s(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let a=await n.blob(),i=URL.createObjectURL(a),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=4714)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5195],{4714:function(e,t,n){Promise.resolve().then(n.bind(n,5683))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:n,strokeWidth:c?24*Number(o)/Number(a):o,className:s("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,i)=>{let{className:c,...l}=n;return(0,r.createElement)(o,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),c),...l})});return n.displayName="".concat(e),n}},1723:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},2208:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},3417:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var c=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?c=r.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(r=c,c=[];++u1)for(var n=1;n{s.hi.get("/api/conversations").then(t).catch(e=>h(e.message)).finally(()=>u(!1))},[]);let w=async e=>{m(e),v(!0),j(""),p(null);try{let t=await s.hi.get("/api/conversations/".concat(e));p(t)}catch(e){j(e instanceof Error?e.message:"Failed to load conversation")}finally{v(!1)}},k=async e=>{try{await s.hi.delete("/api/conversations/".concat(e)),t(t=>t.filter(t=>t.id!==e)),f===e&&(m(null),p(null))}catch(e){h(e instanceof Error?e.message:"Failed to delete")}},N=e=>new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"});return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"page-header",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Conversations"}),(0,r.jsx)("p",{className:"page-sub",children:"View and manage your conversation history"})]})}),d&&(0,r.jsx)("div",{className:"card mb-4 text-red-400 border-red-500/20",children:d}),n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"flex flex-col gap-3",children:[1,2,3,4,5].map(e=>(0,r.jsx)("div",{className:"skeleton h-8 w-full"},e))})}):0===e.length?(0,r.jsxs)("div",{className:"card flex flex-col items-center justify-center py-12 gap-3",children:[(0,r.jsx)(i.Z,{size:40,className:"text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No conversations yet"})]}):(0,r.jsx)("div",{className:"card !p-0 overflow-hidden",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Title"}),(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Messages"}),(0,r.jsx)("th",{children:"Created"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{className:"cursor-pointer",onClick:()=>w(e.id),children:[(0,r.jsx)("td",{className:"font-medium",children:e.title||"Untitled"}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"badge badge-blue",children:e.model})}),(0,r.jsx)("td",{children:(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,r.jsx)(i.Z,{size:14,className:"text-[var(--text-tertiary)]"}),e.message_count]})}),(0,r.jsx)("td",{children:(0,r.jsxs)("span",{className:"flex items-center gap-1.5 text-[var(--text-secondary)]",children:[(0,r.jsx)(o.Z,{size:14}),N(e.created_at)]})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,r.jsx)("button",{className:"btn-ghost btn-xs",onClick:t=>{t.stopPropagation(),w(e.id)},children:(0,r.jsx)(c.Z,{size:14})}),(0,r.jsx)("button",{className:"btn-danger btn-xs",onClick:t=>{t.stopPropagation(),k(e.id)},children:(0,r.jsx)(l.Z,{size:14})})]})})]},e.id))})]})})}),f&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>{m(null),p(null)},children:(0,r.jsxs)("div",{className:"modal max-w-2xl max-h-[80vh] flex flex-col",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Conversation Messages"}),(0,r.jsx)("button",{className:"btn-ghost btn-xs",onClick:()=>{m(null),p(null)},children:"✕"})]}),g?(0,r.jsx)("div",{className:"flex flex-col gap-3",children:[1,2,3].map(e=>(0,r.jsx)("div",{className:"skeleton h-16 w-full"},e))}):y?(0,r.jsx)("p",{className:"text-red-400",children:y}):x?(0,r.jsx)("div",{className:"flex-1 overflow-y-auto space-y-3",children:0===x.messages.length?(0,r.jsx)("p",{className:"text-[var(--text-tertiary)] text-center py-8",children:"No messages in this conversation"}):x.messages.map((e,t)=>(0,r.jsxs)("div",{className:"card !p-3 ".concat("user"===e.role?"border-nexus-500/20":""),children:[(0,r.jsx)("div",{className:"text-xs font-medium uppercase tracking-wider text-[var(--text-tertiary)] mb-1",children:e.role}),(0,r.jsx)("div",{className:"text-sm whitespace-pre-wrap text-[var(--text-secondary)]",children:e.content})]},t))}):null]})})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function s(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=a(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==n||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===n&&!i){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>u("/api/auth/me"),logout:()=>{s(),c.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let s=await n.blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=4714)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/conversations/page-d1e1c668033ca84e.js b/static/_next/static/chunks/app/conversations/page-d1e1c668033ca84e.js deleted file mode 100644 index 7f0f66cf07d403c5453b63a1232b43ca598a40dd..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/conversations/page-d1e1c668033ca84e.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5195],{4714:function(e,t,n){Promise.resolve().then(n.bind(n,5683))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...i,width:s,height:s,stroke:n,strokeWidth:c?24*Number(o)/Number(s):o,className:a("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,i)=>{let{className:c,...l}=n;return(0,r.createElement)(o,{ref:i,iconNode:t,className:a("lucide-".concat(s(e)),c),...l})});return n.displayName="".concat(e),n}},1723:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},2208:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},3417:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var r,s;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(s=n.g.process)?void 0:s.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,s=e.exports={};function a(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var c=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?c=r.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(r=c,c=[];++u1)for(var n=1;n{a.hi.get("/api/conversations").then(t).catch(e=>h(e.message)).finally(()=>u(!1))},[]);let w=async e=>{x(e),g(!0),j(""),p(null);try{let t=await a.hi.get("/api/conversations/".concat(e));p(t)}catch(e){j(e instanceof Error?e.message:"Failed to load conversation")}finally{g(!1)}},N=async e=>{try{await a.hi.delete("/api/conversations/".concat(e)),t(t=>t.filter(t=>t.id!==e)),f===e&&(x(null),p(null))}catch(e){h(e instanceof Error?e.message:"Failed to delete")}},b=e=>new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"});return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"page-header",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Conversations"}),(0,r.jsx)("p",{className:"page-sub",children:"View and manage your conversation history"})]})}),d&&(0,r.jsx)("div",{className:"card mb-4 text-red-400 border-red-500/20",children:d}),n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"flex flex-col gap-3",children:[1,2,3,4,5].map(e=>(0,r.jsx)("div",{className:"skeleton h-8 w-full"},e))})}):0===e.length?(0,r.jsxs)("div",{className:"card flex flex-col items-center justify-center py-12 gap-3",children:[(0,r.jsx)(i.Z,{size:40,className:"text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No conversations yet"})]}):(0,r.jsx)("div",{className:"card !p-0 overflow-hidden",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Title"}),(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Messages"}),(0,r.jsx)("th",{children:"Created"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{className:"cursor-pointer",onClick:()=>w(e.id),children:[(0,r.jsx)("td",{className:"font-medium",children:e.title||"Untitled"}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"badge badge-blue",children:e.model})}),(0,r.jsx)("td",{children:(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,r.jsx)(i.Z,{size:14,className:"text-[var(--text-tertiary)]"}),e.message_count]})}),(0,r.jsx)("td",{children:(0,r.jsxs)("span",{className:"flex items-center gap-1.5 text-[var(--text-secondary)]",children:[(0,r.jsx)(o.Z,{size:14}),b(e.created_at)]})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,r.jsx)("button",{className:"btn-ghost btn-xs",onClick:t=>{t.stopPropagation(),w(e.id)},children:(0,r.jsx)(c.Z,{size:14})}),(0,r.jsx)("button",{className:"btn-danger btn-xs",onClick:t=>{t.stopPropagation(),N(e.id)},children:(0,r.jsx)(l.Z,{size:14})})]})})]},e.id))})]})})}),f&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>{x(null),p(null)},children:(0,r.jsxs)("div",{className:"modal max-w-2xl max-h-[80vh] flex flex-col",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Conversation Messages"}),(0,r.jsx)("button",{className:"btn-ghost btn-xs",onClick:()=>{x(null),p(null)},children:"✕"})]}),v?(0,r.jsx)("div",{className:"flex flex-col gap-3",children:[1,2,3].map(e=>(0,r.jsx)("div",{className:"skeleton h-16 w-full"},e))}):y?(0,r.jsx)("p",{className:"text-red-400",children:y}):m?(0,r.jsx)("div",{className:"flex-1 overflow-y-auto space-y-3",children:0===m.messages.length?(0,r.jsx)("p",{className:"text-[var(--text-tertiary)] text-center py-8",children:"No messages in this conversation"}):m.messages.map((e,t)=>(0,r.jsxs)("div",{className:"card !p-3 ".concat("user"===e.role?"border-nexus-500/20":""),children:[(0,r.jsx)("div",{className:"text-xs font-medium uppercase tracking-wider text-[var(--text-tertiary)] mb-1",children:e.role}),(0,r.jsx)("div",{className:"text-sm whitespace-pre-wrap text-[var(--text-secondary)]",children:e.content})]},t))}):null]})})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return a}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function s(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function i(){return!!s()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=s(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let s=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let o=await s.json();return"GET"!==n||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===n&&!i){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>u("/api/auth/me"),logout:()=>{a(),c.clear(),window.location.href="/login"}},h=async e=>{let t=s(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let a=await n.blob(),i=URL.createObjectURL(a),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=4714)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/custom-providers/page-138528cda1a2fab8.js b/static/_next/static/chunks/app/custom-providers/page-138528cda1a2fab8.js deleted file mode 100644 index 2564ccbae1ee6397d6a4e0a14e9ba931742b8f5b..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/custom-providers/page-138528cda1a2fab8.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8587],{4295:function(e,t,a){Promise.resolve().then(a.bind(a,3946))},9205:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var r=a(2265);let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),a=0;a!!e&&a.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,r.forwardRef)((e,t)=>{let{color:a="currentColor",size:n=24,strokeWidth:l=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...i,width:n,height:n,stroke:a,strokeWidth:o?24*Number(l)/Number(n):l,className:s("lucide",c),...h},[...d.map(e=>{let[t,a]=e;return(0,r.createElement)(t,a)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let a=(0,r.forwardRef)((a,i)=>{let{className:o,...c}=a;return(0,r.createElement)(l,{ref:i,iconNode:t,className:s("lucide-".concat(n(e)),o),...c})});return a.displayName="".concat(e),a}},9397:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},6137:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},8930:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,a){"use strict";var r,n;e.exports=(null==(r=a.g.process)?void 0:r.env)&&"object"==typeof(null==(n=a.g.process)?void 0:n.env)?a.g.process:a(4227)},4227:function(e){!function(){var t={229:function(e){var t,a,r,n=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(a){try{return t.call(null,e,0)}catch(a){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{a="function"==typeof clearTimeout?clearTimeout:i}catch(e){a=i}}();var o=[],c=!1,u=-1;function d(){c&&r&&(c=!1,r.length?o=r.concat(o):u=-1,o.length&&h())}function h(){if(!c){var e=l(d);c=!0;for(var t=o.length;t;){for(r=o,o=[];++u1)for(var a=1;a{u(!0),s.hi.get("/api/custom-providers").then(t).finally(()=>u(!1))};(0,n.useEffect)(()=>{b()},[]),n.useEffect(()=>{if(g){let e=setTimeout(()=>j(""),3e3);return()=>clearTimeout(e)}},[g]);let N=e=>{var t;p(e),f({name:e.name,display_name:e.display_name,base_url:e.base_url,auth_header:e.auth_header,auth_prefix:e.auth_prefix,custom_headers:e.custom_headers,models:(null===(t=e.models)||void 0===t?void 0:t.join(", "))||"",notes:e.notes}),h(!0)},w=async()=>{if(x.name.trim()&&x.display_name.trim()&&x.base_url.trim()){y(!0);try{let e={name:x.name,display_name:x.display_name,base_url:x.base_url};x.auth_header&&(e.auth_header=x.auth_header),x.auth_prefix&&(e.auth_prefix=x.auth_prefix),x.custom_headers&&(e.custom_headers=x.custom_headers),x.models.trim()&&(e.models=x.models.split(",").map(e=>e.trim()).filter(Boolean)),x.notes&&(e.notes=x.notes),m?(await s.hi.put("/api/custom-providers/".concat(m.id),e),j("Provider updated")):(await s.hi.post("/api/custom-providers",e),j("Provider created")),h(!1),b()}catch(e){j(e instanceof Error?e.message:"Failed to save")}finally{y(!1)}}},_=async e=>{await s.hi.patch("/api/custom-providers/".concat(e,"/toggle")),b()},k=async e=>{confirm("Delete this custom provider?")&&(await s.hi.delete("/api/custom-providers/".concat(e)),b(),j("Provider deleted"))};return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Custom Providers"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage custom API provider integrations"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>{p(null),f(c),h(!0)},children:[(0,r.jsx)(i.Z,{size:16})," Add Provider"]})]}),d&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>h(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:m?"Edit Provider":"New Custom Provider"}),(0,r.jsxs)("div",{className:"space-y-4 max-h-[60vh] overflow-y-auto",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name *"}),(0,r.jsx)("input",{className:"input",value:x.name,onChange:e=>f(t=>({...t,name:e.target.value})),placeholder:"my-provider",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Display Name *"}),(0,r.jsx)("input",{className:"input",value:x.display_name,onChange:e=>f(t=>({...t,display_name:e.target.value})),placeholder:"My Provider"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Base URL *"}),(0,r.jsx)("input",{className:"input",value:x.base_url,onChange:e=>f(t=>({...t,base_url:e.target.value})),placeholder:"https://api.example.com"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Auth Header"}),(0,r.jsx)("input",{className:"input",value:x.auth_header,onChange:e=>f(t=>({...t,auth_header:e.target.value})),placeholder:"Authorization"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Auth Prefix"}),(0,r.jsx)("input",{className:"input",value:x.auth_prefix,onChange:e=>f(t=>({...t,auth_prefix:e.target.value})),placeholder:"Bearer"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Custom Headers (JSON)"}),(0,r.jsx)("input",{className:"input",value:x.custom_headers,onChange:e=>f(t=>({...t,custom_headers:e.target.value})),placeholder:'{"X-API-Key": "..."}'})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Models (comma-separated)"}),(0,r.jsx)("input",{className:"input",value:x.models,onChange:e=>f(t=>({...t,models:e.target.value})),placeholder:"model-1, model-2"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Notes"}),(0,r.jsx)("input",{className:"input",value:x.notes,onChange:e=>f(t=>({...t,notes:e.target.value})),placeholder:"Optional notes"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:w,disabled:v,children:v?"Saving...":"Save"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>h(!1),children:"Cancel"})]})]})]})}),a?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No custom providers yet. Add one to integrate external APIs."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Display Name"}),(0,r.jsx)("th",{children:"Base URL"}),(0,r.jsx)("th",{children:"Models"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>{var t,a;return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium",children:e.name}),(0,r.jsx)("td",{className:"text-sm",children:e.display_name}),(0,r.jsx)("td",{className:"text-xs max-w-[200px] truncate font-mono",title:e.base_url,children:e.base_url}),(0,r.jsxs)("td",{className:"text-xs max-w-[160px] truncate",title:null===(t=e.models)||void 0===t?void 0:t.join(", "),children:[(null===(a=e.models)||void 0===a?void 0:a.length)||0," models"]}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>_(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsxs)("div",{className:"flex gap-1 justify-end",children:[(0,r.jsx)("button",{onClick:()=>N(e),className:"btn-ghost btn-xs",children:"Edit"}),(0,r.jsx)("button",{onClick:()=>k(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(o.Z,{size:14})})]})})]},e.id)})})]})})}),g&&(0,r.jsx)("div",{className:"toast",children:g})]})}},1837:function(e,t,a){"use strict";a.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let r=a(257).env.NEXT_PUBLIC_API_BASE||"";function n(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!n()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.method||"GET",i=n(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===a&&!i){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let a=c.get(e);if(a)return a}let d=(async()=>{let n=await fetch("".concat(r).concat(e),{method:a,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return n;if(401===n.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!n.ok)throw Error((await n.json().catch(()=>({detail:n.statusText}))).detail||"HTTP ".concat(n.status));if(204===n.status)return;let l=await n.json();return"GET"!==a||i||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===a&&!i){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var a;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return a=r.access_token,localStorage.setItem("nexus_token",a),r},getMe:()=>u("/api/auth/me"),logout:()=>{s(),o.clear(),window.location.href="/login"}},h=async e=>{let t=n(),a=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!a.ok)throw Error("Failed to download");let s=await a.blob(),i=URL.createObjectURL(s),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=4295)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/custom-providers/page-4fc98b07b6fcfdb0.js b/static/_next/static/chunks/app/custom-providers/page-4fc98b07b6fcfdb0.js new file mode 100644 index 0000000000000000000000000000000000000000..2fb2c4dbe56ad85e14715c245e291adc08d15d5f --- /dev/null +++ b/static/_next/static/chunks/app/custom-providers/page-4fc98b07b6fcfdb0.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8587],{4295:function(e,t,a){Promise.resolve().then(a.bind(a,3946))},9205:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var n=a(2265);let r=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),a=0;a!!e&&a.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,n.forwardRef)((e,t)=>{let{color:a="currentColor",size:r=24,strokeWidth:l=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...i,width:r,height:r,stroke:a,strokeWidth:o?24*Number(l)/Number(r):l,className:s("lucide",c),...h},[...d.map(e=>{let[t,a]=e;return(0,n.createElement)(t,a)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let a=(0,n.forwardRef)((a,i)=>{let{className:o,...c}=a;return(0,n.createElement)(l,{ref:i,iconNode:t,className:s("lucide-".concat(r(e)),o),...c})});return a.displayName="".concat(e),a}},9397:function(e,t,a){"use strict";a.d(t,{Z:function(){return n}});let n=(0,a(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},6137:function(e,t,a){"use strict";a.d(t,{Z:function(){return n}});let n=(0,a(9205).Z)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},8930:function(e,t,a){"use strict";a.d(t,{Z:function(){return n}});let n=(0,a(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,a){"use strict";var n,r;e.exports=(null==(n=a.g.process)?void 0:n.env)&&"object"==typeof(null==(r=a.g.process)?void 0:r.env)?a.g.process:a(4227)},4227:function(e){!function(){var t={229:function(e){var t,a,n,r=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(a){try{return t.call(null,e,0)}catch(a){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{a="function"==typeof clearTimeout?clearTimeout:i}catch(e){a=i}}();var o=[],c=!1,u=-1;function d(){c&&n&&(c=!1,n.length?o=n.concat(o):u=-1,o.length&&h())}function h(){if(!c){var e=l(d);c=!0;for(var t=o.length;t;){for(n=o,o=[];++u1)for(var a=1;a{u(!0),s.hi.get("/api/custom-providers").then(t).finally(()=>u(!1))};(0,r.useEffect)(()=>{b()},[]),r.useEffect(()=>{if(g){let e=setTimeout(()=>j(""),3e3);return()=>clearTimeout(e)}},[g]);let N=e=>{var t;p(e),f({name:e.name,display_name:e.display_name,base_url:e.base_url,auth_header:e.auth_header,auth_prefix:e.auth_prefix,custom_headers:e.custom_headers,models:(null===(t=e.models)||void 0===t?void 0:t.join(", "))||"",notes:e.notes}),h(!0)},_=async()=>{if(x.name.trim()&&x.display_name.trim()&&x.base_url.trim()){y(!0);try{let e={name:x.name,display_name:x.display_name,base_url:x.base_url};x.auth_header&&(e.auth_header=x.auth_header),x.auth_prefix&&(e.auth_prefix=x.auth_prefix),x.custom_headers&&(e.custom_headers=x.custom_headers),x.models.trim()&&(e.models=x.models.split(",").map(e=>e.trim()).filter(Boolean)),x.notes&&(e.notes=x.notes),m?(await s.hi.put("/api/custom-providers/".concat(m.id),e),j("Provider updated")):(await s.hi.post("/api/custom-providers",e),j("Provider created")),h(!1),b()}catch(e){j(e instanceof Error?e.message:"Failed to save")}finally{y(!1)}}},w=async e=>{await s.hi.patch("/api/custom-providers/".concat(e,"/toggle")),b()},k=async e=>{confirm("Delete this custom provider?")&&(await s.hi.delete("/api/custom-providers/".concat(e)),b(),j("Provider deleted"))};return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Custom Providers"}),(0,n.jsx)("p",{className:"page-sub",children:"Manage custom API provider integrations"})]}),(0,n.jsxs)("button",{className:"btn-primary",onClick:()=>{p(null),f(c),h(!0)},children:[(0,n.jsx)(i.Z,{size:16})," Add Provider"]})]}),d&&(0,n.jsx)("div",{className:"modal-overlay",onClick:()=>h(!1),children:(0,n.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4",children:m?"Edit Provider":"New Custom Provider"}),(0,n.jsxs)("div",{className:"space-y-4 max-h-[60vh] overflow-y-auto",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Name *"}),(0,n.jsx)("input",{className:"input",value:x.name,onChange:e=>f(t=>({...t,name:e.target.value})),placeholder:"my-provider",autoFocus:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Display Name *"}),(0,n.jsx)("input",{className:"input",value:x.display_name,onChange:e=>f(t=>({...t,display_name:e.target.value})),placeholder:"My Provider"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Base URL *"}),(0,n.jsx)("input",{className:"input",value:x.base_url,onChange:e=>f(t=>({...t,base_url:e.target.value})),placeholder:"https://api.example.com"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Auth Header"}),(0,n.jsx)("input",{className:"input",value:x.auth_header,onChange:e=>f(t=>({...t,auth_header:e.target.value})),placeholder:"Authorization"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Auth Prefix"}),(0,n.jsx)("input",{className:"input",value:x.auth_prefix,onChange:e=>f(t=>({...t,auth_prefix:e.target.value})),placeholder:"Bearer"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Custom Headers (JSON)"}),(0,n.jsx)("input",{className:"input",value:x.custom_headers,onChange:e=>f(t=>({...t,custom_headers:e.target.value})),placeholder:'{"X-API-Key": "..."}'})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Models (comma-separated)"}),(0,n.jsx)("input",{className:"input",value:x.models,onChange:e=>f(t=>({...t,models:e.target.value})),placeholder:"model-1, model-2"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Notes"}),(0,n.jsx)("input",{className:"input",value:x.notes,onChange:e=>f(t=>({...t,notes:e.target.value})),placeholder:"Optional notes"})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:_,disabled:v,children:v?"Saving...":"Save"}),(0,n.jsx)("button",{className:"btn-ghost",onClick:()=>h(!1),children:"Cancel"})]})]})]})}),a?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No custom providers yet. Add one to integrate external APIs."})]}):(0,n.jsx)("div",{className:"card p-0",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Name"}),(0,n.jsx)("th",{children:"Display Name"}),(0,n.jsx)("th",{children:"Base URL"}),(0,n.jsx)("th",{children:"Models"}),(0,n.jsx)("th",{children:"Status"}),(0,n.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,n.jsx)("tbody",{children:e.map(e=>{var t,a;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"font-medium",children:e.name}),(0,n.jsx)("td",{className:"text-sm",children:e.display_name}),(0,n.jsx)("td",{className:"text-xs max-w-[200px] truncate font-mono",title:e.base_url,children:e.base_url}),(0,n.jsxs)("td",{className:"text-xs max-w-[160px] truncate",title:null===(t=e.models)||void 0===t?void 0:t.join(", "),children:[(null===(a=e.models)||void 0===a?void 0:a.length)||0," models"]}),(0,n.jsx)("td",{children:(0,n.jsx)("button",{onClick:()=>w(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsxs)("div",{className:"flex gap-1 justify-end",children:[(0,n.jsx)("button",{onClick:()=>N(e),className:"btn-ghost btn-xs",children:"Edit"}),(0,n.jsx)("button",{onClick:()=>k(e.id),className:"btn-danger btn-xs",children:(0,n.jsx)(o.Z,{size:14})})]})})]},e.id)})})]})})}),g&&(0,n.jsx)("div",{className:"toast",children:g})]})}},1837:function(e,t,a){"use strict";a.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let n=a(257).env.NEXT_PUBLIC_API_BASE||"";function r(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function s(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!r()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.method||"GET",i=r(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===a&&!i){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let a=c.get(e);if(a)return a}let d=(async()=>{let r=await fetch("".concat(n).concat(e),{method:a,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return r;if(401===r.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!r.ok)throw Error((await r.json().catch(()=>({detail:r.statusText}))).detail||"HTTP ".concat(r.status));if(204===r.status)return;let l=await r.json();return"GET"!==a||i||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===a&&!i){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var a;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return a=n.access_token,localStorage.setItem("nexus_token",a),function(e,t,a){try{let a="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(a)}catch(e){}}("nexus_token",a,0),n},getMe:()=>u("/api/auth/me"),logout:()=>{s(),o.clear(),window.location.href="/login"}},h=async e=>{let t=r(),a=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!a.ok)throw Error("Failed to download");let s=await a.blob(),i=URL.createObjectURL(s),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=4295)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/custom-providers/page-a35369052b2e039b.js b/static/_next/static/chunks/app/custom-providers/page-a35369052b2e039b.js deleted file mode 100644 index 2564ccbae1ee6397d6a4e0a14e9ba931742b8f5b..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/custom-providers/page-a35369052b2e039b.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8587],{4295:function(e,t,a){Promise.resolve().then(a.bind(a,3946))},9205:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var r=a(2265);let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),a=0;a!!e&&a.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,r.forwardRef)((e,t)=>{let{color:a="currentColor",size:n=24,strokeWidth:l=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...i,width:n,height:n,stroke:a,strokeWidth:o?24*Number(l)/Number(n):l,className:s("lucide",c),...h},[...d.map(e=>{let[t,a]=e;return(0,r.createElement)(t,a)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let a=(0,r.forwardRef)((a,i)=>{let{className:o,...c}=a;return(0,r.createElement)(l,{ref:i,iconNode:t,className:s("lucide-".concat(n(e)),o),...c})});return a.displayName="".concat(e),a}},9397:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},6137:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},8930:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,a){"use strict";var r,n;e.exports=(null==(r=a.g.process)?void 0:r.env)&&"object"==typeof(null==(n=a.g.process)?void 0:n.env)?a.g.process:a(4227)},4227:function(e){!function(){var t={229:function(e){var t,a,r,n=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(a){try{return t.call(null,e,0)}catch(a){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{a="function"==typeof clearTimeout?clearTimeout:i}catch(e){a=i}}();var o=[],c=!1,u=-1;function d(){c&&r&&(c=!1,r.length?o=r.concat(o):u=-1,o.length&&h())}function h(){if(!c){var e=l(d);c=!0;for(var t=o.length;t;){for(r=o,o=[];++u1)for(var a=1;a{u(!0),s.hi.get("/api/custom-providers").then(t).finally(()=>u(!1))};(0,n.useEffect)(()=>{b()},[]),n.useEffect(()=>{if(g){let e=setTimeout(()=>j(""),3e3);return()=>clearTimeout(e)}},[g]);let N=e=>{var t;p(e),f({name:e.name,display_name:e.display_name,base_url:e.base_url,auth_header:e.auth_header,auth_prefix:e.auth_prefix,custom_headers:e.custom_headers,models:(null===(t=e.models)||void 0===t?void 0:t.join(", "))||"",notes:e.notes}),h(!0)},w=async()=>{if(x.name.trim()&&x.display_name.trim()&&x.base_url.trim()){y(!0);try{let e={name:x.name,display_name:x.display_name,base_url:x.base_url};x.auth_header&&(e.auth_header=x.auth_header),x.auth_prefix&&(e.auth_prefix=x.auth_prefix),x.custom_headers&&(e.custom_headers=x.custom_headers),x.models.trim()&&(e.models=x.models.split(",").map(e=>e.trim()).filter(Boolean)),x.notes&&(e.notes=x.notes),m?(await s.hi.put("/api/custom-providers/".concat(m.id),e),j("Provider updated")):(await s.hi.post("/api/custom-providers",e),j("Provider created")),h(!1),b()}catch(e){j(e instanceof Error?e.message:"Failed to save")}finally{y(!1)}}},_=async e=>{await s.hi.patch("/api/custom-providers/".concat(e,"/toggle")),b()},k=async e=>{confirm("Delete this custom provider?")&&(await s.hi.delete("/api/custom-providers/".concat(e)),b(),j("Provider deleted"))};return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Custom Providers"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage custom API provider integrations"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>{p(null),f(c),h(!0)},children:[(0,r.jsx)(i.Z,{size:16})," Add Provider"]})]}),d&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>h(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:m?"Edit Provider":"New Custom Provider"}),(0,r.jsxs)("div",{className:"space-y-4 max-h-[60vh] overflow-y-auto",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name *"}),(0,r.jsx)("input",{className:"input",value:x.name,onChange:e=>f(t=>({...t,name:e.target.value})),placeholder:"my-provider",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Display Name *"}),(0,r.jsx)("input",{className:"input",value:x.display_name,onChange:e=>f(t=>({...t,display_name:e.target.value})),placeholder:"My Provider"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Base URL *"}),(0,r.jsx)("input",{className:"input",value:x.base_url,onChange:e=>f(t=>({...t,base_url:e.target.value})),placeholder:"https://api.example.com"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Auth Header"}),(0,r.jsx)("input",{className:"input",value:x.auth_header,onChange:e=>f(t=>({...t,auth_header:e.target.value})),placeholder:"Authorization"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Auth Prefix"}),(0,r.jsx)("input",{className:"input",value:x.auth_prefix,onChange:e=>f(t=>({...t,auth_prefix:e.target.value})),placeholder:"Bearer"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Custom Headers (JSON)"}),(0,r.jsx)("input",{className:"input",value:x.custom_headers,onChange:e=>f(t=>({...t,custom_headers:e.target.value})),placeholder:'{"X-API-Key": "..."}'})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Models (comma-separated)"}),(0,r.jsx)("input",{className:"input",value:x.models,onChange:e=>f(t=>({...t,models:e.target.value})),placeholder:"model-1, model-2"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Notes"}),(0,r.jsx)("input",{className:"input",value:x.notes,onChange:e=>f(t=>({...t,notes:e.target.value})),placeholder:"Optional notes"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:w,disabled:v,children:v?"Saving...":"Save"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>h(!1),children:"Cancel"})]})]})]})}),a?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No custom providers yet. Add one to integrate external APIs."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Display Name"}),(0,r.jsx)("th",{children:"Base URL"}),(0,r.jsx)("th",{children:"Models"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>{var t,a;return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium",children:e.name}),(0,r.jsx)("td",{className:"text-sm",children:e.display_name}),(0,r.jsx)("td",{className:"text-xs max-w-[200px] truncate font-mono",title:e.base_url,children:e.base_url}),(0,r.jsxs)("td",{className:"text-xs max-w-[160px] truncate",title:null===(t=e.models)||void 0===t?void 0:t.join(", "),children:[(null===(a=e.models)||void 0===a?void 0:a.length)||0," models"]}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>_(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsxs)("div",{className:"flex gap-1 justify-end",children:[(0,r.jsx)("button",{onClick:()=>N(e),className:"btn-ghost btn-xs",children:"Edit"}),(0,r.jsx)("button",{onClick:()=>k(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(o.Z,{size:14})})]})})]},e.id)})})]})})}),g&&(0,r.jsx)("div",{className:"toast",children:g})]})}},1837:function(e,t,a){"use strict";a.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let r=a(257).env.NEXT_PUBLIC_API_BASE||"";function n(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!n()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.method||"GET",i=n(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===a&&!i){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let a=c.get(e);if(a)return a}let d=(async()=>{let n=await fetch("".concat(r).concat(e),{method:a,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return n;if(401===n.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!n.ok)throw Error((await n.json().catch(()=>({detail:n.statusText}))).detail||"HTTP ".concat(n.status));if(204===n.status)return;let l=await n.json();return"GET"!==a||i||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===a&&!i){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var a;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return a=r.access_token,localStorage.setItem("nexus_token",a),r},getMe:()=>u("/api/auth/me"),logout:()=>{s(),o.clear(),window.location.href="/login"}},h=async e=>{let t=n(),a=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!a.ok)throw Error("Failed to download");let s=await a.blob(),i=URL.createObjectURL(s),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=4295)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/docs/page-097f3b9b394516d9.js b/static/_next/static/chunks/app/docs/page-097f3b9b394516d9.js deleted file mode 100644 index 2d70435c1c2ff514fcd2dbc7828badc60fe36cb3..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/docs/page-097f3b9b394516d9.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2726],{9321:function(e,t,s){Promise.resolve().then(s.bind(s,3532))},3532:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return i}});var n=s(7437),a=s(2265);let o=[{title:"Getting Started",items:[{label:"Quick Start",content:"NexusAI Gateway is a self-hosted AI API gateway. Deploy it on your server or HuggingFace Spaces. Default login: admin / nexus1234."},{label:"Authentication",content:"Use the login page to access the dashboard. Hub API keys (nxs-... prefix) are used for external access. Create them in the Keys page."}]},{title:"API Reference",items:[{label:"Chat Completions",content:"POST /v1/chat/completions — OpenAI-compatible chat endpoint. Supports all formats (OpenAI, Anthropic, Gemini, Cohere). Auto-detects input format and converts to canonical format."},{label:"Messages",content:"POST /v1/messages — Anthropic Messages API compatibility layer. Supports streaming."},{label:"Responses",content:"POST /v1/responses — API Responses endpoint. Accepts OpenAI-like response format."},{label:"Models",content:"GET /v1/models — List available models. Returns OpenAI-compatible model list."}]},{title:"Format Adapter",items:[{label:"Auto-Detection",content:"NexusAI auto-detects input format from the request body structure. No format headers needed. Supported: OpenAI Chat, OpenAI Responses, Anthropic Messages, Google Gemini, Cohere Chat, Generic."},{label:"Manual Override",content:"Set X-NexusAI-Input-Format and X-NexusAI-Output-Format headers to force a specific format conversion."}]},{title:"Routing",items:[{label:"Auto-Select",content:"When no explicit routing rule matches, NexusAI auto-selects the best provider based on model name, key availability, and provider capabilities."},{label:"Routing Rules",content:"Create patterns (e.g., gpt-4*) to route specific models to specific providers. Rules are checked in priority order."},{label:"Latency-Aware Routing",content:'Use the "lowest_latency" strategy to route to the fastest provider based on recent health check results.'}]},{title:"Rate Limiting",items:[{label:"RPM/TPM Enforcement",content:"Set rate limits on provider keys. Keys exceeding RPM (requests per minute) or TPM (tokens per minute) limits within a 60s window are excluded from selection."},{label:"Token Bucket",content:"In-memory token bucket for burst protection. Prevents upstream providers from being overwhelmed by sudden traffic spikes."}]},{title:"Providers",items:[{label:"Supported Providers",content:"OpenAI, Anthropic, Google Gemini, AWS Bedrock, Azure OpenAI, xAI Grok, GitHub Models, Replicate, HuggingFace Inference, AI21 Labs, Ollama, vLLM, LM Studio, TGI, LocalAI, Cohere, Mistral, Perplexity, Together, DeepSeek, Groq, Fireworks, OpenRouter, Novita, Lepton, Anyscale, Sambanova, Cloudflare Workers AI (28 total)."}]}];function i(){let[e,t]=a.useState("Getting Started");return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Documentation"}),(0,n.jsx)("p",{className:"page-sub",children:"Everything you need to use NexusAI Gateway"})]})}),(0,n.jsx)("div",{className:"space-y-4",children:o.map(s=>(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("button",{className:"flex items-center justify-between w-full text-left",onClick:()=>t(e===s.title?null:s.title),children:[(0,n.jsx)("h2",{className:"text-sm font-semibold",children:s.title}),(0,n.jsx)("span",{className:"transition-transform ".concat(e===s.title?"rotate-180":""),children:"▼"})]}),e===s.title&&(0,n.jsx)("div",{className:"mt-4 space-y-4",children:s.items.map(e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-sm font-medium text-nexus-400 mb-1",children:e.label}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-secondary)] leading-relaxed",children:e.content})]},e.label))})]},s.title))})]})}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=9321)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/error-6f447ef91b6f7d27.js b/static/_next/static/chunks/app/error-6f447ef91b6f7d27.js deleted file mode 100644 index 8cc85f57eaa486452dd21ca94be1d7b42ac2975f..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/error-6f447ef91b6f7d27.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7601],{3228:function(e,r,n){Promise.resolve().then(n.bind(n,376))},376:function(e,r,n){"use strict";n.r(r),n.d(r,{default:function(){return o}});var t=n(7437);function o(e){let{error:r,reset:n}=e;return(0,t.jsx)("div",{style:{minHeight:"60vh",display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:(0,t.jsxs)("div",{style:{maxWidth:480,width:"100%",background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:32,textAlign:"center"},children:[(0,t.jsxs)("svg",{width:48,height:48,style:{color:"var(--red)",margin:"0 auto 16px"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),(0,t.jsx)("h1",{style:{fontSize:20,fontWeight:600,margin:"0 0 8px"},children:"Something went wrong"}),(0,t.jsx)("p",{style:{color:"var(--text-secondary)",fontSize:14,margin:"0 0 8px",wordBreak:"break-word"},children:(null==r?void 0:r.message)||"An unexpected error occurred"}),(null==r?void 0:r.digest)&&(0,t.jsxs)("p",{style:{color:"var(--text-tertiary)",fontSize:11,fontFamily:"ui-monospace, monospace",margin:"0 0 24px"},children:["Error ID: ",r.digest]}),(0,t.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"center"},children:[(0,t.jsx)("button",{onClick:n,style:{background:"var(--accent)",color:"#fff",border:"none",padding:"10px 20px",borderRadius:8,fontSize:14,fontWeight:500,cursor:"pointer",fontFamily:"inherit"},children:"Try again"}),(0,t.jsx)("button",{onClick:()=>{window.location.href="/"},style:{background:"transparent",color:"var(--text-secondary)",border:"1px solid var(--border)",padding:"10px 20px",borderRadius:8,fontSize:14,fontWeight:500,cursor:"pointer",fontFamily:"inherit"},children:"Go home"})]})]})})}n(2265)}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3228)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/fallback-chains/page-85fd52fb5eae847a.js b/static/_next/static/chunks/app/fallback-chains/page-85fd52fb5eae847a.js new file mode 100644 index 0000000000000000000000000000000000000000..f290d18468415ece6b63b3092807a35b890cd7fa --- /dev/null +++ b/static/_next/static/chunks/app/fallback-chains/page-85fd52fb5eae847a.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1265],{9728:function(e,t,n){Promise.resolve().then(n.bind(n,4069))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:o="",children:d,iconNode:u,...h}=e;return(0,r.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:n,strokeWidth:l?24*Number(c)/Number(a):c,className:i("lucide",o),...h},[...u.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let n=(0,r.forwardRef)((n,s)=>{let{className:l,...o}=n;return(0,r.createElement)(c,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),l),...o})});return n.displayName="".concat(e),n}},3781:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var l=[],o=!1,d=-1;function u(){o&&r&&(o=!1,r.length?l=r.concat(l):d=-1,l.length&&h())}function h(){if(!o){var e=c(u);o=!0;for(var t=l.length;t;){for(r=l,l=[];++d1)for(var n=1;n{o(!0),i.hi.get("/api/fallback-chains").then(t).catch(()=>t([])).finally(()=>o(!1))};(0,a.useEffect)(()=>{v()},[]),(0,a.useEffect)(()=>{if(d){let e=setTimeout(()=>u(""),3e3);return()=>clearTimeout(e)}},[d]);let y=async e=>{try{await i.hi.patch("/api/fallback-chains/".concat(e,"/toggle")),t(t=>t.map(t=>t.id===e?{...t,is_active:!t.is_active}:t))}catch(e){u("Failed to toggle")}},j=async e=>{try{await i.hi.delete("/api/fallback-chains/".concat(e)),t(t=>t.filter(t=>t.id!==e)),g(null),u("Chain deleted")}catch(e){u("Failed to delete")}},b=e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw Error();return t.map(e=>{if("object"!=typeof e||null===e||!("provider"in e)||!("model"in e))throw Error();return{provider:String(e.provider),model:String(e.model)}})}catch(e){throw Error("Chain must be a JSON array of {provider, model} objects")}},N=async()=>{let e;if(!f.name){u("Name is required");return}if(f.chain.trim())try{e=b(f.chain)}catch(e){u(e instanceof Error?e.message:"Invalid chain format");return}let t=f.trigger_models.trim()?f.trigger_models.split(",").map(e=>e.trim()).filter(Boolean):void 0;try{await i.hi.post("/api/fallback-chains",{name:f.name,description:f.description||void 0,trigger_models:t,chain:e}),m(!1),x({name:"",description:"",trigger_models:"",chain:""}),v(),u("Chain created")}catch(e){u(e instanceof Error?e.message:"Failed")}};return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Fallback Chains"}),(0,r.jsx)("p",{className:"page-sub",children:"Model fallback and retry chain configuration"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>m(!0),children:[(0,r.jsx)(s.Z,{size:16})," New Chain"]})]}),h&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>m(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Fallback Chain"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name"}),(0,r.jsx)("input",{className:"input",value:f.name,onChange:e=>x(t=>({...t,name:e.target.value})),autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Description"}),(0,r.jsx)("input",{className:"input",value:f.description,onChange:e=>x(t=>({...t,description:e.target.value}))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Trigger Models (comma-separated)"}),(0,r.jsx)("input",{className:"input",value:f.trigger_models,onChange:e=>x(t=>({...t,trigger_models:e.target.value})),placeholder:"gpt-4, claude-3-opus"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Fallback Chain (JSON array)"}),(0,r.jsx)("textarea",{className:"input font-mono text-xs min-h-[80px] resize-y",value:f.chain,onChange:e=>x(t=>({...t,chain:e.target.value})),placeholder:'[{"provider": "openai", "model": "gpt-3.5-turbo"}, {"provider": "anthropic", "model": "claude-3-haiku"}]'})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:N,children:"Create"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>m(!1),children:"Cancel"})]})]})]})}),null!==p&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>g(null),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-2",children:"Delete Chain"}),(0,r.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:"Are you sure you want to delete this fallback chain? This action cannot be undone."}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-danger flex-1 justify-center",onClick:()=>j(p),children:"Delete"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>g(null),children:"Cancel"})]})]})}),n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No fallback chains configured."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"ID"}),(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Trigger Models"}),(0,r.jsx)("th",{children:"Chain Steps"}),(0,r.jsx)("th",{children:"Times Triggered"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"text-xs font-mono text-[var(--text-tertiary)]",children:e.id}),(0,r.jsx)("td",{className:"font-medium",children:e.name}),(0,r.jsx)("td",{children:e.trigger_models.length>0?(0,r.jsx)("div",{className:"flex gap-1 flex-wrap",children:e.trigger_models.map(e=>(0,r.jsx)("span",{className:"badge-purple text-xs",children:e},e))}):(0,r.jsx)("span",{className:"text-xs text-[var(--text-tertiary)]",children:"Any"})}),(0,r.jsx)("td",{children:(0,r.jsx)("div",{className:"flex flex-col gap-0.5",children:e.chain.map((e,t)=>(0,r.jsxs)("span",{className:"text-xs text-[var(--text-secondary)]",children:[t>0&&(0,r.jsx)("span",{className:"text-[var(--text-tertiary)] mr-1",children:"→"}),(0,r.jsx)("span",{className:"font-medium",children:e.provider}),"/",e.model]},t))})}),(0,r.jsx)("td",{className:"font-mono text-sm",children:e.times_triggered}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>y(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsx)("button",{onClick:()=>g(e.id),className:"btn-ghost btn-xs text-[var(--text-tertiary)] hover:text-red-400",title:"Delete",children:(0,r.jsx)(l.Z,{size:14})})})]},e.id))})]})})}),d&&(0,r.jsx)("div",{className:"toast",children:d})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return s},qz:function(){return i}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function i(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function s(){return!!a()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",s=a(),d={"Content-Type":"application/json",...t.headers};if(s&&(d.Authorization="Bearer ".concat(s)),"GET"===n&&!s){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=o.get(e);if(n)return n}let u=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let c=await a.json();return"GET"!==n||s||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===n&&!s){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>d("/api/auth/me"),logout:()=>{i(),l.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let i=await n.blob(),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=9728)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/fallback-chains/page-8e5925e44323ee69.js b/static/_next/static/chunks/app/fallback-chains/page-8e5925e44323ee69.js deleted file mode 100644 index 8458a0980bb41225cdcae375e05e8c5d51bca3b1..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/fallback-chains/page-8e5925e44323ee69.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1265],{9728:function(e,t,r){Promise.resolve().then(r.bind(r,4069))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,n.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:r,strokeWidth:c?24*Number(l)/Number(a):l,className:i("lucide",o),...h},[...u.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:c,...o}=r;return(0,n.createElement)(l,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),c),...o})});return r.displayName="".concat(e),r}},3781:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]])},9397:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8930:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c=[],o=!1,d=-1;function u(){o&&n&&(o=!1,n.length?c=n.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(n=c,c=[];++d1)for(var r=1;r{o(!0),i.hi.get("/api/fallback-chains").then(t).catch(()=>t([])).finally(()=>o(!1))};(0,a.useEffect)(()=>{v()},[]),(0,a.useEffect)(()=>{if(d){let e=setTimeout(()=>u(""),3e3);return()=>clearTimeout(e)}},[d]);let y=async e=>{try{await i.hi.patch("/api/fallback-chains/".concat(e,"/toggle")),t(t=>t.map(t=>t.id===e?{...t,is_active:!t.is_active}:t))}catch(e){u("Failed to toggle")}},j=async e=>{try{await i.hi.delete("/api/fallback-chains/".concat(e)),t(t=>t.filter(t=>t.id!==e)),g(null),u("Chain deleted")}catch(e){u("Failed to delete")}},b=e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw Error();return t.map(e=>{if("object"!=typeof e||null===e||!("provider"in e)||!("model"in e))throw Error();return{provider:String(e.provider),model:String(e.model)}})}catch(e){throw Error("Chain must be a JSON array of {provider, model} objects")}},N=async()=>{let e;if(!f.name){u("Name is required");return}if(f.chain.trim())try{e=b(f.chain)}catch(e){u(e instanceof Error?e.message:"Invalid chain format");return}let t=f.trigger_models.trim()?f.trigger_models.split(",").map(e=>e.trim()).filter(Boolean):void 0;try{await i.hi.post("/api/fallback-chains",{name:f.name,description:f.description||void 0,trigger_models:t,chain:e}),m(!1),x({name:"",description:"",trigger_models:"",chain:""}),v(),u("Chain created")}catch(e){u(e instanceof Error?e.message:"Failed")}};return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Fallback Chains"}),(0,n.jsx)("p",{className:"page-sub",children:"Model fallback and retry chain configuration"})]}),(0,n.jsxs)("button",{className:"btn-primary",onClick:()=>m(!0),children:[(0,n.jsx)(s.Z,{size:16})," New Chain"]})]}),h&&(0,n.jsx)("div",{className:"modal-overlay",onClick:()=>m(!1),children:(0,n.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Fallback Chain"}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Name"}),(0,n.jsx)("input",{className:"input",value:f.name,onChange:e=>x(t=>({...t,name:e.target.value})),autoFocus:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Description"}),(0,n.jsx)("input",{className:"input",value:f.description,onChange:e=>x(t=>({...t,description:e.target.value}))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Trigger Models (comma-separated)"}),(0,n.jsx)("input",{className:"input",value:f.trigger_models,onChange:e=>x(t=>({...t,trigger_models:e.target.value})),placeholder:"gpt-4, claude-3-opus"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Fallback Chain (JSON array)"}),(0,n.jsx)("textarea",{className:"input font-mono text-xs min-h-[80px] resize-y",value:f.chain,onChange:e=>x(t=>({...t,chain:e.target.value})),placeholder:'[{"provider": "openai", "model": "gpt-3.5-turbo"}, {"provider": "anthropic", "model": "claude-3-haiku"}]'})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:N,children:"Create"}),(0,n.jsx)("button",{className:"btn-ghost",onClick:()=>m(!1),children:"Cancel"})]})]})]})}),null!==p&&(0,n.jsx)("div",{className:"modal-overlay",onClick:()=>g(null),children:(0,n.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-2",children:"Delete Chain"}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:"Are you sure you want to delete this fallback chain? This action cannot be undone."}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{className:"btn-danger flex-1 justify-center",onClick:()=>j(p),children:"Delete"}),(0,n.jsx)("button",{className:"btn-ghost",onClick:()=>g(null),children:"Cancel"})]})]})}),r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No fallback chains configured."})]}):(0,n.jsx)("div",{className:"card p-0",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"ID"}),(0,n.jsx)("th",{children:"Name"}),(0,n.jsx)("th",{children:"Trigger Models"}),(0,n.jsx)("th",{children:"Chain Steps"}),(0,n.jsx)("th",{children:"Times Triggered"}),(0,n.jsx)("th",{children:"Status"}),(0,n.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,n.jsx)("tbody",{children:e.map(e=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"text-xs font-mono text-[var(--text-tertiary)]",children:e.id}),(0,n.jsx)("td",{className:"font-medium",children:e.name}),(0,n.jsx)("td",{children:e.trigger_models.length>0?(0,n.jsx)("div",{className:"flex gap-1 flex-wrap",children:e.trigger_models.map(e=>(0,n.jsx)("span",{className:"badge-purple text-xs",children:e},e))}):(0,n.jsx)("span",{className:"text-xs text-[var(--text-tertiary)]",children:"Any"})}),(0,n.jsx)("td",{children:(0,n.jsx)("div",{className:"flex flex-col gap-0.5",children:e.chain.map((e,t)=>(0,n.jsxs)("span",{className:"text-xs text-[var(--text-secondary)]",children:[t>0&&(0,n.jsx)("span",{className:"text-[var(--text-tertiary)] mr-1",children:"→"}),(0,n.jsx)("span",{className:"font-medium",children:e.provider}),"/",e.model]},t))})}),(0,n.jsx)("td",{className:"font-mono text-sm",children:e.times_triggered}),(0,n.jsx)("td",{children:(0,n.jsx)("button",{onClick:()=>y(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsx)("button",{onClick:()=>g(e.id),className:"btn-ghost btn-xs text-[var(--text-tertiary)] hover:text-red-400",title:"Delete",children:(0,n.jsx)(c.Z,{size:14})})})]},e.id))})]})})}),d&&(0,n.jsx)("div",{className:"toast",children:d})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return s},qz:function(){return i}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function s(){return!!a()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",s=a(),d={"Content-Type":"application/json",...t.headers};if(s&&(d.Authorization="Bearer ".concat(s)),"GET"===r&&!s){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let u=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let l=await a.json();return"GET"!==r||s||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===r&&!s){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>d("/api/auth/me"),logout:()=>{i(),c.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let i=await r.blob(),s=URL.createObjectURL(i),l=document.createElement("a");l.href=s,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=9728)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/fallback-chains/page-9e30e5f90985c3e3.js b/static/_next/static/chunks/app/fallback-chains/page-9e30e5f90985c3e3.js deleted file mode 100644 index 8458a0980bb41225cdcae375e05e8c5d51bca3b1..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/fallback-chains/page-9e30e5f90985c3e3.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1265],{9728:function(e,t,r){Promise.resolve().then(r.bind(r,4069))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,n.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:r,strokeWidth:c?24*Number(l)/Number(a):l,className:i("lucide",o),...h},[...u.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:c,...o}=r;return(0,n.createElement)(l,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),c),...o})});return r.displayName="".concat(e),r}},3781:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]])},9397:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8930:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c=[],o=!1,d=-1;function u(){o&&n&&(o=!1,n.length?c=n.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(n=c,c=[];++d1)for(var r=1;r{o(!0),i.hi.get("/api/fallback-chains").then(t).catch(()=>t([])).finally(()=>o(!1))};(0,a.useEffect)(()=>{v()},[]),(0,a.useEffect)(()=>{if(d){let e=setTimeout(()=>u(""),3e3);return()=>clearTimeout(e)}},[d]);let y=async e=>{try{await i.hi.patch("/api/fallback-chains/".concat(e,"/toggle")),t(t=>t.map(t=>t.id===e?{...t,is_active:!t.is_active}:t))}catch(e){u("Failed to toggle")}},j=async e=>{try{await i.hi.delete("/api/fallback-chains/".concat(e)),t(t=>t.filter(t=>t.id!==e)),g(null),u("Chain deleted")}catch(e){u("Failed to delete")}},b=e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw Error();return t.map(e=>{if("object"!=typeof e||null===e||!("provider"in e)||!("model"in e))throw Error();return{provider:String(e.provider),model:String(e.model)}})}catch(e){throw Error("Chain must be a JSON array of {provider, model} objects")}},N=async()=>{let e;if(!f.name){u("Name is required");return}if(f.chain.trim())try{e=b(f.chain)}catch(e){u(e instanceof Error?e.message:"Invalid chain format");return}let t=f.trigger_models.trim()?f.trigger_models.split(",").map(e=>e.trim()).filter(Boolean):void 0;try{await i.hi.post("/api/fallback-chains",{name:f.name,description:f.description||void 0,trigger_models:t,chain:e}),m(!1),x({name:"",description:"",trigger_models:"",chain:""}),v(),u("Chain created")}catch(e){u(e instanceof Error?e.message:"Failed")}};return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Fallback Chains"}),(0,n.jsx)("p",{className:"page-sub",children:"Model fallback and retry chain configuration"})]}),(0,n.jsxs)("button",{className:"btn-primary",onClick:()=>m(!0),children:[(0,n.jsx)(s.Z,{size:16})," New Chain"]})]}),h&&(0,n.jsx)("div",{className:"modal-overlay",onClick:()=>m(!1),children:(0,n.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Fallback Chain"}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Name"}),(0,n.jsx)("input",{className:"input",value:f.name,onChange:e=>x(t=>({...t,name:e.target.value})),autoFocus:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Description"}),(0,n.jsx)("input",{className:"input",value:f.description,onChange:e=>x(t=>({...t,description:e.target.value}))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Trigger Models (comma-separated)"}),(0,n.jsx)("input",{className:"input",value:f.trigger_models,onChange:e=>x(t=>({...t,trigger_models:e.target.value})),placeholder:"gpt-4, claude-3-opus"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Fallback Chain (JSON array)"}),(0,n.jsx)("textarea",{className:"input font-mono text-xs min-h-[80px] resize-y",value:f.chain,onChange:e=>x(t=>({...t,chain:e.target.value})),placeholder:'[{"provider": "openai", "model": "gpt-3.5-turbo"}, {"provider": "anthropic", "model": "claude-3-haiku"}]'})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:N,children:"Create"}),(0,n.jsx)("button",{className:"btn-ghost",onClick:()=>m(!1),children:"Cancel"})]})]})]})}),null!==p&&(0,n.jsx)("div",{className:"modal-overlay",onClick:()=>g(null),children:(0,n.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-2",children:"Delete Chain"}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:"Are you sure you want to delete this fallback chain? This action cannot be undone."}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{className:"btn-danger flex-1 justify-center",onClick:()=>j(p),children:"Delete"}),(0,n.jsx)("button",{className:"btn-ghost",onClick:()=>g(null),children:"Cancel"})]})]})}),r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No fallback chains configured."})]}):(0,n.jsx)("div",{className:"card p-0",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"ID"}),(0,n.jsx)("th",{children:"Name"}),(0,n.jsx)("th",{children:"Trigger Models"}),(0,n.jsx)("th",{children:"Chain Steps"}),(0,n.jsx)("th",{children:"Times Triggered"}),(0,n.jsx)("th",{children:"Status"}),(0,n.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,n.jsx)("tbody",{children:e.map(e=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"text-xs font-mono text-[var(--text-tertiary)]",children:e.id}),(0,n.jsx)("td",{className:"font-medium",children:e.name}),(0,n.jsx)("td",{children:e.trigger_models.length>0?(0,n.jsx)("div",{className:"flex gap-1 flex-wrap",children:e.trigger_models.map(e=>(0,n.jsx)("span",{className:"badge-purple text-xs",children:e},e))}):(0,n.jsx)("span",{className:"text-xs text-[var(--text-tertiary)]",children:"Any"})}),(0,n.jsx)("td",{children:(0,n.jsx)("div",{className:"flex flex-col gap-0.5",children:e.chain.map((e,t)=>(0,n.jsxs)("span",{className:"text-xs text-[var(--text-secondary)]",children:[t>0&&(0,n.jsx)("span",{className:"text-[var(--text-tertiary)] mr-1",children:"→"}),(0,n.jsx)("span",{className:"font-medium",children:e.provider}),"/",e.model]},t))})}),(0,n.jsx)("td",{className:"font-mono text-sm",children:e.times_triggered}),(0,n.jsx)("td",{children:(0,n.jsx)("button",{onClick:()=>y(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsx)("button",{onClick:()=>g(e.id),className:"btn-ghost btn-xs text-[var(--text-tertiary)] hover:text-red-400",title:"Delete",children:(0,n.jsx)(c.Z,{size:14})})})]},e.id))})]})})}),d&&(0,n.jsx)("div",{className:"toast",children:d})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return s},qz:function(){return i}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function s(){return!!a()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",s=a(),d={"Content-Type":"application/json",...t.headers};if(s&&(d.Authorization="Bearer ".concat(s)),"GET"===r&&!s){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let u=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let l=await a.json();return"GET"!==r||s||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===r&&!s){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>d("/api/auth/me"),logout:()=>{i(),c.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let i=await r.blob(),s=URL.createObjectURL(i),l=document.createElement("a");l.href=s,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=9728)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/fine-tuning/page-9b95c51fc01eb318.js b/static/_next/static/chunks/app/fine-tuning/page-0f5de87c7b897ed1.js similarity index 80% rename from static/_next/static/chunks/app/fine-tuning/page-9b95c51fc01eb318.js rename to static/_next/static/chunks/app/fine-tuning/page-0f5de87c7b897ed1.js index d15b88b71817d2cf79e79221a9dc6e2d5b81483c..e6ef4b986dfe4bf7cf47b88290fc0e1abc774fa2 100644 --- a/static/_next/static/chunks/app/fine-tuning/page-9b95c51fc01eb318.js +++ b/static/_next/static/chunks/app/fine-tuning/page-0f5de87c7b897ed1.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8919],{3461:function(e,t,n){Promise.resolve().then(n.bind(n,3396))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var a=n(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var r={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,a.forwardRef)((e,t)=>{let{color:n="currentColor",size:i=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...r,width:i,height:i,stroke:n,strokeWidth:c?24*Number(l)/Number(i):l,className:s("lucide",o),...h},[...u.map(e=>{let[t,n]=e;return(0,a.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let n=(0,a.forwardRef)((n,r)=>{let{className:c,...o}=n;return(0,a.createElement)(l,{ref:r,iconNode:t,className:s("lucide-".concat(i(e)),c),...o})});return n.displayName="".concat(e),n}},4972:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]])},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},1671:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},9388:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},1723:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7689:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},2489:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},257:function(e,t,n){"use strict";var a,i;e.exports=(null==(a=n.g.process)?void 0:a.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,a,i=e.exports={};function s(){throw Error("setTimeout has not been defined")}function r(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:r}catch(e){n=r}}();var c=[],o=!1,d=-1;function u(){o&&a&&(o=!1,a.length?c=a.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(a=c,c=[];++d1)for(var n=1;n{r(!0),c(""),s.hi.get("/v1/fine_tuning/jobs").then(e=>t(e.data||[])).catch(e=>c(e instanceof Error?e.message:"Failed to load jobs")).finally(()=>r(!1))},$=()=>{s.hi.get("/v1/models").then(e=>{let t=e.data.map(e=>e.id).sort();k(t),t.length>0&&!C&&S(t[0])}).catch(()=>{})},Q=()=>{s.hi.get("/v1/files").then(e=>{T(e.data||[]),(e.data||[]).length>0&&E(e.data[0].id)}).catch(()=>{})};(0,i.useEffect)(()=>{K()},[]),(0,i.useEffect)(()=>{if(O){let e=setTimeout(()=>q(""),3e3);return()=>clearTimeout(e)}},[O]);let V=async()=>{if(C.trim()&&Z.trim()){P(!0);try{await s.hi.post("/v1/fine_tuning/jobs",{model:C,training_file:Z,hyperparameters:{n_epochs:z,batch_size:M,learning_rate_multiplier:L}}),j(!1),E(""),_(3),A(1),U(1),q("Fine-tuning job created"),K()}catch(e){q(e instanceof Error?e.message:"Failed to create job")}finally{P(!1)}}},Y=async e=>{if(confirm("Cancel this fine-tuning job? This action cannot be undone.")){R(e);try{await s.hi.post("/v1/fine_tuning/jobs/".concat(e,"/cancel"),{}),q("Job cancelled"),K()}catch(e){q(e instanceof Error?e.message:"Failed to cancel job")}finally{R(null)}}},ee=async()=>{if(I){G(!0),W("Uploading...");try{let e=await I.text(),t=localStorage.getItem("nexus_token"),n=await fetch("/v1/files",{method:"POST",headers:{"Content-Type":"application/json",...t?{Authorization:"Bearer ".concat(t)}:{}},body:JSON.stringify({file:e,purpose:"fine-tune"})});if(!n.ok){let e=await n.json().catch(()=>({detail:n.statusText}));throw Error(e.detail||"HTTP ".concat(n.status))}let a=await n.json();q("Uploaded: ".concat(a.filename||a.id||"file")),b(!1),J(null),X.current&&(X.current.value=""),Q()}catch(e){W(e instanceof Error?e.message:"Upload failed")}finally{G(!1)}}},et=e=>new Date(1e3*e).toLocaleString();return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"page-header",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"Fine-Tuning"}),(0,a.jsx)("p",{className:"page-sub",children:"Manage fine-tuning jobs"})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("button",{className:"btn-secondary",onClick:()=>b(!0),children:[(0,a.jsx)(d.Z,{size:16})," Upload File"]}),(0,a.jsxs)("button",{className:"btn-primary",onClick:()=>{$(),Q(),j(!0)},children:[(0,a.jsx)(u.Z,{size:16})," Create Job"]})]})]}),y&&(0,a.jsx)("div",{className:"modal-overlay",onClick:()=>j(!1),children:(0,a.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Create Fine-Tuning Job"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Model"}),(0,a.jsxs)("select",{className:"select",value:C,onChange:e=>S(e.target.value),children:[(0,a.jsx)("option",{value:"",children:"Select model"}),N.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Training File"}),(0,a.jsxs)("select",{className:"select",value:Z,onChange:e=>E(e.target.value),children:[(0,a.jsx)("option",{value:"",children:"Select file"}),w.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.filename," (",e.id,")"]},e.id))]}),0===w.length&&(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:'No files uploaded yet. Use "Upload File" first.'})]}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Epochs"}),(0,a.jsx)("input",{className:"input",type:"number",min:1,value:z,onChange:e=>_(Number(e.target.value))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Batch Size"}),(0,a.jsx)("input",{className:"input",type:"number",min:1,value:M,onChange:e=>A(Number(e.target.value))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Learning Rate"}),(0,a.jsx)("input",{className:"input",type:"number",step:"0.1",min:.1,value:L,onChange:e=>U(Number(e.target.value))})]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:V,disabled:F||!C||!Z,children:F?"Creating...":"Create"}),(0,a.jsx)("button",{className:"btn-ghost",onClick:()=>j(!1),children:"Cancel"})]})]})]})}),n?(0,a.jsx)("div",{className:"card",children:(0,a.jsx)("div",{className:"skeleton h-32 w-full"})}):l?(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,a.jsx)("p",{className:"text-red-400",children:l})]}):0===e.length?(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)(h.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,a.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No fine-tuning jobs yet."})]}):(0,a.jsx)("div",{className:"card p-0",children:(0,a.jsx)("div",{className:"table-wrap",children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"ID"}),(0,a.jsx)("th",{children:"Model"}),(0,a.jsx)("th",{children:"Status"}),(0,a.jsx)("th",{children:"Created"}),(0,a.jsx)("th",{children:"Trained Tokens"}),(0,a.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,a.jsx)("tbody",{children:e.map(e=>{var t;return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"font-mono text-xs",children:e.id}),(0,a.jsx)("td",{className:"font-medium",children:e.model}),(0,a.jsx)("td",{children:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 ".concat(x[e.status]||"badge-gray"),children:[p[e.status]||null,e.status]})}),(0,a.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:et(e.created_at)}),(0,a.jsx)("td",{children:(null===(t=e.trained_tokens)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,a.jsx)("td",{className:"text-right",children:g.includes(e.status)&&(0,a.jsx)("button",{onClick:()=>Y(e.id),disabled:B===e.id,className:"btn-danger btn-xs",title:"Cancel job",children:B===e.id?(0,a.jsx)("span",{className:"w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(f,{size:14})})})]},e.id)})})]})})}),v&&(0,a.jsx)("div",{className:"modal-overlay",onClick:()=>!D&&b(!1),children:(0,a.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Upload Training File"}),(0,a.jsx)("button",{onClick:()=>!D&&b(!1),className:"btn-ghost btn-xs",children:(0,a.jsx)(m.Z,{size:14})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"File (JSONL)"}),(0,a.jsx)("input",{ref:X,type:"file",className:"input",accept:".jsonl,.json,.txt",onChange:e=>{var t;return J((null===(t=e.target.files)||void 0===t?void 0:t[0])||null)},disabled:D}),I&&(0,a.jsxs)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:["Selected: ",I.name," (",(I.size/1024).toFixed(1)," KB)"]})]}),H&&(0,a.jsx)("p",{className:"text-sm text-[var(--text-secondary)]",children:H}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:ee,disabled:!I||D,children:D?"Uploading...":"Upload"}),(0,a.jsx)("button",{className:"btn-ghost",onClick:()=>!D&&b(!1),disabled:D,children:"Cancel"})]})]})]})}),O&&(0,a.jsx)("div",{className:"toast",children:O})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return r},qz:function(){return s}});let a=n(257).env.NEXT_PUBLIC_API_BASE||"";function i(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function r(){return!!i()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",r=i(),d={"Content-Type":"application/json",...t.headers};if(r&&(d.Authorization="Bearer ".concat(r)),"GET"===n&&!r){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=o.get(e);if(n)return n}let u=(async()=>{let i=await fetch("".concat(a).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&r&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let l=await i.json();return"GET"!==n||r||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===n&&!r){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=a.access_token,localStorage.setItem("nexus_token",n),a},getMe:()=>d("/api/auth/me"),logout:()=>{s(),c.clear(),window.location.href="/login"}},h=async e=>{let t=i(),n=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let s=await n.blob(),r=URL.createObjectURL(s),l=document.createElement("a");l.href=r,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(r)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3461)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8919],{3461:function(e,t,n){Promise.resolve().then(n.bind(n,3396))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var a=n(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var r={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,a.forwardRef)((e,t)=>{let{color:n="currentColor",size:i=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...r,width:i,height:i,stroke:n,strokeWidth:c?24*Number(l)/Number(i):l,className:s("lucide",o),...h},[...u.map(e=>{let[t,n]=e;return(0,a.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let n=(0,a.forwardRef)((n,r)=>{let{className:c,...o}=n;return(0,a.createElement)(l,{ref:r,iconNode:t,className:s("lucide-".concat(i(e)),c),...o})});return n.displayName="".concat(e),n}},4972:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]])},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},1671:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},9388:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},1723:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7689:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},2489:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},257:function(e,t,n){"use strict";var a,i;e.exports=(null==(a=n.g.process)?void 0:a.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,a,i=e.exports={};function s(){throw Error("setTimeout has not been defined")}function r(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:r}catch(e){n=r}}();var c=[],o=!1,d=-1;function u(){o&&a&&(o=!1,a.length?c=a.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(a=c,c=[];++d1)for(var n=1;n{r(!0),c(""),s.hi.get("/v1/fine_tuning/jobs").then(e=>t(e.data||[])).catch(e=>c(e instanceof Error?e.message:"Failed to load jobs")).finally(()=>r(!1))},$=()=>{s.hi.get("/v1/models").then(e=>{let t=e.data.map(e=>e.id).sort();N(t),t.length>0&&!C&&S(t[0])}).catch(()=>{})},Q=()=>{s.hi.get("/v1/files").then(e=>{T(e.data||[]),(e.data||[]).length>0&&E(e.data[0].id)}).catch(()=>{})};(0,i.useEffect)(()=>{K()},[]),(0,i.useEffect)(()=>{if(O){let e=setTimeout(()=>q(""),3e3);return()=>clearTimeout(e)}},[O]);let V=async()=>{if(C.trim()&&Z.trim()){P(!0);try{await s.hi.post("/v1/fine_tuning/jobs",{model:C,training_file:Z,hyperparameters:{n_epochs:_,batch_size:L,learning_rate_multiplier:A}}),j(!1),E(""),z(3),M(1),U(1),q("Fine-tuning job created"),K()}catch(e){q(e instanceof Error?e.message:"Failed to create job")}finally{P(!1)}}},Y=async e=>{if(confirm("Cancel this fine-tuning job? This action cannot be undone.")){R(e);try{await s.hi.post("/v1/fine_tuning/jobs/".concat(e,"/cancel"),{}),q("Job cancelled"),K()}catch(e){q(e instanceof Error?e.message:"Failed to cancel job")}finally{R(null)}}},ee=async()=>{if(I){G(!0),W("Uploading...");try{let e=await I.text(),t=localStorage.getItem("nexus_token"),n=await fetch("/v1/files",{method:"POST",headers:{"Content-Type":"application/json",...t?{Authorization:"Bearer ".concat(t)}:{}},body:JSON.stringify({file:e,purpose:"fine-tune"})});if(!n.ok){let e=await n.json().catch(()=>({detail:n.statusText}));throw Error(e.detail||"HTTP ".concat(n.status))}let a=await n.json();q("Uploaded: ".concat(a.filename||a.id||"file")),b(!1),J(null),X.current&&(X.current.value=""),Q()}catch(e){W(e instanceof Error?e.message:"Upload failed")}finally{G(!1)}}},et=e=>new Date(1e3*e).toLocaleString();return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"page-header",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"Fine-Tuning"}),(0,a.jsx)("p",{className:"page-sub",children:"Manage fine-tuning jobs"})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("button",{className:"btn-secondary",onClick:()=>b(!0),children:[(0,a.jsx)(d.Z,{size:16})," Upload File"]}),(0,a.jsxs)("button",{className:"btn-primary",onClick:()=>{$(),Q(),j(!0)},children:[(0,a.jsx)(u.Z,{size:16})," Create Job"]})]})]}),y&&(0,a.jsx)("div",{className:"modal-overlay",onClick:()=>j(!1),children:(0,a.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Create Fine-Tuning Job"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Model"}),(0,a.jsxs)("select",{className:"select",value:C,onChange:e=>S(e.target.value),children:[(0,a.jsx)("option",{value:"",children:"Select model"}),k.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Training File"}),(0,a.jsxs)("select",{className:"select",value:Z,onChange:e=>E(e.target.value),children:[(0,a.jsx)("option",{value:"",children:"Select file"}),w.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.filename," (",e.id,")"]},e.id))]}),0===w.length&&(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:'No files uploaded yet. Use "Upload File" first.'})]}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Epochs"}),(0,a.jsx)("input",{className:"input",type:"number",min:1,value:_,onChange:e=>z(Number(e.target.value))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Batch Size"}),(0,a.jsx)("input",{className:"input",type:"number",min:1,value:L,onChange:e=>M(Number(e.target.value))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Learning Rate"}),(0,a.jsx)("input",{className:"input",type:"number",step:"0.1",min:.1,value:A,onChange:e=>U(Number(e.target.value))})]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:V,disabled:F||!C||!Z,children:F?"Creating...":"Create"}),(0,a.jsx)("button",{className:"btn-ghost",onClick:()=>j(!1),children:"Cancel"})]})]})]})}),n?(0,a.jsx)("div",{className:"card",children:(0,a.jsx)("div",{className:"skeleton h-32 w-full"})}):l?(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,a.jsx)("p",{className:"text-red-400",children:l})]}):0===e.length?(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)(h.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,a.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No fine-tuning jobs yet."})]}):(0,a.jsx)("div",{className:"card p-0",children:(0,a.jsx)("div",{className:"table-wrap",children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"ID"}),(0,a.jsx)("th",{children:"Model"}),(0,a.jsx)("th",{children:"Status"}),(0,a.jsx)("th",{children:"Created"}),(0,a.jsx)("th",{children:"Trained Tokens"}),(0,a.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,a.jsx)("tbody",{children:e.map(e=>{var t;return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"font-mono text-xs",children:e.id}),(0,a.jsx)("td",{className:"font-medium",children:e.model}),(0,a.jsx)("td",{children:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 ".concat(x[e.status]||"badge-gray"),children:[p[e.status]||null,e.status]})}),(0,a.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:et(e.created_at)}),(0,a.jsx)("td",{children:(null===(t=e.trained_tokens)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,a.jsx)("td",{className:"text-right",children:g.includes(e.status)&&(0,a.jsx)("button",{onClick:()=>Y(e.id),disabled:B===e.id,className:"btn-danger btn-xs",title:"Cancel job",children:B===e.id?(0,a.jsx)("span",{className:"w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(f,{size:14})})})]},e.id)})})]})})}),v&&(0,a.jsx)("div",{className:"modal-overlay",onClick:()=>!D&&b(!1),children:(0,a.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Upload Training File"}),(0,a.jsx)("button",{onClick:()=>!D&&b(!1),className:"btn-ghost btn-xs",children:(0,a.jsx)(m.Z,{size:14})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"File (JSONL)"}),(0,a.jsx)("input",{ref:X,type:"file",className:"input",accept:".jsonl,.json,.txt",onChange:e=>{var t;return J((null===(t=e.target.files)||void 0===t?void 0:t[0])||null)},disabled:D}),I&&(0,a.jsxs)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:["Selected: ",I.name," (",(I.size/1024).toFixed(1)," KB)"]})]}),H&&(0,a.jsx)("p",{className:"text-sm text-[var(--text-secondary)]",children:H}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:ee,disabled:!I||D,children:D?"Uploading...":"Upload"}),(0,a.jsx)("button",{className:"btn-ghost",onClick:()=>!D&&b(!1),disabled:D,children:"Cancel"})]})]})]})}),O&&(0,a.jsx)("div",{className:"toast",children:O})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return r},qz:function(){return s}});let a=n(257).env.NEXT_PUBLIC_API_BASE||"";function i(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function s(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function r(){return!!i()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",r=i(),d={"Content-Type":"application/json",...t.headers};if(r&&(d.Authorization="Bearer ".concat(r)),"GET"===n&&!r){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=o.get(e);if(n)return n}let u=(async()=>{let i=await fetch("".concat(a).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&r&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let l=await i.json();return"GET"!==n||r||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===n&&!r){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=a.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),a},getMe:()=>d("/api/auth/me"),logout:()=>{s(),c.clear(),window.location.href="/login"}},h=async e=>{let t=i(),n=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let s=await n.blob(),r=URL.createObjectURL(s),l=document.createElement("a");l.href=r,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(r)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3461)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/fine-tuning/page-ecbefa6299ef7516.js b/static/_next/static/chunks/app/fine-tuning/page-ecbefa6299ef7516.js deleted file mode 100644 index d15b88b71817d2cf79e79221a9dc6e2d5b81483c..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/fine-tuning/page-ecbefa6299ef7516.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8919],{3461:function(e,t,n){Promise.resolve().then(n.bind(n,3396))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var a=n(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var r={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,a.forwardRef)((e,t)=>{let{color:n="currentColor",size:i=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...r,width:i,height:i,stroke:n,strokeWidth:c?24*Number(l)/Number(i):l,className:s("lucide",o),...h},[...u.map(e=>{let[t,n]=e;return(0,a.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let n=(0,a.forwardRef)((n,r)=>{let{className:c,...o}=n;return(0,a.createElement)(l,{ref:r,iconNode:t,className:s("lucide-".concat(i(e)),c),...o})});return n.displayName="".concat(e),n}},4972:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]])},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},1671:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},9388:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},1723:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7689:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},2489:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},257:function(e,t,n){"use strict";var a,i;e.exports=(null==(a=n.g.process)?void 0:a.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,a,i=e.exports={};function s(){throw Error("setTimeout has not been defined")}function r(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:r}catch(e){n=r}}();var c=[],o=!1,d=-1;function u(){o&&a&&(o=!1,a.length?c=a.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(a=c,c=[];++d1)for(var n=1;n{r(!0),c(""),s.hi.get("/v1/fine_tuning/jobs").then(e=>t(e.data||[])).catch(e=>c(e instanceof Error?e.message:"Failed to load jobs")).finally(()=>r(!1))},$=()=>{s.hi.get("/v1/models").then(e=>{let t=e.data.map(e=>e.id).sort();k(t),t.length>0&&!C&&S(t[0])}).catch(()=>{})},Q=()=>{s.hi.get("/v1/files").then(e=>{T(e.data||[]),(e.data||[]).length>0&&E(e.data[0].id)}).catch(()=>{})};(0,i.useEffect)(()=>{K()},[]),(0,i.useEffect)(()=>{if(O){let e=setTimeout(()=>q(""),3e3);return()=>clearTimeout(e)}},[O]);let V=async()=>{if(C.trim()&&Z.trim()){P(!0);try{await s.hi.post("/v1/fine_tuning/jobs",{model:C,training_file:Z,hyperparameters:{n_epochs:z,batch_size:M,learning_rate_multiplier:L}}),j(!1),E(""),_(3),A(1),U(1),q("Fine-tuning job created"),K()}catch(e){q(e instanceof Error?e.message:"Failed to create job")}finally{P(!1)}}},Y=async e=>{if(confirm("Cancel this fine-tuning job? This action cannot be undone.")){R(e);try{await s.hi.post("/v1/fine_tuning/jobs/".concat(e,"/cancel"),{}),q("Job cancelled"),K()}catch(e){q(e instanceof Error?e.message:"Failed to cancel job")}finally{R(null)}}},ee=async()=>{if(I){G(!0),W("Uploading...");try{let e=await I.text(),t=localStorage.getItem("nexus_token"),n=await fetch("/v1/files",{method:"POST",headers:{"Content-Type":"application/json",...t?{Authorization:"Bearer ".concat(t)}:{}},body:JSON.stringify({file:e,purpose:"fine-tune"})});if(!n.ok){let e=await n.json().catch(()=>({detail:n.statusText}));throw Error(e.detail||"HTTP ".concat(n.status))}let a=await n.json();q("Uploaded: ".concat(a.filename||a.id||"file")),b(!1),J(null),X.current&&(X.current.value=""),Q()}catch(e){W(e instanceof Error?e.message:"Upload failed")}finally{G(!1)}}},et=e=>new Date(1e3*e).toLocaleString();return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"page-header",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"Fine-Tuning"}),(0,a.jsx)("p",{className:"page-sub",children:"Manage fine-tuning jobs"})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("button",{className:"btn-secondary",onClick:()=>b(!0),children:[(0,a.jsx)(d.Z,{size:16})," Upload File"]}),(0,a.jsxs)("button",{className:"btn-primary",onClick:()=>{$(),Q(),j(!0)},children:[(0,a.jsx)(u.Z,{size:16})," Create Job"]})]})]}),y&&(0,a.jsx)("div",{className:"modal-overlay",onClick:()=>j(!1),children:(0,a.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Create Fine-Tuning Job"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Model"}),(0,a.jsxs)("select",{className:"select",value:C,onChange:e=>S(e.target.value),children:[(0,a.jsx)("option",{value:"",children:"Select model"}),N.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Training File"}),(0,a.jsxs)("select",{className:"select",value:Z,onChange:e=>E(e.target.value),children:[(0,a.jsx)("option",{value:"",children:"Select file"}),w.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.filename," (",e.id,")"]},e.id))]}),0===w.length&&(0,a.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:'No files uploaded yet. Use "Upload File" first.'})]}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Epochs"}),(0,a.jsx)("input",{className:"input",type:"number",min:1,value:z,onChange:e=>_(Number(e.target.value))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Batch Size"}),(0,a.jsx)("input",{className:"input",type:"number",min:1,value:M,onChange:e=>A(Number(e.target.value))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Learning Rate"}),(0,a.jsx)("input",{className:"input",type:"number",step:"0.1",min:.1,value:L,onChange:e=>U(Number(e.target.value))})]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:V,disabled:F||!C||!Z,children:F?"Creating...":"Create"}),(0,a.jsx)("button",{className:"btn-ghost",onClick:()=>j(!1),children:"Cancel"})]})]})]})}),n?(0,a.jsx)("div",{className:"card",children:(0,a.jsx)("div",{className:"skeleton h-32 w-full"})}):l?(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,a.jsx)("p",{className:"text-red-400",children:l})]}):0===e.length?(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)(h.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,a.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No fine-tuning jobs yet."})]}):(0,a.jsx)("div",{className:"card p-0",children:(0,a.jsx)("div",{className:"table-wrap",children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"ID"}),(0,a.jsx)("th",{children:"Model"}),(0,a.jsx)("th",{children:"Status"}),(0,a.jsx)("th",{children:"Created"}),(0,a.jsx)("th",{children:"Trained Tokens"}),(0,a.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,a.jsx)("tbody",{children:e.map(e=>{var t;return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"font-mono text-xs",children:e.id}),(0,a.jsx)("td",{className:"font-medium",children:e.model}),(0,a.jsx)("td",{children:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 ".concat(x[e.status]||"badge-gray"),children:[p[e.status]||null,e.status]})}),(0,a.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:et(e.created_at)}),(0,a.jsx)("td",{children:(null===(t=e.trained_tokens)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,a.jsx)("td",{className:"text-right",children:g.includes(e.status)&&(0,a.jsx)("button",{onClick:()=>Y(e.id),disabled:B===e.id,className:"btn-danger btn-xs",title:"Cancel job",children:B===e.id?(0,a.jsx)("span",{className:"w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(f,{size:14})})})]},e.id)})})]})})}),v&&(0,a.jsx)("div",{className:"modal-overlay",onClick:()=>!D&&b(!1),children:(0,a.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Upload Training File"}),(0,a.jsx)("button",{onClick:()=>!D&&b(!1),className:"btn-ghost btn-xs",children:(0,a.jsx)(m.Z,{size:14})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"File (JSONL)"}),(0,a.jsx)("input",{ref:X,type:"file",className:"input",accept:".jsonl,.json,.txt",onChange:e=>{var t;return J((null===(t=e.target.files)||void 0===t?void 0:t[0])||null)},disabled:D}),I&&(0,a.jsxs)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:["Selected: ",I.name," (",(I.size/1024).toFixed(1)," KB)"]})]}),H&&(0,a.jsx)("p",{className:"text-sm text-[var(--text-secondary)]",children:H}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:ee,disabled:!I||D,children:D?"Uploading...":"Upload"}),(0,a.jsx)("button",{className:"btn-ghost",onClick:()=>!D&&b(!1),disabled:D,children:"Cancel"})]})]})]})}),O&&(0,a.jsx)("div",{className:"toast",children:O})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return r},qz:function(){return s}});let a=n(257).env.NEXT_PUBLIC_API_BASE||"";function i(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function r(){return!!i()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",r=i(),d={"Content-Type":"application/json",...t.headers};if(r&&(d.Authorization="Bearer ".concat(r)),"GET"===n&&!r){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=o.get(e);if(n)return n}let u=(async()=>{let i=await fetch("".concat(a).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&r&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let l=await i.json();return"GET"!==n||r||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===n&&!r){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=a.access_token,localStorage.setItem("nexus_token",n),a},getMe:()=>d("/api/auth/me"),logout:()=>{s(),c.clear(),window.location.href="/login"}},h=async e=>{let t=i(),n=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let s=await n.blob(),r=URL.createObjectURL(s),l=document.createElement("a");l.href=r,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(r)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3461)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/global-error-cbe2d3ac15285c84.js b/static/_next/static/chunks/app/global-error-cbe2d3ac15285c84.js deleted file mode 100644 index bdf41bc1af8a2d86df3664de54823043306cc01a..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/global-error-cbe2d3ac15285c84.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6470],{4855:function(e,r,n){Promise.resolve().then(n.bind(n,1667))},1667:function(e,r,n){"use strict";n.r(r),n.d(r,{default:function(){return t}});var i=n(7437);function t(e){let{error:r,reset:n}=e;return(0,i.jsxs)("html",{lang:"en",children:[(0,i.jsxs)("head",{children:[(0,i.jsx)("title",{children:"NexusAI Gateway — Error"}),(0,i.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1"}),(0,i.jsx)("style",{dangerouslySetInnerHTML:{__html:"html,body{margin:0;padding:0;background:#0a0a0a;color:#fff;font-family:Inter,system-ui,-apple-system,sans-serif;min-height:100vh}*{box-sizing:border-box}.err-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px}.err-card{max-width:480px;width:100%;background:#111;border:1px solid rgba(255,255,255,.07);border-radius:12px;padding:32px;text-align:center}.err-icon{width:48px;height:48px;margin:0 auto 16px;color:#ef4444}.err-title{font-size:20px;font-weight:600;margin:0 0 8px}.err-msg{color:#a1a1a1;font-size:14px;margin:0 0 8px;word-break:break-word}.err-digest{color:#6b6b6b;font-size:11px;font-family:ui-monospace,monospace;margin:0 0 24px}.err-btn{background:#f97316;color:#fff;border:none;padding:10px 20px;border-radius:8px;font-size:14px;font-weight:500;cursor:pointer;font-family:inherit}.err-btn:hover{background:#ea580c}.err-btn:active{background:#c2410c}"}})]}),(0,i.jsx)("body",{children:(0,i.jsx)("div",{className:"err-wrap",children:(0,i.jsxs)("div",{className:"err-card",children:[(0,i.jsxs)("svg",{className:"err-icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,i.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,i.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,i.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),(0,i.jsx)("h1",{className:"err-title",children:"Something went wrong"}),(0,i.jsx)("p",{className:"err-msg",children:(null==r?void 0:r.message)||"An unexpected error occurred"}),(null==r?void 0:r.digest)&&(0,i.jsxs)("p",{className:"err-digest",children:["Error ID: ",r.digest]}),(0,i.jsx)("button",{className:"err-btn",onClick:n,children:"Try again"})]})})})]})}n(2265)}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=4855)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/health/page-afe3b6f5c87fbc55.js b/static/_next/static/chunks/app/health/page-afe3b6f5c87fbc55.js deleted file mode 100644 index 36b63b4fbad39e31000c11341988c02db0d10ed8..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/health/page-afe3b6f5c87fbc55.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1613],{1697:function(e,t,r){Promise.resolve().then(r.bind(r,4523))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:r,strokeWidth:o?24*Number(c)/Number(a):c,className:s("lucide",l),...h},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:o,...l}=r;return(0,n.createElement)(c,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),o),...l})});return r.displayName="".concat(e),r}},4401:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},1671:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},9388:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},8997:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]])},7168:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},6865:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var o=[],l=!1,u=-1;function d(){l&&n&&(l=!1,n.length?o=n.concat(o):u=-1,o.length&&h())}function h(){if(!l){var e=c(d);l=!0;for(var t=o.length;t;){for(n=o,o=[];++u1)for(var r=1;r{try{let e=await s.hi.get("/api/health-check");t(e),v("")}catch(e){v(e instanceof Error?e.message:"Failed to fetch health status")}finally{h(!1)}},[]);(0,a.useEffect)(()=>{k()},[k]),(0,a.useEffect)(()=>{if(!y)return;let e=setInterval(k,15e3);return()=>clearInterval(e)},[y,k]);let b=async()=>{p(!0),v("");try{let e=await s.hi.post("/api/health-check");t(e)}catch(e){v(e instanceof Error?e.message:"Check all failed")}finally{p(!1)}},j=async e=>{x(e),v("");try{let r=await s.hi.post("/api/health-check/".concat(e));t(t=>t.map(t=>t.provider===e?r:t))}catch(t){v(t instanceof Error?t.message:"Check failed for ".concat(e))}finally{x(null)}},N=e=>{switch(e){case"ok":return(0,n.jsx)(i.Z,{size:16,className:"text-green-400"});case"timeout":return(0,n.jsx)(c.Z,{size:16,className:"text-yellow-400"});default:return(0,n.jsx)(o.Z,{size:16,className:"text-red-400"})}},T=e=>{switch(e){case"ok":return(0,n.jsx)("span",{className:"badge badge-green",children:e});case"timeout":return(0,n.jsx)("span",{className:"badge badge-yellow",children:e});default:return(0,n.jsx)("span",{className:"badge badge-red",children:e})}};return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Health Check"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider connectivity testing"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("label",{className:"flex items-center gap-2 text-sm text-[var(--text-secondary)] cursor-pointer",children:[(0,n.jsx)("input",{type:"checkbox",checked:y,onChange:e=>w(e.target.checked),className:"accent-[var(--blue)]"}),"Auto-refresh"]}),(0,n.jsxs)("button",{className:"btn-primary",onClick:b,disabled:f,children:[f?(0,n.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,n.jsx)(l.Z,{size:16}),"Check All"]})]})]}),g&&(0,n.jsx)("div",{className:"card mb-4 border border-red-500/30 bg-red-500/5",children:(0,n.jsxs)("p",{className:"text-sm text-red-400 flex items-center gap-2",children:[(0,n.jsx)(o.Z,{size:14}),g]})}),r?(0,n.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:Array.from({length:6}).map((e,t)=>(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})},t))}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(u.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No health data yet. Run a check to see provider status."})]}):(0,n.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:e.map(e=>(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[N(e.status),(0,n.jsx)("span",{className:"font-semibold capitalize",children:e.provider})]}),T(e.status)]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-xs mb-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Latency"}),(0,n.jsx)("p",{className:"font-medium mt-0.5",children:null!==e.latency_ms?"".concat(e.latency_ms,"ms"):"N/A"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Last Checked"}),(0,n.jsx)("p",{className:"font-medium mt-0.5",children:e.last_checked?new Date(e.last_checked).toLocaleString():"N/A"})]})]}),e.error_message&&(0,n.jsx)("p",{className:"text-xs text-red-400 mb-3 p-2 bg-red-500/10 rounded",children:e.error_message}),(0,n.jsxs)("button",{className:"btn-secondary w-full justify-center text-xs py-1.5",onClick:()=>j(e.provider),disabled:m===e.provider,children:[m===e.provider?(0,n.jsx)("span",{className:"w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,n.jsx)(d.Z,{size:12}),"Check Provider"]})]},e.provider))})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=a(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=l.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let c=await a.json();return"GET"!==r||i||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===r&&!i){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{s(),o.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let s=await r.blob(),i=URL.createObjectURL(s),c=document.createElement("a");c.href=i,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1697)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/health/page-0076cc8e10197b14.js b/static/_next/static/chunks/app/health/page-f9a55c9d3c1965a7.js similarity index 58% rename from static/_next/static/chunks/app/health/page-0076cc8e10197b14.js rename to static/_next/static/chunks/app/health/page-f9a55c9d3c1965a7.js index 36b63b4fbad39e31000c11341988c02db0d10ed8..948938a5c826f412175257b4fdf413bdfa92b8c4 100644 --- a/static/_next/static/chunks/app/health/page-0076cc8e10197b14.js +++ b/static/_next/static/chunks/app/health/page-f9a55c9d3c1965a7.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1613],{1697:function(e,t,r){Promise.resolve().then(r.bind(r,4523))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:r,strokeWidth:o?24*Number(c)/Number(a):c,className:s("lucide",l),...h},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:o,...l}=r;return(0,n.createElement)(c,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),o),...l})});return r.displayName="".concat(e),r}},4401:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},1671:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},9388:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},8997:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]])},7168:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},6865:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var o=[],l=!1,u=-1;function d(){l&&n&&(l=!1,n.length?o=n.concat(o):u=-1,o.length&&h())}function h(){if(!l){var e=c(d);l=!0;for(var t=o.length;t;){for(n=o,o=[];++u1)for(var r=1;r{try{let e=await s.hi.get("/api/health-check");t(e),v("")}catch(e){v(e instanceof Error?e.message:"Failed to fetch health status")}finally{h(!1)}},[]);(0,a.useEffect)(()=>{k()},[k]),(0,a.useEffect)(()=>{if(!y)return;let e=setInterval(k,15e3);return()=>clearInterval(e)},[y,k]);let b=async()=>{p(!0),v("");try{let e=await s.hi.post("/api/health-check");t(e)}catch(e){v(e instanceof Error?e.message:"Check all failed")}finally{p(!1)}},j=async e=>{x(e),v("");try{let r=await s.hi.post("/api/health-check/".concat(e));t(t=>t.map(t=>t.provider===e?r:t))}catch(t){v(t instanceof Error?t.message:"Check failed for ".concat(e))}finally{x(null)}},N=e=>{switch(e){case"ok":return(0,n.jsx)(i.Z,{size:16,className:"text-green-400"});case"timeout":return(0,n.jsx)(c.Z,{size:16,className:"text-yellow-400"});default:return(0,n.jsx)(o.Z,{size:16,className:"text-red-400"})}},T=e=>{switch(e){case"ok":return(0,n.jsx)("span",{className:"badge badge-green",children:e});case"timeout":return(0,n.jsx)("span",{className:"badge badge-yellow",children:e});default:return(0,n.jsx)("span",{className:"badge badge-red",children:e})}};return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Health Check"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider connectivity testing"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("label",{className:"flex items-center gap-2 text-sm text-[var(--text-secondary)] cursor-pointer",children:[(0,n.jsx)("input",{type:"checkbox",checked:y,onChange:e=>w(e.target.checked),className:"accent-[var(--blue)]"}),"Auto-refresh"]}),(0,n.jsxs)("button",{className:"btn-primary",onClick:b,disabled:f,children:[f?(0,n.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,n.jsx)(l.Z,{size:16}),"Check All"]})]})]}),g&&(0,n.jsx)("div",{className:"card mb-4 border border-red-500/30 bg-red-500/5",children:(0,n.jsxs)("p",{className:"text-sm text-red-400 flex items-center gap-2",children:[(0,n.jsx)(o.Z,{size:14}),g]})}),r?(0,n.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:Array.from({length:6}).map((e,t)=>(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})},t))}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(u.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No health data yet. Run a check to see provider status."})]}):(0,n.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:e.map(e=>(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[N(e.status),(0,n.jsx)("span",{className:"font-semibold capitalize",children:e.provider})]}),T(e.status)]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-xs mb-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Latency"}),(0,n.jsx)("p",{className:"font-medium mt-0.5",children:null!==e.latency_ms?"".concat(e.latency_ms,"ms"):"N/A"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Last Checked"}),(0,n.jsx)("p",{className:"font-medium mt-0.5",children:e.last_checked?new Date(e.last_checked).toLocaleString():"N/A"})]})]}),e.error_message&&(0,n.jsx)("p",{className:"text-xs text-red-400 mb-3 p-2 bg-red-500/10 rounded",children:e.error_message}),(0,n.jsxs)("button",{className:"btn-secondary w-full justify-center text-xs py-1.5",onClick:()=>j(e.provider),disabled:m===e.provider,children:[m===e.provider?(0,n.jsx)("span",{className:"w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,n.jsx)(d.Z,{size:12}),"Check Provider"]})]},e.provider))})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=a(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=l.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let c=await a.json();return"GET"!==r||i||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===r&&!i){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{s(),o.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let s=await r.blob(),i=URL.createObjectURL(s),c=document.createElement("a");c.href=i,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1697)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1613],{1697:function(e,t,r){Promise.resolve().then(r.bind(r,4523))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...c,width:a,height:a,stroke:r,strokeWidth:o?24*Number(i)/Number(a):i,className:s("lucide",l),...h},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let r=(0,n.forwardRef)((r,c)=>{let{className:o,...l}=r;return(0,n.createElement)(i,{ref:c,iconNode:t,className:s("lucide-".concat(a(e)),o),...l})});return r.displayName="".concat(e),r}},4401:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},1671:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},9388:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},8997:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]])},7168:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},6865:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function c(){throw Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:c}catch(e){r=c}}();var o=[],l=!1,u=-1;function d(){l&&n&&(l=!1,n.length?o=n.concat(o):u=-1,o.length&&h())}function h(){if(!l){var e=i(d);l=!0;for(var t=o.length;t;){for(n=o,o=[];++u1)for(var r=1;r{try{let e=await s.hi.get("/api/health-check");t(e),y("")}catch(e){y(e instanceof Error?e.message:"Failed to fetch health status")}finally{h(!1)}},[]);(0,a.useEffect)(()=>{w()},[w]),(0,a.useEffect)(()=>{if(!v)return;let e=setInterval(w,15e3);return()=>clearInterval(e)},[v,w]);let b=async()=>{m(!0),y("");try{let e=await s.hi.post("/api/health-check");t(e)}catch(e){y(e instanceof Error?e.message:"Check all failed")}finally{m(!1)}},j=async e=>{x(e),y("");try{let r=await s.hi.post("/api/health-check/".concat(e));t(t=>t.map(t=>t.provider===e?r:t))}catch(t){y(t instanceof Error?t.message:"Check failed for ".concat(e))}finally{x(null)}},N=e=>{switch(e){case"ok":return(0,n.jsx)(c.Z,{size:16,className:"text-green-400"});case"timeout":return(0,n.jsx)(i.Z,{size:16,className:"text-yellow-400"});default:return(0,n.jsx)(o.Z,{size:16,className:"text-red-400"})}},T=e=>{switch(e){case"ok":return(0,n.jsx)("span",{className:"badge badge-green",children:e});case"timeout":return(0,n.jsx)("span",{className:"badge badge-yellow",children:e});default:return(0,n.jsx)("span",{className:"badge badge-red",children:e})}};return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Health Check"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider connectivity testing"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("label",{className:"flex items-center gap-2 text-sm text-[var(--text-secondary)] cursor-pointer",children:[(0,n.jsx)("input",{type:"checkbox",checked:v,onChange:e=>k(e.target.checked),className:"accent-[var(--blue)]"}),"Auto-refresh"]}),(0,n.jsxs)("button",{className:"btn-primary",onClick:b,disabled:f,children:[f?(0,n.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,n.jsx)(l.Z,{size:16}),"Check All"]})]})]}),g&&(0,n.jsx)("div",{className:"card mb-4 border border-red-500/30 bg-red-500/5",children:(0,n.jsxs)("p",{className:"text-sm text-red-400 flex items-center gap-2",children:[(0,n.jsx)(o.Z,{size:14}),g]})}),r?(0,n.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:Array.from({length:6}).map((e,t)=>(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})},t))}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(u.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No health data yet. Run a check to see provider status."})]}):(0,n.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:e.map(e=>(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[N(e.status),(0,n.jsx)("span",{className:"font-semibold capitalize",children:e.provider})]}),T(e.status)]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-xs mb-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Latency"}),(0,n.jsx)("p",{className:"font-medium mt-0.5",children:null!==e.latency_ms?"".concat(e.latency_ms,"ms"):"N/A"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Last Checked"}),(0,n.jsx)("p",{className:"font-medium mt-0.5",children:e.last_checked?new Date(e.last_checked).toLocaleString():"N/A"})]})]}),e.error_message&&(0,n.jsx)("p",{className:"text-xs text-red-400 mb-3 p-2 bg-red-500/10 rounded",children:e.error_message}),(0,n.jsxs)("button",{className:"btn-secondary w-full justify-center text-xs py-1.5",onClick:()=>j(e.provider),disabled:p===e.provider,children:[p===e.provider?(0,n.jsx)("span",{className:"w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,n.jsx)(d.Z,{size:12}),"Check Provider"]})]},e.provider))})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return c},qz:function(){return s}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function s(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function c(){return!!a()}let i={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",c=a(),u={"Content-Type":"application/json",...t.headers};if(c&&(u.Authorization="Bearer ".concat(c)),"GET"===r&&!c){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in i)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return i[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=l.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&c&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let i=await a.json();return"GET"!==r||c||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,i),i})();if("GET"===r&&!c){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),function(e,t,r){try{let r="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(r)}catch(e){}}("nexus_token",r,0),n},getMe:()=>u("/api/auth/me"),logout:()=>{s(),o.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let s=await r.blob(),c=URL.createObjectURL(s),i=document.createElement("a");i.href=c,i.download=e.split("/").pop()||"export.csv",i.click(),URL.revokeObjectURL(c)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1697)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/injection-logs/page-2706b6e7f373b605.js b/static/_next/static/chunks/app/injection-logs/page-6711c383734d1328.js similarity index 50% rename from static/_next/static/chunks/app/injection-logs/page-2706b6e7f373b605.js rename to static/_next/static/chunks/app/injection-logs/page-6711c383734d1328.js index c461715ba1010bf699f7e84bf5fd35d6ec4088ce..aa079a995bda3362d7461281a75cfb76ceec2153 100644 --- a/static/_next/static/chunks/app/injection-logs/page-2706b6e7f373b605.js +++ b/static/_next/static/chunks/app/injection-logs/page-6711c383734d1328.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9762],{3591:function(e,t,n){Promise.resolve().then(n.bind(n,6778))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...o,width:i,height:i,stroke:n,strokeWidth:c?24*Number(s)/Number(i):s,className:a("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,o)=>{let{className:c,...l}=n;return(0,r.createElement)(s,{ref:o,iconNode:t,className:a("lucide-".concat(i(e)),c),...l})});return n.displayName="".concat(e),n}},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},8906:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},6865:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},257:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function a(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var c=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?c=r.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=s(d);l=!0;for(var t=c.length;t;){for(r=c,c=[];++u1)for(var n=1;n{l(!0),a.hi.get("/api/injection-logs").then(t).catch(e=>d(e instanceof Error?e.message:"Failed to load injection logs")).finally(()=>l(!1))},[]),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"page-header",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Injection Logs"}),(0,r.jsx)("p",{className:"page-sub",children:"Detected prompt injection attempts"})]})}),u?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:u})]}):n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-48 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(s.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No injection attempts detected."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"ID"}),(0,r.jsx)("th",{children:"Request ID"}),(0,r.jsx)("th",{children:"IP Address"}),(0,r.jsx)("th",{children:"Score"}),(0,r.jsx)("th",{children:"Pattern"}),(0,r.jsx)("th",{children:"Action"}),(0,r.jsx)("th",{children:"Prompt Snippet"}),(0,r.jsx)("th",{children:"Timestamp"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"text-xs font-mono",children:e.id}),(0,r.jsx)("td",{className:"text-xs font-mono max-w-[120px] truncate",title:e.request_id,children:e.request_id}),(0,r.jsx)("td",{className:"text-xs font-mono",children:e.ip_address}),(0,r.jsx)("td",{className:"text-xs font-mono",children:e.score}),(0,r.jsx)("td",{className:"text-xs max-w-[140px] truncate",title:e.pattern_matched,children:e.pattern_matched}),(0,r.jsx)("td",{children:"block"===e.action?(0,r.jsxs)("span",{className:"badge-red",children:[(0,r.jsx)(c.Z,{size:12})," Block"]}):(0,r.jsxs)("span",{className:"badge-yellow",children:[(0,r.jsx)(c.Z,{size:12})," Flag"]})}),(0,r.jsx)("td",{className:"text-xs max-w-[200px] truncate",title:e.prompt_snippet,children:e.prompt_snippet}),(0,r.jsx)("td",{className:"text-xs text-[var(--text-tertiary)] whitespace-nowrap",children:e.timestamp})]},e.id))})]})})})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return o},qz:function(){return a}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function i(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function o(){return!!i()}let s={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",o=i(),u={"Content-Type":"application/json",...t.headers};if(o&&(u.Authorization="Bearer ".concat(o)),"GET"===n&&!o){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in s)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return s[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let i=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&o&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let s=await i.json();return"GET"!==n||o||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,s),s})();if("GET"===n&&!o){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>u("/api/auth/me"),logout:()=>{a(),c.clear(),window.location.href="/login"}},h=async e=>{let t=i(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let a=await n.blob(),o=URL.createObjectURL(a),s=document.createElement("a");s.href=o,s.download=e.split("/").pop()||"export.csv",s.click(),URL.revokeObjectURL(o)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3591)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9762],{3591:function(e,t,n){Promise.resolve().then(n.bind(n,6778))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),o=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:i=24,strokeWidth:c=2,absoluteStrokeWidth:s,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...a,width:i,height:i,stroke:n,strokeWidth:s?24*Number(c)/Number(i):c,className:o("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),s=(e,t)=>{let n=(0,r.forwardRef)((n,a)=>{let{className:s,...l}=n;return(0,r.createElement)(c,{ref:a,iconNode:t,className:o("lucide-".concat(i(e)),s),...l})});return n.displayName="".concat(e),n}},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},8906:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},6865:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},257:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function o(){throw Error("setTimeout has not been defined")}function a(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var s=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?s=r.concat(s):u=-1,s.length&&h())}function h(){if(!l){var e=c(d);l=!0;for(var t=s.length;t;){for(r=s,s=[];++u1)for(var n=1;n{l(!0),o.hi.get("/api/injection-logs").then(t).catch(e=>d(e instanceof Error?e.message:"Failed to load injection logs")).finally(()=>l(!1))},[]),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"page-header",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Injection Logs"}),(0,r.jsx)("p",{className:"page-sub",children:"Detected prompt injection attempts"})]})}),u?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(a.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:u})]}):n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-48 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No injection attempts detected."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"ID"}),(0,r.jsx)("th",{children:"Request ID"}),(0,r.jsx)("th",{children:"IP Address"}),(0,r.jsx)("th",{children:"Score"}),(0,r.jsx)("th",{children:"Pattern"}),(0,r.jsx)("th",{children:"Action"}),(0,r.jsx)("th",{children:"Prompt Snippet"}),(0,r.jsx)("th",{children:"Timestamp"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"text-xs font-mono",children:e.id}),(0,r.jsx)("td",{className:"text-xs font-mono max-w-[120px] truncate",title:e.request_id,children:e.request_id}),(0,r.jsx)("td",{className:"text-xs font-mono",children:e.ip_address}),(0,r.jsx)("td",{className:"text-xs font-mono",children:e.score}),(0,r.jsx)("td",{className:"text-xs max-w-[140px] truncate",title:e.pattern_matched,children:e.pattern_matched}),(0,r.jsx)("td",{children:"block"===e.action?(0,r.jsxs)("span",{className:"badge-red",children:[(0,r.jsx)(s.Z,{size:12})," Block"]}):(0,r.jsxs)("span",{className:"badge-yellow",children:[(0,r.jsx)(s.Z,{size:12})," Flag"]})}),(0,r.jsx)("td",{className:"text-xs max-w-[200px] truncate",title:e.prompt_snippet,children:e.prompt_snippet}),(0,r.jsx)("td",{className:"text-xs text-[var(--text-tertiary)] whitespace-nowrap",children:e.timestamp})]},e.id))})]})})})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return a},qz:function(){return o}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function i(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function o(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function a(){return!!i()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},s=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",a=i(),u={"Content-Type":"application/json",...t.headers};if(a&&(u.Authorization="Bearer ".concat(a)),"GET"===n&&!a){let t=function(e){let t=s.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){s.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let i=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&a&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw o(),s.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let c=await i.json();return"GET"!==n||a||function(e,t){if(s.size>=200){let e=s.keys().next().value;void 0!==e&&s.delete(e)}s.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===n&&!a){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>u("/api/auth/me"),logout:()=>{o(),s.clear(),window.location.href="/login"}},h=async e=>{let t=i(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let o=await n.blob(),a=URL.createObjectURL(o),c=document.createElement("a");c.href=a,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(a)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3591)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/injection-logs/page-b193e7a680e58364.js b/static/_next/static/chunks/app/injection-logs/page-b193e7a680e58364.js deleted file mode 100644 index c461715ba1010bf699f7e84bf5fd35d6ec4088ce..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/injection-logs/page-b193e7a680e58364.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9762],{3591:function(e,t,n){Promise.resolve().then(n.bind(n,6778))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...o,width:i,height:i,stroke:n,strokeWidth:c?24*Number(s)/Number(i):s,className:a("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,o)=>{let{className:c,...l}=n;return(0,r.createElement)(s,{ref:o,iconNode:t,className:a("lucide-".concat(i(e)),c),...l})});return n.displayName="".concat(e),n}},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},8906:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},6865:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},257:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function a(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var c=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?c=r.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=s(d);l=!0;for(var t=c.length;t;){for(r=c,c=[];++u1)for(var n=1;n{l(!0),a.hi.get("/api/injection-logs").then(t).catch(e=>d(e instanceof Error?e.message:"Failed to load injection logs")).finally(()=>l(!1))},[]),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"page-header",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Injection Logs"}),(0,r.jsx)("p",{className:"page-sub",children:"Detected prompt injection attempts"})]})}),u?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:u})]}):n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-48 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(s.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No injection attempts detected."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"ID"}),(0,r.jsx)("th",{children:"Request ID"}),(0,r.jsx)("th",{children:"IP Address"}),(0,r.jsx)("th",{children:"Score"}),(0,r.jsx)("th",{children:"Pattern"}),(0,r.jsx)("th",{children:"Action"}),(0,r.jsx)("th",{children:"Prompt Snippet"}),(0,r.jsx)("th",{children:"Timestamp"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"text-xs font-mono",children:e.id}),(0,r.jsx)("td",{className:"text-xs font-mono max-w-[120px] truncate",title:e.request_id,children:e.request_id}),(0,r.jsx)("td",{className:"text-xs font-mono",children:e.ip_address}),(0,r.jsx)("td",{className:"text-xs font-mono",children:e.score}),(0,r.jsx)("td",{className:"text-xs max-w-[140px] truncate",title:e.pattern_matched,children:e.pattern_matched}),(0,r.jsx)("td",{children:"block"===e.action?(0,r.jsxs)("span",{className:"badge-red",children:[(0,r.jsx)(c.Z,{size:12})," Block"]}):(0,r.jsxs)("span",{className:"badge-yellow",children:[(0,r.jsx)(c.Z,{size:12})," Flag"]})}),(0,r.jsx)("td",{className:"text-xs max-w-[200px] truncate",title:e.prompt_snippet,children:e.prompt_snippet}),(0,r.jsx)("td",{className:"text-xs text-[var(--text-tertiary)] whitespace-nowrap",children:e.timestamp})]},e.id))})]})})})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return o},qz:function(){return a}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function i(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function o(){return!!i()}let s={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",o=i(),u={"Content-Type":"application/json",...t.headers};if(o&&(u.Authorization="Bearer ".concat(o)),"GET"===n&&!o){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in s)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return s[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let i=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&o&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let s=await i.json();return"GET"!==n||o||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,s),s})();if("GET"===n&&!o){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>u("/api/auth/me"),logout:()=>{a(),c.clear(),window.location.href="/login"}},h=async e=>{let t=i(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let a=await n.blob(),o=URL.createObjectURL(a),s=document.createElement("a");s.href=o,s.download=e.split("/").pop()||"export.csv",s.click(),URL.revokeObjectURL(o)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3591)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/integration/page-a8b3d4504bd03aa7.js b/static/_next/static/chunks/app/integration/page-a8b3d4504bd03aa7.js deleted file mode 100644 index d11499e2ede629c72a5bdc17458706253bb0254d..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/integration/page-a8b3d4504bd03aa7.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9656],{586:function(e,t,n){Promise.resolve().then(n.bind(n,1014))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var s=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,s.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:i="",children:d,iconNode:m,...p}=e;return(0,s.createElement)("svg",{ref:t,...l,width:a,height:a,stroke:n,strokeWidth:c?24*Number(o)/Number(a):o,className:r("lucide",i),...p},[...m.map(e=>{let[t,n]=e;return(0,s.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let n=(0,s.forwardRef)((n,l)=>{let{className:c,...i}=n;return(0,s.createElement)(o,{ref:l,iconNode:t,className:r("lucide-".concat(a(e)),c),...i})});return n.displayName="".concat(e),n}},401:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});let s=(0,n(9205).Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},8867:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});let s=(0,n(9205).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},4001:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});let s=(0,n(9205).Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},4743:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});let s=(0,n(9205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},1014:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return u}});var s=n(7437),a=n(2265),r=n(4001),l=n(9205);let o=(0,l.Z)("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);var c=n(401);let i=(0,l.Z)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),d=(0,l.Z)("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);var m=n(4743),p=n(8867);let h=[{label:"Chat Completions",path:"/v1/chat/completions",method:"POST",body:JSON.stringify({model:"gpt-4o",messages:[{role:"user",content:"Hello"}],max_tokens:100},null,2)},{label:"Anthropic Messages",path:"/v1/messages",method:"POST",body:JSON.stringify({model:"claude-sonnet-4-6",max_tokens:256,messages:[{role:"user",content:"Hello"}]},null,2)},{label:"Embeddings",path:"/v1/embeddings",method:"POST",body:JSON.stringify({model:"text-embedding-3-small",input:"Hello world",provider:"openai"},null,2)},{label:"List Models",path:"/v1/models",method:"GET",body:""}],x={python:[{label:"OpenAI Python Client",code:'from openai import OpenAI\n\nclient = OpenAI(\n base_url="https://nexus.example.com/v1",\n api_key="nxs-..."\n)\n\nresponse = client.chat.completions.create(\n model="gpt-4o",\n messages=[{"role": "user", "content": "Hello"}]\n)\nprint(response.choices[0].message.content)'},{label:"Anthropic Python Client",code:'import anthropic\n\nclient = anthropic.Anthropic(\n base_url="https://nexus.example.com/",\n api_key="nxs-..."\n)\n\nresponse = client.messages.create(\n model="claude-sonnet-4-6",\n max_tokens=256,\n messages=[{"role": "user", "content": "Hello"}]\n)\nprint(response.content[0].text)'}],curl:[{label:"Chat Completions (cURL)",code:'curl https://nexus.example.com/v1/chat/completions \\\n -H "Content-Type: application/json" \\\n -H "Authorization: Bearer nxs-..." \\\n -d \'{\n "model": "gpt-4o",\n "messages": [{"role": "user", "content": "Hello"}],\n "max_tokens": 256\n }\''},{label:"Anthropic Format (cURL)",code:'curl https://nexus.example.com/v1/messages \\\n -H "Content-Type: application/json" \\\n -H "Authorization: Bearer nxs-..." \\\n -d \'{\n "model": "claude-sonnet-4-6",\n "max_tokens": 256,\n "messages": [{"role": "user", "content": "Hello"}]\n }\''}],javascript:[{label:"OpenAI JS Client",code:'import OpenAI from \'openai\';\n\nconst client = new OpenAI({\n baseURL: "https://nexus.example.com/v1",\n apiKey: "nxs-..."\n});\n\nconst response = await client.chat.completions.create({\n model: "gpt-4o",\n messages: [{ role: "user", content: "Hello" }]\n});\nconsole.log(response.choices[0].message.content);'},{label:"Fetch API",code:'const response = await fetch("https://nexus.example.com/v1/chat/completions", {\n method: "POST",\n headers: {\n "Content-Type": "application/json",\n "Authorization": "Bearer nxs-..."\n },\n body: JSON.stringify({\n model: "gpt-4o",\n messages: [{ role: "user", content: "Hello" }]\n })\n});\nconst data = await response.json();\nconsole.log(data.choices[0].message.content);'}],go:[{label:"Go with net/http",code:'package main\n\nimport (\n "bytes"\n "encoding/json"\n "fmt"\n "net/http"\n)\n\nfunc main() {\n body := map[string]interface{}{\n "model": "gpt-4o",\n "messages": []map[string]string{\n {"role": "user", "content": "Hello"},\n },\n }\n b, _ := json.Marshal(body)\n req, _ := http.NewRequest("POST",\n "https://nexus.example.com/v1/chat/completions",\n bytes.NewReader(b))\n req.Header.Set("Content-Type", "application/json")\n req.Header.Set("Authorization", "Bearer nxs-...")\n\n resp, _ := http.DefaultClient.Do(req)\n var result map[string]interface{}\n json.NewDecoder(resp.Body).Decode(&result)\n fmt.Println(result)\n}'}]};function u(){let[e,t]=(0,a.useState)("python"),[n,l]=(0,a.useState)(null),[u,g]=(0,a.useState)(h[0]),[b,y]=(0,a.useState)(h[0].body),[j,f]=(0,a.useState)(""),[v,N]=(0,a.useState)(!1),[k,w]=(0,a.useState)(!1),[C,S]=(0,a.useState)("https://nexus.example.com"),[A,O]=(0,a.useState)("nxs-..."),[z,Z]=(0,a.useState)("idle"),_=async(e,t)=>{await navigator.clipboard.writeText(t),l(e),setTimeout(()=>l(null),2e3)},H=async()=>{N(!0),f(""),w(!1);try{let e=C.replace(/\/+$/,"")+u.path,t={method:u.method,headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(A)}};"POST"===u.method&&b.trim()&&(t.body=b);let n=await fetch(e,t),s=await n.text();try{let e=JSON.parse(s);f(JSON.stringify(e,null,2))}catch(e){f(s)}w(!n.ok)}catch(e){w(!0),f(String(e))}finally{N(!1)}},T=async()=>{Z("checking");try{let e=C.replace(/\/+$/,"")+"/v1/models",t=await fetch(e,{headers:{Authorization:"Bearer ".concat(A)}});Z(t.ok?"ok":"error")}catch(e){Z("error")}},P=x[e]||[];return(0,s.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,s.jsx)("div",{className:"page-header",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"page-title",children:"Integration"}),(0,s.jsx)("p",{className:"page-sub",children:"Connect to the proxy and test API endpoints"})]})}),(0,s.jsxs)("div",{className:"card",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,s.jsx)(r.Z,{size:18}),(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Connection Details"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Base URL"}),(0,s.jsxs)("div",{className:"input flex items-center gap-2",children:[(0,s.jsx)(o,{size:14,className:"text-[var(--text-tertiary)] shrink-0"}),(0,s.jsx)("input",{className:"bg-transparent border-none outline-none flex-1 text-sm",value:C,onChange:e=>S(e.target.value)})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"API Key"}),(0,s.jsx)("input",{className:"input",value:A,onChange:e=>O(e.target.value)})]})]}),(0,s.jsx)("div",{className:"flex items-center gap-3",children:(0,s.jsx)("button",{className:"btn-secondary btn-sm",onClick:T,disabled:"checking"===z,children:"checking"===z?(0,s.jsx)("span",{className:"w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):"ok"===z?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.Z,{size:14,className:"text-green-400"})," Connected"]}):"error"===z?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i,{size:14})," Connection Failed"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i,{size:14})," Test Connection"]})})})]}),(0,s.jsxs)("div",{className:"card",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,s.jsx)(d,{size:18}),(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"API Explorer"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Endpoint"}),(0,s.jsx)("select",{className:"select mb-3",onChange:e=>{let t=h[parseInt(e.target.value)];g(t),y(t.body),f(""),w(!1)},children:h.map((e,t)=>(0,s.jsxs)("option",{value:t,children:[e.method," ",e.path]},e.path))}),"POST"===u.method&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("label",{className:"label",children:"Request Body (JSON)"}),(0,s.jsx)("textarea",{className:"input font-mono text-xs !min-h-[200px]",rows:8,value:b,onChange:e=>y(e.target.value)})]}),(0,s.jsxs)("button",{className:"btn-primary w-full justify-center mt-3",onClick:H,disabled:v,children:[v?(0,s.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,s.jsx)(m.Z,{size:16}),v?" Sending...":" Send ".concat(u.method," Request")]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Response"}),(0,s.jsx)("pre",{className:"bg-[var(--surface-100)] rounded-lg p-4 overflow-x-auto text-xs font-mono leading-relaxed min-h-[200px] max-h-[400px] overflow-y-auto ".concat(k?"text-red-400":"text-[var(--text-secondary)]"),children:(0,s.jsx)("code",{children:j||"Send a request to see the response"})})]})]})]}),(0,s.jsxs)("div",{className:"card",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,s.jsx)(d,{size:18}),(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Code Examples"})]}),(0,s.jsx)("div",{className:"flex gap-1 border-b border-[var(--border)] mb-4 overflow-x-auto",children:Object.keys(x).map(n=>(0,s.jsx)("button",{className:"px-4 py-2 text-sm font-medium border-b-2 transition-colors whitespace-nowrap ".concat(e===n?"border-[var(--accent)] text-[var(--accent)]":"border-transparent text-[var(--text-tertiary)] hover:text-[var(--text-secondary)]"),onClick:()=>t(n),children:"javascript"===n?"JavaScript":"curl"===n?"cURL":n.charAt(0).toUpperCase()+n.slice(1)},n))}),0===P.length?(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)(d,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,s.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No snippets available for this language."})]}):P.map(e=>(0,s.jsxs)("div",{className:"mb-4 last:mb-0",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("h3",{className:"text-sm font-medium",children:e.label}),(0,s.jsxs)("button",{className:"btn-ghost btn-xs",onClick:()=>_(e.label,e.code),children:[n===e.label?(0,s.jsx)(c.Z,{size:14,className:"text-green-400"}):(0,s.jsx)(p.Z,{size:14}),n===e.label?" Copied":" Copy"]})]}),(0,s.jsx)("pre",{className:"bg-[var(--surface-100)] rounded-lg p-4 overflow-x-auto text-sm font-mono leading-relaxed",children:(0,s.jsx)("code",{children:e.code})})]},e.label))]})]})}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=586)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/keys/page-93b85b54a035bc7a.js b/static/_next/static/chunks/app/keys/page-93b85b54a035bc7a.js deleted file mode 100644 index 1d996e2396aa2ea8870c6514df0ee87b81a23deb..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/keys/page-93b85b54a035bc7a.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[23],{8670:function(e,t,n){Promise.resolve().then(n.bind(n,8001))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:i=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:o="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...a,width:i,height:i,stroke:n,strokeWidth:l?24*Number(c)/Number(i):c,className:s("lucide",o),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),l=(e,t)=>{let n=(0,r.forwardRef)((n,a)=>{let{className:l,...o}=n;return(0,r.createElement)(c,{ref:a,iconNode:t,className:s("lucide-".concat(i(e)),l),...o})});return n.displayName="".concat(e),n}},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},8867:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},4001:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function s(){throw Error("setTimeout has not been defined")}function a(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var l=[],o=!1,u=-1;function d(){o&&r&&(o=!1,r.length?l=r.concat(l):u=-1,l.length&&h())}function h(){if(!o){var e=c(d);o=!0;for(var t=l.length;t;){for(r=l,l=[];++u1)for(var n=1;n{d(!0),s.hi.get("/api/hub-keys").then(t).catch(e=>x(e instanceof Error?e.message:"Failed to load keys")).finally(()=>d(!1))};(0,i.useEffect)(()=>{C()},[]);let E=async()=>{if(p.trim())try{let e=await s.hi.post("/api/hub-keys",{name:p,rate_limit:v,spend_limit:g});w(e.raw_key),y(""),C()}catch(e){T(e instanceof Error?e.message:"Failed to create key")}},_=async e=>{confirm("Delete this key?")&&(await s.hi.delete("/api/hub-keys/".concat(e)),C(),T("Key deleted"))},S=async e=>{await s.hi.patch("/api/hub-keys/".concat(e,"/toggle")),C()},L=e=>{navigator.clipboard.writeText(e),T("Copied to clipboard")};return i.useEffect(()=>{if(N){let e=setTimeout(()=>T(""),3e3);return()=>clearTimeout(e)}},[N]),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Hub API Keys"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage customer-facing API keys (nxs-... prefix)"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>{f(!0),w("")},children:[(0,r.jsx)(a.Z,{size:16})," Create Key"]})]}),m&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>f(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:k?"Key Created":"New Hub Key"}),k?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"bg-yellow-500/10 border border-yellow-500/20 rounded-lg p-4 mb-4",children:[(0,r.jsx)("p",{className:"text-sm text-yellow-400 font-medium mb-2",children:"⚠️ Copy this key now — it won't be shown again!"}),(0,r.jsxs)("div",{className:"flex items-center gap-2 bg-surface-100 rounded-lg px-3 py-2 font-mono text-sm",children:[(0,r.jsx)("code",{className:"flex-1 break-all",children:k}),(0,r.jsx)("button",{onClick:()=>L(k),className:"text-[var(--text-secondary)] hover:text-white flex-shrink-0",children:(0,r.jsx)(c.Z,{size:16})})]})]}),(0,r.jsx)("button",{className:"btn-primary w-full justify-center",onClick:()=>f(!1),children:"Done"})]}):(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name"}),(0,r.jsx)("input",{className:"input",value:p,onChange:e=>y(e.target.value),placeholder:"My App",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Rate Limit (requests/min, 0 = unlimited)"}),(0,r.jsx)("input",{className:"input",type:"number",value:v,onChange:e=>j(Number(e.target.value))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Spend Limit ($, 0 = unlimited)"}),(0,r.jsx)("input",{className:"input",type:"number",step:"0.01",value:g,onChange:e=>b(Number(e.target.value))})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:E,children:"Create Key"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>f(!1),children:"Cancel"})]})]})]})}),h?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:h})]}):n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No hub keys yet. Create one to get started."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Key Prefix"}),(0,r.jsx)("th",{children:"Rate Limit"}),(0,r.jsx)("th",{children:"Spend"}),(0,r.jsx)("th",{children:"Requests"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{children:"Last Used"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium",children:e.name}),(0,r.jsx)("td",{children:(0,r.jsxs)("code",{className:"text-xs font-mono text-[var(--text-tertiary)]",children:[e.key_prefix,"..."]})}),(0,r.jsxs)("td",{children:[e.rate_limit||"∞","/min"]}),(0,r.jsxs)("td",{children:["$",e.total_spend.toFixed(4)," / $",e.spend_limit||"∞"]}),(0,r.jsx)("td",{children:e.total_requests}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>S(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:e.last_used||"Never"}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsx)("button",{onClick:()=>_(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(u.Z,{size:14})})})]},e.id))})]})})}),N&&(0,r.jsx)("div",{className:"toast",children:N})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return a},qz:function(){return s}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function i(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function a(){return!!i()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,o=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",a=i(),u={"Content-Type":"application/json",...t.headers};if(a&&(u.Authorization="Bearer ".concat(a)),"GET"===n&&!a){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=o.get(e);if(n)return n}let d=(async()=>{let i=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&a&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let c=await i.json();return"GET"!==n||a||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===n&&!a){o.set(e,d);try{return await d}finally{o.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>u("/api/auth/me"),logout:()=>{s(),l.clear(),window.location.href="/login"}},h=async e=>{let t=i(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let s=await n.blob(),a=URL.createObjectURL(s),c=document.createElement("a");c.href=a,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(a)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=8670)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/keys/page-41ddea359d104a24.js b/static/_next/static/chunks/app/keys/page-96ae9c1354f1877c.js similarity index 56% rename from static/_next/static/chunks/app/keys/page-41ddea359d104a24.js rename to static/_next/static/chunks/app/keys/page-96ae9c1354f1877c.js index 1d996e2396aa2ea8870c6514df0ee87b81a23deb..83a9b3911b84a63b57640d61eb6303b29fef9802 100644 --- a/static/_next/static/chunks/app/keys/page-41ddea359d104a24.js +++ b/static/_next/static/chunks/app/keys/page-96ae9c1354f1877c.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[23],{8670:function(e,t,n){Promise.resolve().then(n.bind(n,8001))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:i=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:o="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...a,width:i,height:i,stroke:n,strokeWidth:l?24*Number(c)/Number(i):c,className:s("lucide",o),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),l=(e,t)=>{let n=(0,r.forwardRef)((n,a)=>{let{className:l,...o}=n;return(0,r.createElement)(c,{ref:a,iconNode:t,className:s("lucide-".concat(i(e)),l),...o})});return n.displayName="".concat(e),n}},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},8867:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},4001:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function s(){throw Error("setTimeout has not been defined")}function a(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var l=[],o=!1,u=-1;function d(){o&&r&&(o=!1,r.length?l=r.concat(l):u=-1,l.length&&h())}function h(){if(!o){var e=c(d);o=!0;for(var t=l.length;t;){for(r=l,l=[];++u1)for(var n=1;n{d(!0),s.hi.get("/api/hub-keys").then(t).catch(e=>x(e instanceof Error?e.message:"Failed to load keys")).finally(()=>d(!1))};(0,i.useEffect)(()=>{C()},[]);let E=async()=>{if(p.trim())try{let e=await s.hi.post("/api/hub-keys",{name:p,rate_limit:v,spend_limit:g});w(e.raw_key),y(""),C()}catch(e){T(e instanceof Error?e.message:"Failed to create key")}},_=async e=>{confirm("Delete this key?")&&(await s.hi.delete("/api/hub-keys/".concat(e)),C(),T("Key deleted"))},S=async e=>{await s.hi.patch("/api/hub-keys/".concat(e,"/toggle")),C()},L=e=>{navigator.clipboard.writeText(e),T("Copied to clipboard")};return i.useEffect(()=>{if(N){let e=setTimeout(()=>T(""),3e3);return()=>clearTimeout(e)}},[N]),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Hub API Keys"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage customer-facing API keys (nxs-... prefix)"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>{f(!0),w("")},children:[(0,r.jsx)(a.Z,{size:16})," Create Key"]})]}),m&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>f(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:k?"Key Created":"New Hub Key"}),k?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"bg-yellow-500/10 border border-yellow-500/20 rounded-lg p-4 mb-4",children:[(0,r.jsx)("p",{className:"text-sm text-yellow-400 font-medium mb-2",children:"⚠️ Copy this key now — it won't be shown again!"}),(0,r.jsxs)("div",{className:"flex items-center gap-2 bg-surface-100 rounded-lg px-3 py-2 font-mono text-sm",children:[(0,r.jsx)("code",{className:"flex-1 break-all",children:k}),(0,r.jsx)("button",{onClick:()=>L(k),className:"text-[var(--text-secondary)] hover:text-white flex-shrink-0",children:(0,r.jsx)(c.Z,{size:16})})]})]}),(0,r.jsx)("button",{className:"btn-primary w-full justify-center",onClick:()=>f(!1),children:"Done"})]}):(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name"}),(0,r.jsx)("input",{className:"input",value:p,onChange:e=>y(e.target.value),placeholder:"My App",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Rate Limit (requests/min, 0 = unlimited)"}),(0,r.jsx)("input",{className:"input",type:"number",value:v,onChange:e=>j(Number(e.target.value))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Spend Limit ($, 0 = unlimited)"}),(0,r.jsx)("input",{className:"input",type:"number",step:"0.01",value:g,onChange:e=>b(Number(e.target.value))})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:E,children:"Create Key"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>f(!1),children:"Cancel"})]})]})]})}),h?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:h})]}):n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No hub keys yet. Create one to get started."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Key Prefix"}),(0,r.jsx)("th",{children:"Rate Limit"}),(0,r.jsx)("th",{children:"Spend"}),(0,r.jsx)("th",{children:"Requests"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{children:"Last Used"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium",children:e.name}),(0,r.jsx)("td",{children:(0,r.jsxs)("code",{className:"text-xs font-mono text-[var(--text-tertiary)]",children:[e.key_prefix,"..."]})}),(0,r.jsxs)("td",{children:[e.rate_limit||"∞","/min"]}),(0,r.jsxs)("td",{children:["$",e.total_spend.toFixed(4)," / $",e.spend_limit||"∞"]}),(0,r.jsx)("td",{children:e.total_requests}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>S(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:e.last_used||"Never"}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsx)("button",{onClick:()=>_(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(u.Z,{size:14})})})]},e.id))})]})})}),N&&(0,r.jsx)("div",{className:"toast",children:N})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return a},qz:function(){return s}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function i(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function a(){return!!i()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,o=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",a=i(),u={"Content-Type":"application/json",...t.headers};if(a&&(u.Authorization="Bearer ".concat(a)),"GET"===n&&!a){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=o.get(e);if(n)return n}let d=(async()=>{let i=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&a&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let c=await i.json();return"GET"!==n||a||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===n&&!a){o.set(e,d);try{return await d}finally{o.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>u("/api/auth/me"),logout:()=>{s(),l.clear(),window.location.href="/login"}},h=async e=>{let t=i(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let s=await n.blob(),a=URL.createObjectURL(s),c=document.createElement("a");c.href=a,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(a)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=8670)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[23],{8670:function(e,t,n){Promise.resolve().then(n.bind(n,8001))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:i=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...s,width:i,height:i,stroke:n,strokeWidth:o?24*Number(c)/Number(i):c,className:a("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let n=(0,r.forwardRef)((n,s)=>{let{className:o,...l}=n;return(0,r.createElement)(c,{ref:s,iconNode:t,className:a("lucide-".concat(i(e)),o),...l})});return n.displayName="".concat(e),n}},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},8867:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},4001:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function a(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var o=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?o=r.concat(o):u=-1,o.length&&h())}function h(){if(!l){var e=c(d);l=!0;for(var t=o.length;t;){for(r=o,o=[];++u1)for(var n=1;n{d(!0),a.hi.get("/api/hub-keys").then(t).catch(e=>m(e instanceof Error?e.message:"Failed to load keys")).finally(()=>d(!1))};(0,i.useEffect)(()=>{C()},[]);let E=async()=>{if(p.trim())try{let e=await a.hi.post("/api/hub-keys",{name:p,rate_limit:g,spend_limit:j});w(e.raw_key),y(""),C()}catch(e){T(e instanceof Error?e.message:"Failed to create key")}},_=async e=>{confirm("Delete this key?")&&(await a.hi.delete("/api/hub-keys/".concat(e)),C(),T("Key deleted"))},S=async e=>{await a.hi.patch("/api/hub-keys/".concat(e,"/toggle")),C()},L=e=>{navigator.clipboard.writeText(e),T("Copied to clipboard")};return i.useEffect(()=>{if(N){let e=setTimeout(()=>T(""),3e3);return()=>clearTimeout(e)}},[N]),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Hub API Keys"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage customer-facing API keys (nxs-... prefix)"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>{f(!0),w("")},children:[(0,r.jsx)(s.Z,{size:16})," Create Key"]})]}),x&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>f(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:k?"Key Created":"New Hub Key"}),k?(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"bg-yellow-500/10 border border-yellow-500/20 rounded-lg p-4 mb-4",children:[(0,r.jsx)("p",{className:"text-sm text-yellow-400 font-medium mb-2",children:"⚠️ Copy this key now — it won't be shown again!"}),(0,r.jsxs)("div",{className:"flex items-center gap-2 bg-surface-100 rounded-lg px-3 py-2 font-mono text-sm",children:[(0,r.jsx)("code",{className:"flex-1 break-all",children:k}),(0,r.jsx)("button",{onClick:()=>L(k),className:"text-[var(--text-secondary)] hover:text-white flex-shrink-0",children:(0,r.jsx)(c.Z,{size:16})})]})]}),(0,r.jsx)("button",{className:"btn-primary w-full justify-center",onClick:()=>f(!1),children:"Done"})]}):(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name"}),(0,r.jsx)("input",{className:"input",value:p,onChange:e=>y(e.target.value),placeholder:"My App",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Rate Limit (requests/min, 0 = unlimited)"}),(0,r.jsx)("input",{className:"input",type:"number",value:g,onChange:e=>v(Number(e.target.value))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Spend Limit ($, 0 = unlimited)"}),(0,r.jsx)("input",{className:"input",type:"number",step:"0.01",value:j,onChange:e=>b(Number(e.target.value))})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:E,children:"Create Key"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>f(!1),children:"Cancel"})]})]})]})}),h?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:h})]}):n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No hub keys yet. Create one to get started."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Key Prefix"}),(0,r.jsx)("th",{children:"Rate Limit"}),(0,r.jsx)("th",{children:"Spend"}),(0,r.jsx)("th",{children:"Requests"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{children:"Last Used"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium",children:e.name}),(0,r.jsx)("td",{children:(0,r.jsxs)("code",{className:"text-xs font-mono text-[var(--text-tertiary)]",children:[e.key_prefix,"..."]})}),(0,r.jsxs)("td",{children:[e.rate_limit||"∞","/min"]}),(0,r.jsxs)("td",{children:["$",e.total_spend.toFixed(4)," / $",e.spend_limit||"∞"]}),(0,r.jsx)("td",{children:e.total_requests}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>S(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:e.last_used||"Never"}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsx)("button",{onClick:()=>_(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(u.Z,{size:14})})})]},e.id))})]})})}),N&&(0,r.jsx)("div",{className:"toast",children:N})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return s},qz:function(){return a}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function i(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function a(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function s(){return!!i()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",s=i(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===n&&!s){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let i=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let c=await i.json();return"GET"!==n||s||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===n&&!s){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>u("/api/auth/me"),logout:()=>{a(),o.clear(),window.location.href="/login"}},h=async e=>{let t=i(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let a=await n.blob(),s=URL.createObjectURL(a),c=document.createElement("a");c.href=s,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=8670)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/latency/page-28c3699a91e1b53d.js b/static/_next/static/chunks/app/latency/page-52b713a656b347a3.js similarity index 70% rename from static/_next/static/chunks/app/latency/page-28c3699a91e1b53d.js rename to static/_next/static/chunks/app/latency/page-52b713a656b347a3.js index ab28dc0f4c57405c1dd4a7ccd1ba69df78fdbb26..2cea57851d28bc7ebdfd9a5615a7e75782cbb2aa 100644 --- a/static/_next/static/chunks/app/latency/page-28c3699a91e1b53d.js +++ b/static/_next/static/chunks/app/latency/page-52b713a656b347a3.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9395],{3198:function(e,t,r){Promise.resolve().then(r.bind(r,4911))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:u,...h}=e;return(0,n.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:r,strokeWidth:l?24*Number(o)/Number(a):o,className:s("lucide",c),...h},[...u.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:l,...c}=r;return(0,n.createElement)(o,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),l),...c})});return r.displayName="".concat(e),r}},1723:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},525:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]])},1239:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var l=[],c=!1,d=-1;function u(){c&&n&&(c=!1,n.length?l=n.concat(l):d=-1,l.length&&h())}function h(){if(!c){var e=o(u);c=!0;for(var t=l.length;t;){for(n=l,l=[];++d1)for(var r=1;r{u(!0),m(""),s.hi.get("/api/stats/latency-leaderboard").then(e=>{t((e||[]).sort((e,t)=>e.avg_latency_ms-t.avg_latency_ms))}).catch(e=>m(e instanceof Error?e.message:"Failed to load latency data")).finally(()=>u(!1))},[]),r)return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Latency Leaderboard"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider and model speed comparison"})]})}),(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-96 w-full"})})]});if(h)return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Latency Leaderboard"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider and model speed comparison"})]})}),(0,n.jsxs)("div",{className:"card border border-red-500/30 bg-red-500/5 text-center py-12",children:[(0,n.jsx)(i.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,n.jsx)("p",{className:"text-red-400 mb-2",children:"Failed to load latency data"}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:h}),(0,n.jsx)("button",{className:"btn-ghost btn-sm mt-4",onClick:()=>window.location.reload(),children:"Retry"})]})]});if(0===e.length)return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Latency Leaderboard"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider and model speed comparison"})]})}),(0,n.jsxs)("div",{className:"card text-center py-16",children:[(0,n.jsx)(o.Z,{size:40,className:"mx-auto mb-4 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)] mb-1",children:"No latency data yet"}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"Data will appear once requests are processed through the gateway."})]})]});let x=e[0].avg_latency_ms;return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Latency Leaderboard"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider and model speed comparison"})]})}),(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{className:"w-14",children:"Rank"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Model"}),(0,n.jsx)("th",{className:"text-right",children:"Avg Latency"}),(0,n.jsx)("th",{className:"text-right",children:"P50"}),(0,n.jsx)("th",{className:"text-right",children:"P95"}),(0,n.jsx)("th",{className:"text-right",children:"P99"}),(0,n.jsx)("th",{className:"text-right",children:"Requests"}),(0,n.jsx)("th",{className:"text-right",children:"Last Seen"})]})}),(0,n.jsx)("tbody",{children:e.map((e,t)=>{let r=Math.max(2,x/e.avg_latency_ms*100),a=d[t],s=t<3;return(0,n.jsxs)("tr",{style:s?{background:a.bg}:void 0,children:[(0,n.jsx)("td",{children:s?(0,n.jsxs)("span",{className:"flex items-center gap-1.5 font-semibold",style:{color:a.color},children:[(0,n.jsx)(l,{size:14,fill:a.color}),t+1]}):(0,n.jsxs)("span",{className:"text-[var(--text-tertiary)]",children:["#",t+1]})}),(0,n.jsx)("td",{className:"font-medium capitalize",children:e.provider}),(0,n.jsx)("td",{className:"font-mono text-xs max-w-[200px] truncate",title:e.model,children:e.model}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,n.jsxs)("span",{className:"font-semibold",children:[e.avg_latency_ms.toFixed(0),"ms"]}),(0,n.jsx)("div",{className:"w-16 h-1.5 bg-[var(--surface-200)] rounded-full overflow-hidden hidden md:block",children:(0,n.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:"".concat(r,"%"),background:s?a.color:"var(--accent)"}})})]})}),(0,n.jsxs)("td",{className:"text-right text-xs font-mono",children:[e.p50_ms.toFixed(0),"ms"]}),(0,n.jsxs)("td",{className:"text-right text-xs font-mono",children:[e.p95_ms.toFixed(0),"ms"]}),(0,n.jsxs)("td",{className:"text-right text-xs font-mono",children:[e.p99_ms.toFixed(0),"ms"]}),(0,n.jsx)("td",{className:"text-right text-xs",children:e.request_count.toLocaleString()}),(0,n.jsx)("td",{className:"text-right text-xs text-[var(--text-tertiary)]",children:function(e){let t=new Date(e),r=new Date().getTime()-t.getTime();return r<6e4?"just now":r<36e5?"".concat(Math.floor(r/6e4),"m ago"):r<864e5?"".concat(Math.floor(r/36e5),"h ago"):t.toLocaleDateString()}(e.last_seen)})]},"".concat(e.provider,"-").concat(e.model))})})]})})}),(0,n.jsxs)("div",{className:"flex items-center gap-4 mt-4 text-xs text-[var(--text-tertiary)]",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(c.Z,{size:14}),(0,n.jsx)("span",{children:"Sorted by avg latency (fastest first)"})]}),(0,n.jsxs)("div",{className:"hidden md:flex items-center gap-1.5",children:[(0,n.jsx)("div",{className:"w-3 h-1.5 rounded-full",style:{background:"var(--accent)"}}),(0,n.jsx)("span",{children:"Bar width = relative speed vs fastest"})]})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return s}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,c=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=a(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=c.get(e);if(r)return r}let u=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==r||i||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===r&&!i){c.set(e,u);try{return await u}finally{c.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>d("/api/auth/me"),logout:()=>{s(),l.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let s=await r.blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3198)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9395],{3198:function(e,t,r){Promise.resolve().then(r.bind(r,4911))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:d,iconNode:u,...h}=e;return(0,n.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:r,strokeWidth:c?24*Number(o)/Number(a):o,className:s("lucide",l),...h},[...u.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:c,...l}=r;return(0,n.createElement)(o,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),c),...l})});return r.displayName="".concat(e),r}},1723:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},525:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]])},1239:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var c=[],l=!1,d=-1;function u(){l&&n&&(l=!1,n.length?c=n.concat(c):d=-1,c.length&&h())}function h(){if(!l){var e=o(u);l=!0;for(var t=c.length;t;){for(n=c,c=[];++d1)for(var r=1;r{u(!0),m(""),s.hi.get("/api/stats/latency-leaderboard").then(e=>{t((e||[]).sort((e,t)=>e.avg_latency_ms-t.avg_latency_ms))}).catch(e=>m(e instanceof Error?e.message:"Failed to load latency data")).finally(()=>u(!1))},[]),r)return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Latency Leaderboard"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider and model speed comparison"})]})}),(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-96 w-full"})})]});if(h)return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Latency Leaderboard"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider and model speed comparison"})]})}),(0,n.jsxs)("div",{className:"card border border-red-500/30 bg-red-500/5 text-center py-12",children:[(0,n.jsx)(i.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,n.jsx)("p",{className:"text-red-400 mb-2",children:"Failed to load latency data"}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:h}),(0,n.jsx)("button",{className:"btn-ghost btn-sm mt-4",onClick:()=>window.location.reload(),children:"Retry"})]})]});if(0===e.length)return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Latency Leaderboard"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider and model speed comparison"})]})}),(0,n.jsxs)("div",{className:"card text-center py-16",children:[(0,n.jsx)(o.Z,{size:40,className:"mx-auto mb-4 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)] mb-1",children:"No latency data yet"}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"Data will appear once requests are processed through the gateway."})]})]});let x=e[0].avg_latency_ms;return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Latency Leaderboard"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider and model speed comparison"})]})}),(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{className:"w-14",children:"Rank"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Model"}),(0,n.jsx)("th",{className:"text-right",children:"Avg Latency"}),(0,n.jsx)("th",{className:"text-right",children:"P50"}),(0,n.jsx)("th",{className:"text-right",children:"P95"}),(0,n.jsx)("th",{className:"text-right",children:"P99"}),(0,n.jsx)("th",{className:"text-right",children:"Requests"}),(0,n.jsx)("th",{className:"text-right",children:"Last Seen"})]})}),(0,n.jsx)("tbody",{children:e.map((e,t)=>{let r=Math.max(2,x/e.avg_latency_ms*100),a=d[t],s=t<3;return(0,n.jsxs)("tr",{style:s?{background:a.bg}:void 0,children:[(0,n.jsx)("td",{children:s?(0,n.jsxs)("span",{className:"flex items-center gap-1.5 font-semibold",style:{color:a.color},children:[(0,n.jsx)(c,{size:14,fill:a.color}),t+1]}):(0,n.jsxs)("span",{className:"text-[var(--text-tertiary)]",children:["#",t+1]})}),(0,n.jsx)("td",{className:"font-medium capitalize",children:e.provider}),(0,n.jsx)("td",{className:"font-mono text-xs max-w-[200px] truncate",title:e.model,children:e.model}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,n.jsxs)("span",{className:"font-semibold",children:[e.avg_latency_ms.toFixed(0),"ms"]}),(0,n.jsx)("div",{className:"w-16 h-1.5 bg-[var(--surface-200)] rounded-full overflow-hidden hidden md:block",children:(0,n.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:"".concat(r,"%"),background:s?a.color:"var(--accent)"}})})]})}),(0,n.jsxs)("td",{className:"text-right text-xs font-mono",children:[e.p50_ms.toFixed(0),"ms"]}),(0,n.jsxs)("td",{className:"text-right text-xs font-mono",children:[e.p95_ms.toFixed(0),"ms"]}),(0,n.jsxs)("td",{className:"text-right text-xs font-mono",children:[e.p99_ms.toFixed(0),"ms"]}),(0,n.jsx)("td",{className:"text-right text-xs",children:e.request_count.toLocaleString()}),(0,n.jsx)("td",{className:"text-right text-xs text-[var(--text-tertiary)]",children:function(e){let t=new Date(e),r=new Date().getTime()-t.getTime();return r<6e4?"just now":r<36e5?"".concat(Math.floor(r/6e4),"m ago"):r<864e5?"".concat(Math.floor(r/36e5),"h ago"):t.toLocaleDateString()}(e.last_seen)})]},"".concat(e.provider,"-").concat(e.model))})})]})})}),(0,n.jsxs)("div",{className:"flex items-center gap-4 mt-4 text-xs text-[var(--text-tertiary)]",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(l.Z,{size:14}),(0,n.jsx)("span",{children:"Sorted by avg latency (fastest first)"})]}),(0,n.jsxs)("div",{className:"hidden md:flex items-center gap-1.5",children:[(0,n.jsx)("div",{className:"w-3 h-1.5 rounded-full",style:{background:"var(--accent)"}}),(0,n.jsx)("span",{children:"Bar width = relative speed vs fastest"})]})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return s}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function s(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=a(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=l.get(e);if(r)return r}let u=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==r||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===r&&!i){l.set(e,u);try{return await u}finally{l.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),function(e,t,r){try{let r="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(r)}catch(e){}}("nexus_token",r,0),n},getMe:()=>d("/api/auth/me"),logout:()=>{s(),c.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let s=await r.blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3198)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/latency/page-977dd72e08125802.js b/static/_next/static/chunks/app/latency/page-977dd72e08125802.js deleted file mode 100644 index ab28dc0f4c57405c1dd4a7ccd1ba69df78fdbb26..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/latency/page-977dd72e08125802.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9395],{3198:function(e,t,r){Promise.resolve().then(r.bind(r,4911))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:u,...h}=e;return(0,n.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:r,strokeWidth:l?24*Number(o)/Number(a):o,className:s("lucide",c),...h},[...u.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:l,...c}=r;return(0,n.createElement)(o,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),l),...c})});return r.displayName="".concat(e),r}},1723:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},525:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]])},1239:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var l=[],c=!1,d=-1;function u(){c&&n&&(c=!1,n.length?l=n.concat(l):d=-1,l.length&&h())}function h(){if(!c){var e=o(u);c=!0;for(var t=l.length;t;){for(n=l,l=[];++d1)for(var r=1;r{u(!0),m(""),s.hi.get("/api/stats/latency-leaderboard").then(e=>{t((e||[]).sort((e,t)=>e.avg_latency_ms-t.avg_latency_ms))}).catch(e=>m(e instanceof Error?e.message:"Failed to load latency data")).finally(()=>u(!1))},[]),r)return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Latency Leaderboard"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider and model speed comparison"})]})}),(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-96 w-full"})})]});if(h)return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Latency Leaderboard"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider and model speed comparison"})]})}),(0,n.jsxs)("div",{className:"card border border-red-500/30 bg-red-500/5 text-center py-12",children:[(0,n.jsx)(i.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,n.jsx)("p",{className:"text-red-400 mb-2",children:"Failed to load latency data"}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:h}),(0,n.jsx)("button",{className:"btn-ghost btn-sm mt-4",onClick:()=>window.location.reload(),children:"Retry"})]})]});if(0===e.length)return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Latency Leaderboard"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider and model speed comparison"})]})}),(0,n.jsxs)("div",{className:"card text-center py-16",children:[(0,n.jsx)(o.Z,{size:40,className:"mx-auto mb-4 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)] mb-1",children:"No latency data yet"}),(0,n.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"Data will appear once requests are processed through the gateway."})]})]});let x=e[0].avg_latency_ms;return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Latency Leaderboard"}),(0,n.jsx)("p",{className:"page-sub",children:"Provider and model speed comparison"})]})}),(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{className:"w-14",children:"Rank"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Model"}),(0,n.jsx)("th",{className:"text-right",children:"Avg Latency"}),(0,n.jsx)("th",{className:"text-right",children:"P50"}),(0,n.jsx)("th",{className:"text-right",children:"P95"}),(0,n.jsx)("th",{className:"text-right",children:"P99"}),(0,n.jsx)("th",{className:"text-right",children:"Requests"}),(0,n.jsx)("th",{className:"text-right",children:"Last Seen"})]})}),(0,n.jsx)("tbody",{children:e.map((e,t)=>{let r=Math.max(2,x/e.avg_latency_ms*100),a=d[t],s=t<3;return(0,n.jsxs)("tr",{style:s?{background:a.bg}:void 0,children:[(0,n.jsx)("td",{children:s?(0,n.jsxs)("span",{className:"flex items-center gap-1.5 font-semibold",style:{color:a.color},children:[(0,n.jsx)(l,{size:14,fill:a.color}),t+1]}):(0,n.jsxs)("span",{className:"text-[var(--text-tertiary)]",children:["#",t+1]})}),(0,n.jsx)("td",{className:"font-medium capitalize",children:e.provider}),(0,n.jsx)("td",{className:"font-mono text-xs max-w-[200px] truncate",title:e.model,children:e.model}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,n.jsxs)("span",{className:"font-semibold",children:[e.avg_latency_ms.toFixed(0),"ms"]}),(0,n.jsx)("div",{className:"w-16 h-1.5 bg-[var(--surface-200)] rounded-full overflow-hidden hidden md:block",children:(0,n.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:"".concat(r,"%"),background:s?a.color:"var(--accent)"}})})]})}),(0,n.jsxs)("td",{className:"text-right text-xs font-mono",children:[e.p50_ms.toFixed(0),"ms"]}),(0,n.jsxs)("td",{className:"text-right text-xs font-mono",children:[e.p95_ms.toFixed(0),"ms"]}),(0,n.jsxs)("td",{className:"text-right text-xs font-mono",children:[e.p99_ms.toFixed(0),"ms"]}),(0,n.jsx)("td",{className:"text-right text-xs",children:e.request_count.toLocaleString()}),(0,n.jsx)("td",{className:"text-right text-xs text-[var(--text-tertiary)]",children:function(e){let t=new Date(e),r=new Date().getTime()-t.getTime();return r<6e4?"just now":r<36e5?"".concat(Math.floor(r/6e4),"m ago"):r<864e5?"".concat(Math.floor(r/36e5),"h ago"):t.toLocaleDateString()}(e.last_seen)})]},"".concat(e.provider,"-").concat(e.model))})})]})})}),(0,n.jsxs)("div",{className:"flex items-center gap-4 mt-4 text-xs text-[var(--text-tertiary)]",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(c.Z,{size:14}),(0,n.jsx)("span",{children:"Sorted by avg latency (fastest first)"})]}),(0,n.jsxs)("div",{className:"hidden md:flex items-center gap-1.5",children:[(0,n.jsx)("div",{className:"w-3 h-1.5 rounded-full",style:{background:"var(--accent)"}}),(0,n.jsx)("span",{children:"Bar width = relative speed vs fastest"})]})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return s}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,c=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=a(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=c.get(e);if(r)return r}let u=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==r||i||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===r&&!i){c.set(e,u);try{return await u}finally{c.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>d("/api/auth/me"),logout:()=>{s(),l.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let s=await r.blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3198)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/layout-62b35e683e324a12.js b/static/_next/static/chunks/app/layout-62b35e683e324a12.js new file mode 100644 index 0000000000000000000000000000000000000000..f120f25abf487426e8857fcb0133a0944ac8a973 --- /dev/null +++ b/static/_next/static/chunks/app/layout-62b35e683e324a12.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3185],{8528:function(e,t,n){Promise.resolve().then(n.t.bind(n,2778,23)),Promise.resolve().then(n.bind(n,6198))},6198:function(e,t,n){"use strict";n.d(t,{Providers:function(){return W}});var a=n(7437),i=n(2265),o=n(9376),r=n(5389),l=n(7648),s=n(5466),c=n(2023),f=n(2222),d=n(8906),u=n(4001),h=n(8406),x=n(8428),p=n(3781),m=n(8736),b=n(3073),g=n(6272),y=n(1239),v=n(6865),w=n(221),k=n(91),j=n(3417),Z=n(7829),N=n(8662),P=n(8124),T=n(1769),C=n(4401),S=n(6215),E=n(5252),I=n(9659),_=n(1723),A=n(4972),z=n(8728),R=n(8997),L=n(2735),M=n(3628),O=n(6137),B=n(1178),U=n(8220),H=n(2451),F=n(7692);let D=[{section:"Overview",items:[{href:"/",label:"Dashboard",icon:s.Z},{href:"/agent",label:"AI Agent",icon:c.Z},{href:"/models",label:"Models",icon:f.Z}]},{section:"API Keys",items:[{href:"/provider-keys",label:"Provider Keys",icon:d.Z},{href:"/keys",label:"Hub Keys",icon:u.Z}]},{section:"Routing",items:[{href:"/routing",label:"Routing Rules",icon:h.Z},{href:"/aliases",label:"Model Aliases",icon:x.Z},{href:"/fallback-chains",label:"Fallback Chains",icon:p.Z},{href:"/prompt-templates",label:"Templates",icon:m.Z},{href:"/middleware",label:"Middleware",icon:b.Z},{href:"/response-filters",label:"Response Filters",icon:d.Z}]},{section:"Intelligence",items:[{href:"/ab-tests",label:"A/B Testing",icon:g.Z},{href:"/benchmarks",label:"Benchmarks",icon:y.Z},{href:"/injection-logs",label:"Injection Logs",icon:v.Z},{href:"/code-interpreter",label:"Code Interpreter",icon:w.Z},{href:"/rag",label:"RAG Sessions",icon:k.Z}]},{section:"Proxy",items:[{href:"/chat",label:"Proxy Test",icon:j.Z},{href:"/playground",label:"Playground",icon:Z.Z},{href:"/realtime",label:"Realtime",icon:N.Z},{href:"/batch-api",label:"Batch API",icon:P.Z},{href:"/integration",label:"Integration",icon:T.Z}]},{section:"Observability",items:[{href:"/activity",label:"Activity",icon:C.Z},{href:"/analytics",label:"Analytics",icon:S.Z},{href:"/pricing",label:"Pricing",icon:E.Z},{href:"/status",label:"Status",icon:I.Z},{href:"/latency",label:"Latency",icon:_.Z},{href:"/conversations",label:"Conversations",icon:j.Z}]},{section:"Training",items:[{href:"/fine-tuning",label:"Fine-Tuning",icon:A.Z}]},{section:"System",items:[{href:"/admin",label:"Settings",icon:z.Z},{href:"/cache",label:"Cache",icon:k.Z},{href:"/health",label:"Health Check",icon:R.Z},{href:"/config-backup",label:"Config Backup",icon:L.Z},{href:"/webhooks",label:"Webhooks",icon:M.Z},{href:"/custom-providers",label:"Custom Providers",icon:O.Z},{href:"/presets",label:"Presets",icon:B.Z},{href:"/docs",label:"Docs",icon:U.Z}]}];function G(){let e=(0,o.usePathname)(),{logout:t,user:n}=(0,r.a)(),[s,c]=i.useState(!1);return"/login"===e?null:(0,a.jsxs)("aside",{className:"".concat(s?"w-16":"w-56"," h-screen bg-surface border-r border-[var(--border)] flex flex-col flex-shrink-0 transition-all duration-200"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 px-4 h-14 border-b border-[var(--border)] flex-shrink-0",children:[(0,a.jsx)("div",{className:"w-7 h-7 bg-nexus-500 rounded-md flex items-center justify-center text-xs font-black text-white flex-shrink-0 logo-glow",children:"N"}),!s&&(0,a.jsx)("span",{className:"font-bold text-sm",children:"NexusAI"}),(0,a.jsx)("button",{onClick:()=>c(!s),className:"ml-auto text-[var(--text-tertiary)] hover:text-white transition-colors",children:(0,a.jsx)(H.Z,{size:14,className:"transition-transform ".concat(s?"rotate-180":"")})})]}),(0,a.jsx)("nav",{className:"flex-1 py-2 px-2 space-y-1 overflow-y-auto",children:D.map(t=>(0,a.jsxs)("div",{children:[!s&&t.section!==D[0].section&&(0,a.jsx)("div",{className:"px-3 pt-4 pb-1 text-[10px] font-semibold uppercase tracking-widest text-[var(--text-tertiary)]",children:t.section}),t.items.map(t=>{let n=e===t.href,i=t.icon;return(0,a.jsxs)(l.default,{href:t.href,className:"flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-all duration-150\n ".concat(n?"bg-nexus-500/10 text-nexus-400":"text-[var(--text-secondary)] hover:text-white hover:bg-surface-100","\n ").concat(s?"justify-center px-2":""),title:s?t.label:void 0,children:[(0,a.jsx)(i,{size:18,className:"flex-shrink-0"}),!s&&t.label]},t.href)})]},t.section))}),(0,a.jsxs)("div",{className:"border-t border-[var(--border)] p-2 flex-shrink-0",children:[!s&&n&&(0,a.jsxs)("div",{className:"px-3 py-2 text-xs text-[var(--text-tertiary)] truncate",children:[n.username," \xb7 ",n.role]}),(0,a.jsxs)("button",{onClick:t,className:"flex items-center gap-3 px-3 py-2 rounded-lg text-sm text-[var(--text-tertiary)] hover:text-red-400 hover:bg-red-500/5 w-full transition-all duration-150",children:[(0,a.jsx)(F.Z,{size:18}),!s&&"Logout"]})]})]})}function q(){return(0,a.jsx)("a",{href:"/login",className:"nx-fallback","data-fallback-link":!0,children:"Continue to sign in →"})}function K(e){let{children:t}=e,{isAuthenticated:n,loading:l}=(0,r.a)(),s=(0,o.usePathname)();return(i.useEffect(()=>{if(!l&&!n&&"/login"!==s)try{window.location.replace("/login")}catch(e){window.location.href="/login"}},[l,n,s]),"/login"===s)?(0,a.jsx)(a.Fragment,{children:t}):l||!n?(0,a.jsxs)("div",{className:"nx-spinner-wrap",children:[(0,a.jsx)("div",{className:"nx-spinner"}),(0,a.jsx)(q,{})]}):(0,a.jsxs)("div",{className:"flex h-screen overflow-hidden",style:{background:"#0a0a0a"},children:[(0,a.jsx)(G,{}),(0,a.jsx)("main",{className:"flex-1 overflow-y-auto p-6 lg:p-8",children:t})]})}function W(e){let{children:t}=e;return i.useEffect(()=>{let e=document.querySelector("[data-static-fallback]");e&&e.remove()},[]),(0,a.jsxs)(r.H,{children:[(0,a.jsx)("style",{dangerouslySetInnerHTML:{__html:"html,body{margin:0;padding:0;background:#0a0a0a;color:#fff;font-family:Inter,system-ui,-apple-system,sans-serif;-webkit-font-smoothing:antialiased}*{box-sizing:border-box}.nx-spinner-wrap{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#0a0a0a;position:relative;padding:24px}.nx-spinner{width:32px;height:32px;border:2px solid #f97316;border-top-color:transparent;border-radius:50%;animation:nx-spin 1s linear infinite}@keyframes nx-spin{to{transform:rotate(1turn)}}.nx-noscript{padding:32px;text-align:center;max-width:480px;margin:80px auto;color:#a1a1a1}.nx-noscript h1{color:#fff;font-size:20px;margin:0 0 8px}.nx-noscript a{color:#f97316}.nx-fallback{display:inline-block;margin-top:24px;padding:10px 20px;background:#f97316;color:#fff;border-radius:8px;font-size:14px;text-decoration:none;font-family:Inter,system-ui,sans-serif;font-weight:500}.nx-fallback:hover{background:#ea580c}"},"data-critical":!0}),(0,a.jsxs)("div",{className:"nx-spinner-wrap","data-static-fallback":!0,children:[(0,a.jsx)("div",{className:"nx-spinner"}),(0,a.jsx)("a",{href:"/login",className:"nx-fallback","data-fallback-link":!0,children:"Continue to sign in →"})]}),(0,a.jsx)(K,{children:t})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return u},hi:function(){return d},jl:function(){return r},qz:function(){return o}});let a=n(257).env.NEXT_PUBLIC_API_BASE||"";function i(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function o(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function r(){return!!i()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},s=new Map,c=new Map;async function f(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",r=i(),f={"Content-Type":"application/json",...t.headers};if(r&&(f.Authorization="Bearer ".concat(r)),"GET"===n&&!r){let t=function(e){let t=s.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){s.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=c.get(e);if(n)return n}let d=(async()=>{let i=await fetch("".concat(a).concat(e),{method:n,headers:f,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&r&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw o(),s.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let l=await i.json();return"GET"!==n||r||function(e,t){if(s.size>=200){let e=s.keys().next().value;void 0!==e&&s.delete(e)}s.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===n&&!r){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>f(e),post:(e,t)=>f(e,{method:"POST",body:t}),put:(e,t)=>f(e,{method:"PUT",body:t}),patch:(e,t)=>f(e,{method:"PATCH",body:t}),delete:e=>f(e,{method:"DELETE"}),login:async(e,t)=>{var n;let a=await f("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=a.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),a},getMe:()=>f("/api/auth/me"),logout:()=>{o(),s.clear(),window.location.href="/login"}},u=async e=>{let t=i(),n=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let o=await n.blob(),r=URL.createObjectURL(o),l=document.createElement("a");l.href=r,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(r)}},5389:function(e,t,n){"use strict";n.d(t,{H:function(){return l},a:function(){return s}});var a=n(7437),i=n(2265),o=n(1837);let r=(0,i.createContext)({user:null,loading:!0,login:async()=>{},logout:()=>{},isAuthenticated:!1});function l(e){let{children:t}=e,[n,l]=(0,i.useState)(null),[s,c]=(0,i.useState)(!0);(0,i.useEffect)(()=>{if((0,o.jl)()){let e=setTimeout(()=>{c(!1)},5e3);o.hi.getMe().then(l).catch(()=>{(0,o.qz)(),l(null)}).finally(()=>{clearTimeout(e),c(!1)})}else c(!1)},[]);let f=async(e,t)=>{await o.hi.login(e,t),l(await o.hi.getMe())};return(0,a.jsx)(r.Provider,{value:{user:n,loading:s,login:f,logout:()=>{(0,o.qz)(),l(null),window.location.href="/login"},isAuthenticated:!!n},children:t})}let s=()=>(0,i.useContext)(r)},2778:function(){}},function(e){e.O(0,[2461,7593,2971,2117,1744],function(){return e(e.s=8528)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/layout-8a0f8a17324939d0.js b/static/_next/static/chunks/app/layout-8a0f8a17324939d0.js deleted file mode 100644 index 8c48f2e1c36654c2da7d4fae2a0aa370327c3b91..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/layout-8a0f8a17324939d0.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3185],{8528:function(e,t,n){Promise.resolve().then(n.t.bind(n,2778,23)),Promise.resolve().then(n.bind(n,6198))},6198:function(e,t,n){"use strict";n.d(t,{Providers:function(){return J}});var i=n(7437),a=n(2265),r=n(9376),o=n(5389),l=n(7648),s=n(5466),c=n(2023),f=n(2222),d=n(8906),h=n(4001),u=n(8406),x=n(8428),p=n(3781),g=n(8736),b=n(3073),m=n(6272),v=n(1239),y=n(6865),w=n(221),k=n(91),j=n(3417),Z=n(7829),N=n(8662),P=n(8124),T=n(1769),S=n(4401),I=n(6215),_=n(5252),E=n(9659),A=n(1723),C=n(4972),z=n(8728),L=n(8997),M=n(2735),O=n(3628),R=n(6137),B=n(1178),H=n(8220),F=n(2451),G=n(7692);let U=[{section:"Overview",items:[{href:"/",label:"Dashboard",icon:s.Z},{href:"/agent",label:"AI Agent",icon:c.Z},{href:"/models",label:"Models",icon:f.Z}]},{section:"API Keys",items:[{href:"/provider-keys",label:"Provider Keys",icon:d.Z},{href:"/keys",label:"Hub Keys",icon:h.Z}]},{section:"Routing",items:[{href:"/routing",label:"Routing Rules",icon:u.Z},{href:"/aliases",label:"Model Aliases",icon:x.Z},{href:"/fallback-chains",label:"Fallback Chains",icon:p.Z},{href:"/prompt-templates",label:"Templates",icon:g.Z},{href:"/middleware",label:"Middleware",icon:b.Z},{href:"/response-filters",label:"Response Filters",icon:d.Z}]},{section:"Intelligence",items:[{href:"/ab-tests",label:"A/B Testing",icon:m.Z},{href:"/benchmarks",label:"Benchmarks",icon:v.Z},{href:"/injection-logs",label:"Injection Logs",icon:y.Z},{href:"/code-interpreter",label:"Code Interpreter",icon:w.Z},{href:"/rag",label:"RAG Sessions",icon:k.Z}]},{section:"Proxy",items:[{href:"/chat",label:"Proxy Test",icon:j.Z},{href:"/playground",label:"Playground",icon:Z.Z},{href:"/realtime",label:"Realtime",icon:N.Z},{href:"/batch-api",label:"Batch API",icon:P.Z},{href:"/integration",label:"Integration",icon:T.Z}]},{section:"Observability",items:[{href:"/activity",label:"Activity",icon:S.Z},{href:"/analytics",label:"Analytics",icon:I.Z},{href:"/pricing",label:"Pricing",icon:_.Z},{href:"/status",label:"Status",icon:E.Z},{href:"/latency",label:"Latency",icon:A.Z},{href:"/conversations",label:"Conversations",icon:j.Z}]},{section:"Training",items:[{href:"/fine-tuning",label:"Fine-Tuning",icon:C.Z}]},{section:"System",items:[{href:"/admin",label:"Settings",icon:z.Z},{href:"/cache",label:"Cache",icon:k.Z},{href:"/health",label:"Health Check",icon:L.Z},{href:"/config-backup",label:"Config Backup",icon:M.Z},{href:"/webhooks",label:"Webhooks",icon:O.Z},{href:"/custom-providers",label:"Custom Providers",icon:R.Z},{href:"/presets",label:"Presets",icon:B.Z},{href:"/docs",label:"Docs",icon:H.Z}]}];function q(){let e=(0,r.usePathname)(),{logout:t,user:n}=(0,o.a)(),[s,c]=a.useState(!1);return"/login"===e?null:(0,i.jsxs)("aside",{className:"".concat(s?"w-16":"w-56"," h-screen bg-surface border-r border-[var(--border)] flex flex-col flex-shrink-0 transition-all duration-200"),children:[(0,i.jsxs)("div",{className:"flex items-center gap-3 px-4 h-14 border-b border-[var(--border)] flex-shrink-0",children:[(0,i.jsx)("div",{className:"w-7 h-7 bg-nexus-500 rounded-md flex items-center justify-center text-xs font-black text-white flex-shrink-0 logo-glow",children:"N"}),!s&&(0,i.jsx)("span",{className:"font-bold text-sm",children:"NexusAI"}),(0,i.jsx)("button",{onClick:()=>c(!s),className:"ml-auto text-[var(--text-tertiary)] hover:text-white transition-colors",children:(0,i.jsx)(F.Z,{size:14,className:"transition-transform ".concat(s?"rotate-180":"")})})]}),(0,i.jsx)("nav",{className:"flex-1 py-2 px-2 space-y-1 overflow-y-auto",children:U.map(t=>(0,i.jsxs)("div",{children:[!s&&t.section!==U[0].section&&(0,i.jsx)("div",{className:"px-3 pt-4 pb-1 text-[10px] font-semibold uppercase tracking-widest text-[var(--text-tertiary)]",children:t.section}),t.items.map(t=>{let n=e===t.href,a=t.icon;return(0,i.jsxs)(l.default,{href:t.href,className:"flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-all duration-150\n ".concat(n?"bg-nexus-500/10 text-nexus-400":"text-[var(--text-secondary)] hover:text-white hover:bg-surface-100","\n ").concat(s?"justify-center px-2":""),title:s?t.label:void 0,children:[(0,i.jsx)(a,{size:18,className:"flex-shrink-0"}),!s&&t.label]},t.href)})]},t.section))}),(0,i.jsxs)("div",{className:"border-t border-[var(--border)] p-2 flex-shrink-0",children:[!s&&n&&(0,i.jsxs)("div",{className:"px-3 py-2 text-xs text-[var(--text-tertiary)] truncate",children:[n.username," \xb7 ",n.role]}),(0,i.jsxs)("button",{onClick:t,className:"flex items-center gap-3 px-3 py-2 rounded-lg text-sm text-[var(--text-tertiary)] hover:text-red-400 hover:bg-red-500/5 w-full transition-all duration-150",children:[(0,i.jsx)(G.Z,{size:18}),!s&&"Logout"]})]})]})}function D(){return(0,i.jsx)("a",{href:"/login",className:"nx-fallback","data-fallback-link":!0,children:"Continue to sign in →"})}function K(e){let{children:t}=e,{isAuthenticated:n,loading:l}=(0,o.a)(),s=(0,r.usePathname)();return(a.useEffect(()=>{if(!l&&!n&&"/login"!==s)try{window.location.replace("/login")}catch(e){window.location.href="/login"}},[l,n,s]),"/login"===s)?(0,i.jsx)(i.Fragment,{children:t}):l||!n?(0,i.jsxs)("div",{className:"nx-spinner-wrap",children:[(0,i.jsx)("div",{className:"nx-spinner"}),(0,i.jsx)(D,{})]}):(0,i.jsxs)("div",{className:"flex h-screen overflow-hidden",style:{background:"#0a0a0a"},children:[(0,i.jsx)(q,{}),(0,i.jsx)("main",{className:"flex-1 overflow-y-auto p-6 lg:p-8",children:t})]})}function J(e){let{children:t}=e;return a.useEffect(()=>{let e=document.querySelector("[data-static-fallback]");e&&e.remove()},[]),(0,i.jsxs)(o.H,{children:[(0,i.jsx)("style",{dangerouslySetInnerHTML:{__html:"html,body{margin:0;padding:0;background:#0a0a0a;color:#fff;font-family:Inter,system-ui,-apple-system,sans-serif;-webkit-font-smoothing:antialiased}*{box-sizing:border-box}.nx-spinner-wrap{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#0a0a0a;position:relative;padding:24px}.nx-spinner{width:32px;height:32px;border:2px solid #f97316;border-top-color:transparent;border-radius:50%;animation:nx-spin 1s linear infinite}@keyframes nx-spin{to{transform:rotate(1turn)}}.nx-noscript{padding:32px;text-align:center;max-width:480px;margin:80px auto;color:#a1a1a1}.nx-noscript h1{color:#fff;font-size:20px;margin:0 0 8px}.nx-noscript a{color:#f97316}.nx-fallback{display:inline-block;margin-top:24px;padding:10px 20px;background:#f97316;color:#fff;border-radius:8px;font-size:14px;text-decoration:none;font-family:Inter,system-ui,sans-serif;font-weight:500}.nx-fallback:hover{background:#ea580c}"},"data-critical":!0}),(0,i.jsx)("script",{dangerouslySetInnerHTML:{__html:"(function(){try{var p=window.location.pathname;if(p==='/login'||p==='/login.html')return;if(p.indexOf('/_next/')===0)return;if(p==='/favicon.svg'||p==='/icon.svg')return;if(p==='/health')return;var t=null;try{t=localStorage.getItem('nexus_token')}catch(e){}if(!t){var d='/login';try{window.location.replace(d)}catch(e){window.location.href=d}return}setTimeout(function(){try{var c=localStorage.getItem('nexus_token');if(!c){window.location.replace('/login')}}catch(e){}},8000)})();"},"data-auth-guard":!0}),(0,i.jsx)("noscript",{children:(0,i.jsxs)("div",{className:"nx-noscript",children:[(0,i.jsx)("h1",{children:"JavaScript is required"}),(0,i.jsxs)("p",{children:["NexusAI Gateway is a single-page application. Please enable JavaScript or visit ",(0,i.jsx)("a",{href:"/login",children:"/login"})," after enabling it."]})]})}),(0,i.jsxs)("div",{className:"nx-spinner-wrap","data-static-fallback":!0,children:[(0,i.jsx)("div",{className:"nx-spinner"}),(0,i.jsx)("a",{href:"/login",className:"nx-fallback","data-fallback-link":!0,children:"Continue to sign in →"})]}),(0,i.jsx)(K,{children:t})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return o},qz:function(){return r}});let i=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function r(){localStorage.removeItem("nexus_token")}function o(){return!!a()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},s=new Map,c=new Map;async function f(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",o=a(),f={"Content-Type":"application/json",...t.headers};if(o&&(f.Authorization="Bearer ".concat(o)),"GET"===n&&!o){let t=function(e){let t=s.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){s.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=c.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(i).concat(e),{method:n,headers:f,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&o&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw r(),s.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let l=await a.json();return"GET"!==n||o||function(e,t){if(s.size>=200){let e=s.keys().next().value;void 0!==e&&s.delete(e)}s.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===n&&!o){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>f(e),post:(e,t)=>f(e,{method:"POST",body:t}),put:(e,t)=>f(e,{method:"PUT",body:t}),patch:(e,t)=>f(e,{method:"PATCH",body:t}),delete:e=>f(e,{method:"DELETE"}),login:async(e,t)=>{var n;let i=await f("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=i.access_token,localStorage.setItem("nexus_token",n),i},getMe:()=>f("/api/auth/me"),logout:()=>{r(),s.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(i).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let r=await n.blob(),o=URL.createObjectURL(r),l=document.createElement("a");l.href=o,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(o)}},5389:function(e,t,n){"use strict";n.d(t,{H:function(){return l},a:function(){return s}});var i=n(7437),a=n(2265),r=n(1837);let o=(0,a.createContext)({user:null,loading:!0,login:async()=>{},logout:()=>{},isAuthenticated:!1});function l(e){let{children:t}=e,[n,l]=(0,a.useState)(null),[s,c]=(0,a.useState)(!0);(0,a.useEffect)(()=>{if((0,r.jl)()){let e=setTimeout(()=>{c(!1)},5e3);r.hi.getMe().then(l).catch(()=>{(0,r.qz)(),l(null)}).finally(()=>{clearTimeout(e),c(!1)})}else c(!1)},[]);let f=async(e,t)=>{await r.hi.login(e,t),l(await r.hi.getMe())};return(0,i.jsx)(o.Provider,{value:{user:n,loading:s,login:f,logout:()=>{(0,r.qz)(),l(null),window.location.href="/login"},isAuthenticated:!!n},children:t})}let s=()=>(0,a.useContext)(o)},2778:function(){}},function(e){e.O(0,[2461,7593,2971,2117,1744],function(){return e(e.s=8528)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/layout-bdb3391966006dbc.js b/static/_next/static/chunks/app/layout-bdb3391966006dbc.js deleted file mode 100644 index f6bd512ddd30a13de749dd501b7389fc98085ca3..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/layout-bdb3391966006dbc.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3185],{8624:function(e,t,n){Promise.resolve().then(n.bind(n,8628))},8628:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return J}});var i=n(7437),a=n(2265),r=n(9376),o=n(5389),l=n(7648),s=n(5466),c=n(2023),f=n(2222),h=n(8906),d=n(4001),u=n(8406),x=n(8428),p=n(3781),g=n(8736),m=n(3073),b=n(6272),v=n(1239),y=n(6865),w=n(221),j=n(91),k=n(3417),Z=n(7829),N=n(8662),T=n(8124),I=n(1769),P=n(4401),S=n(6215),_=n(5252),A=n(9659),C=n(1723),E=n(4972),z=n(8728),L=n(8997),M=n(2735),O=n(3628),R=n(6137),B=n(1178),H=n(8220),G=n(2451),F=n(7692);let U=[{section:"Overview",items:[{href:"/",label:"Dashboard",icon:s.Z},{href:"/agent",label:"AI Agent",icon:c.Z},{href:"/models",label:"Models",icon:f.Z}]},{section:"API Keys",items:[{href:"/provider-keys",label:"Provider Keys",icon:h.Z},{href:"/keys",label:"Hub Keys",icon:d.Z}]},{section:"Routing",items:[{href:"/routing",label:"Routing Rules",icon:u.Z},{href:"/aliases",label:"Model Aliases",icon:x.Z},{href:"/fallback-chains",label:"Fallback Chains",icon:p.Z},{href:"/prompt-templates",label:"Templates",icon:g.Z},{href:"/middleware",label:"Middleware",icon:m.Z},{href:"/response-filters",label:"Response Filters",icon:h.Z}]},{section:"Intelligence",items:[{href:"/ab-tests",label:"A/B Testing",icon:b.Z},{href:"/benchmarks",label:"Benchmarks",icon:v.Z},{href:"/injection-logs",label:"Injection Logs",icon:y.Z},{href:"/code-interpreter",label:"Code Interpreter",icon:w.Z},{href:"/rag",label:"RAG Sessions",icon:j.Z}]},{section:"Proxy",items:[{href:"/chat",label:"Proxy Test",icon:k.Z},{href:"/playground",label:"Playground",icon:Z.Z},{href:"/realtime",label:"Realtime",icon:N.Z},{href:"/batch-api",label:"Batch API",icon:T.Z},{href:"/integration",label:"Integration",icon:I.Z}]},{section:"Observability",items:[{href:"/activity",label:"Activity",icon:P.Z},{href:"/analytics",label:"Analytics",icon:S.Z},{href:"/pricing",label:"Pricing",icon:_.Z},{href:"/status",label:"Status",icon:A.Z},{href:"/latency",label:"Latency",icon:C.Z},{href:"/conversations",label:"Conversations",icon:k.Z}]},{section:"Training",items:[{href:"/fine-tuning",label:"Fine-Tuning",icon:E.Z}]},{section:"System",items:[{href:"/admin",label:"Settings",icon:z.Z},{href:"/cache",label:"Cache",icon:j.Z},{href:"/health",label:"Health Check",icon:L.Z},{href:"/config-backup",label:"Config Backup",icon:M.Z},{href:"/webhooks",label:"Webhooks",icon:O.Z},{href:"/custom-providers",label:"Custom Providers",icon:R.Z},{href:"/presets",label:"Presets",icon:B.Z},{href:"/docs",label:"Docs",icon:H.Z}]}];function D(){let e=(0,r.usePathname)(),{logout:t,user:n}=(0,o.a)(),[s,c]=a.useState(!1);return"/login"===e?null:(0,i.jsxs)("aside",{className:"".concat(s?"w-16":"w-56"," h-screen bg-surface border-r border-[var(--border)] flex flex-col flex-shrink-0 transition-all duration-200"),children:[(0,i.jsxs)("div",{className:"flex items-center gap-3 px-4 h-14 border-b border-[var(--border)] flex-shrink-0",children:[(0,i.jsx)("div",{className:"w-7 h-7 bg-nexus-500 rounded-md flex items-center justify-center text-xs font-black text-white flex-shrink-0 logo-glow",children:"N"}),!s&&(0,i.jsx)("span",{className:"font-bold text-sm",children:"NexusAI"}),(0,i.jsx)("button",{onClick:()=>c(!s),className:"ml-auto text-[var(--text-tertiary)] hover:text-white transition-colors",children:(0,i.jsx)(G.Z,{size:14,className:"transition-transform ".concat(s?"rotate-180":"")})})]}),(0,i.jsx)("nav",{className:"flex-1 py-2 px-2 space-y-1 overflow-y-auto",children:U.map(t=>(0,i.jsxs)("div",{children:[!s&&t.section!==U[0].section&&(0,i.jsx)("div",{className:"px-3 pt-4 pb-1 text-[10px] font-semibold uppercase tracking-widest text-[var(--text-tertiary)]",children:t.section}),t.items.map(t=>{let n=e===t.href,a=t.icon;return(0,i.jsxs)(l.default,{href:t.href,className:"flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-all duration-150\n ".concat(n?"bg-nexus-500/10 text-nexus-400":"text-[var(--text-secondary)] hover:text-white hover:bg-surface-100","\n ").concat(s?"justify-center px-2":""),title:s?t.label:void 0,children:[(0,i.jsx)(a,{size:18,className:"flex-shrink-0"}),!s&&t.label]},t.href)})]},t.section))}),(0,i.jsxs)("div",{className:"border-t border-[var(--border)] p-2 flex-shrink-0",children:[!s&&n&&(0,i.jsxs)("div",{className:"px-3 py-2 text-xs text-[var(--text-tertiary)] truncate",children:[n.username," \xb7 ",n.role]}),(0,i.jsxs)("button",{onClick:t,className:"flex items-center gap-3 px-3 py-2 rounded-lg text-sm text-[var(--text-tertiary)] hover:text-red-400 hover:bg-red-500/5 w-full transition-all duration-150",children:[(0,i.jsx)(F.Z,{size:18}),!s&&"Logout"]})]})]})}function q(){return(0,i.jsx)("a",{href:"/login",className:"nx-fallback","data-fallback-link":!0,children:"Continue to sign in →"})}function K(e){let{children:t}=e,{isAuthenticated:n,loading:l}=(0,o.a)(),s=(0,r.usePathname)();return(a.useEffect(()=>{if(!l&&!n&&"/login"!==s)try{window.location.replace("/login")}catch(e){window.location.href="/login"}},[l,n,s]),l||!n&&"/login"!==s)?(0,i.jsxs)("div",{className:"nx-spinner-wrap",children:[(0,i.jsx)("div",{className:"nx-spinner"}),(0,i.jsx)(q,{})]}):"/login"===s?(0,i.jsx)(i.Fragment,{children:t}):(0,i.jsxs)("div",{className:"flex h-screen overflow-hidden",style:{background:"#0a0a0a"},children:[(0,i.jsx)(D,{}),(0,i.jsx)("main",{className:"flex-1 overflow-y-auto p-6 lg:p-8",children:t})]})}function J(e){let{children:t}=e;return(0,i.jsxs)("html",{lang:"en",children:[(0,i.jsxs)("head",{children:[(0,i.jsx)("meta",{charSet:"utf-8"}),(0,i.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1"}),(0,i.jsx)("meta",{name:"theme-color",content:"#0a0a0a"}),(0,i.jsx)("meta",{name:"color-scheme",content:"dark"}),(0,i.jsx)("title",{children:"NexusAI Gateway"}),(0,i.jsx)("link",{rel:"icon",href:"/favicon.svg",type:"image/svg+xml"}),(0,i.jsx)("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),(0,i.jsx)("link",{href:"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap",rel:"stylesheet"}),(0,i.jsx)("style",{dangerouslySetInnerHTML:{__html:"html,body{margin:0;padding:0;background:#0a0a0a;color:#fff;font-family:Inter,system-ui,-apple-system,sans-serif;-webkit-font-smoothing:antialiased}*{box-sizing:border-box}.nx-spinner-wrap{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#0a0a0a;position:relative;padding:24px}.nx-spinner{width:32px;height:32px;border:2px solid #f97316;border-top-color:transparent;border-radius:50%;animation:nx-spin 1s linear infinite}@keyframes nx-spin{to{transform:rotate(1turn)}}.nx-noscript{padding:32px;text-align:center;max-width:480px;margin:80px auto;color:#a1a1a1}.nx-noscript h1{color:#fff;font-size:20px;margin:0 0 8px}.nx-noscript a{color:#f97316}.nx-fallback{display:inline-block;margin-top:24px;padding:10px 20px;background:#f97316;color:#fff;border-radius:8px;font-size:14px;text-decoration:none;font-family:Inter,system-ui,sans-serif;font-weight:500}.nx-fallback:hover{background:#ea580c}"},"data-critical":!0}),(0,i.jsx)("script",{dangerouslySetInnerHTML:{__html:"(function(){try{var p=window.location.pathname;if(p==='/login'||p==='/login.html')return;if(p.indexOf('/_next/')===0)return;if(p==='/favicon.svg'||p==='/icon.svg')return;if(p==='/health')return;var t=null;try{t=localStorage.getItem('nexus_token')}catch(e){}if(!t){var d='/login';try{window.location.replace(d)}catch(e){window.location.href=d}return}setTimeout(function(){try{var c=localStorage.getItem('nexus_token');if(!c){window.location.replace('/login')}}catch(e){}},8000)})();"},"data-auth-guard":!0})]}),(0,i.jsxs)("body",{className:"bg-[var(--bg)] text-white",style:{background:"#0a0a0a",color:"#fff",margin:0},children:[(0,i.jsx)("noscript",{children:(0,i.jsxs)("div",{className:"nx-noscript",children:[(0,i.jsx)("h1",{children:"JavaScript is required"}),(0,i.jsxs)("p",{children:["NexusAI Gateway is a single-page application. Please enable JavaScript or visit ",(0,i.jsx)("a",{href:"/login",children:"/login"})," after enabling it."]})]})}),(0,i.jsxs)("div",{className:"nx-spinner-wrap","data-static-fallback":!0,children:[(0,i.jsx)("div",{className:"nx-spinner"}),(0,i.jsx)("a",{href:"/login",className:"nx-fallback","data-fallback-link":!0,children:"Continue to sign in →"})]}),(0,i.jsx)(o.H,{children:(0,i.jsx)(K,{children:t})})]})]})}n(2778)},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return d},hi:function(){return h},jl:function(){return o},qz:function(){return r}});let i=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function r(){localStorage.removeItem("nexus_token")}function o(){return!!a()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},s=new Map,c=new Map;async function f(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",o=a(),f={"Content-Type":"application/json",...t.headers};if(o&&(f.Authorization="Bearer ".concat(o)),"GET"===n&&!o){let t=function(e){let t=s.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){s.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=c.get(e);if(n)return n}let h=(async()=>{let a=await fetch("".concat(i).concat(e),{method:n,headers:f,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&o&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw r(),s.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let l=await a.json();return"GET"!==n||o||function(e,t){if(s.size>=200){let e=s.keys().next().value;void 0!==e&&s.delete(e)}s.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===n&&!o){c.set(e,h);try{return await h}finally{c.delete(e)}}return h}let h={get:e=>f(e),post:(e,t)=>f(e,{method:"POST",body:t}),put:(e,t)=>f(e,{method:"PUT",body:t}),patch:(e,t)=>f(e,{method:"PATCH",body:t}),delete:e=>f(e,{method:"DELETE"}),login:async(e,t)=>{var n;let i=await f("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=i.access_token,localStorage.setItem("nexus_token",n),i},getMe:()=>f("/api/auth/me"),logout:()=>{r(),s.clear(),window.location.href="/login"}},d=async e=>{let t=a(),n=await fetch("".concat(i).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let r=await n.blob(),o=URL.createObjectURL(r),l=document.createElement("a");l.href=o,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(o)}},5389:function(e,t,n){"use strict";n.d(t,{H:function(){return l},a:function(){return s}});var i=n(7437),a=n(2265),r=n(1837);let o=(0,a.createContext)({user:null,loading:!0,login:async()=>{},logout:()=>{},isAuthenticated:!1});function l(e){let{children:t}=e,[n,l]=(0,a.useState)(null),[s,c]=(0,a.useState)(!0);(0,a.useEffect)(()=>{if((0,r.jl)()){let e=setTimeout(()=>{c(!1)},5e3);r.hi.getMe().then(l).catch(()=>{(0,r.qz)(),l(null)}).finally(()=>{clearTimeout(e),c(!1)})}else c(!1)},[]);let f=async(e,t)=>{await r.hi.login(e,t),l(await r.hi.getMe())};return(0,i.jsx)(o.Provider,{value:{user:n,loading:s,login:f,logout:()=>{(0,r.qz)(),l(null),window.location.href="/login"},isAuthenticated:!!n},children:t})}let s=()=>(0,a.useContext)(o)},2778:function(){}},function(e){e.O(0,[2461,7593,2971,2117,1744],function(){return e(e.s=8624)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/login/page-4c7d6e8163bf093b.js b/static/_next/static/chunks/app/login/page-4c7d6e8163bf093b.js deleted file mode 100644 index 70b5b24c06e527b40d785b69d8a8cfca1057ddf2..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/login/page-4c7d6e8163bf093b.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2626],{9144:function(e,t,n){Promise.resolve().then(n.bind(n,8991))},9376:function(e,t,n){"use strict";var r=n(5475);n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var u=[],l=!1,c=-1;function d(){l&&r&&(l=!1,r.length?u=r.concat(u):c=-1,u.length&&f())}function f(){if(!l){var e=s(d);l=!0;for(var t=u.length;t;){for(r=u,u=[];++c1)for(var n=1;n{t.preventDefault(),l(""),d(!0);try{await f(e,n),h.replace("/")}catch(e){l(e instanceof Error?e.message:"Login failed")}finally{d(!1)}};return(0,r.jsx)("div",{className:"h-screen flex items-center justify-center p-4",style:{background:"#0a0a0a"},children:(0,r.jsxs)("div",{className:"w-full max-w-sm",children:[(0,r.jsxs)("div",{className:"text-center mb-8",children:[(0,r.jsx)("div",{className:"w-12 h-12 bg-nexus-500 rounded-xl flex items-center justify-center text-xl font-black text-white mx-auto mb-4",children:"N"}),(0,r.jsx)("h1",{className:"text-xl font-bold",children:"NexusAI"}),(0,r.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:"Self-hosted AI API Gateway"})]}),(0,r.jsxs)("form",{onSubmit:p,className:"card space-y-4",children:[m&&(0,r.jsx)("div",{className:"text-sm text-yellow-300 bg-yellow-500/10 border border-yellow-500/20 rounded-lg px-3 py-2",children:"Your session has expired. Please sign in again."}),u&&(0,r.jsx)("div",{className:"text-sm text-red-400 bg-red-500/10 rounded-lg px-3 py-2",children:u}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Username"}),(0,r.jsx)("input",{className:"input",value:e,onChange:e=>t(e.target.value),placeholder:"admin",autoComplete:"username",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Password"}),(0,r.jsx)("input",{className:"input",type:"password",value:n,onChange:e=>s(e.target.value),placeholder:"••••••••",autoComplete:"current-password"})]}),(0,r.jsx)("button",{type:"submit",disabled:c,className:"btn-primary w-full justify-center py-2.5 disabled:opacity-50",children:c?(0,r.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):"Sign in"}),(0,r.jsx)("p",{className:"text-xs text-center text-[var(--text-tertiary)]",children:"Default: admin / nexus1234"})]})]})})}function u(){return(0,r.jsx)(a.Suspense,{fallback:(0,r.jsx)("div",{className:"h-screen",style:{background:"#0a0a0a"}}),children:(0,r.jsx)(s,{})})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return f},hi:function(){return d},jl:function(){return o},qz:function(){return i}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function o(){return!!a()}let s={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},u=new Map,l=new Map;async function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",o=a(),c={"Content-Type":"application/json",...t.headers};if(o&&(c.Authorization="Bearer ".concat(o)),"GET"===n&&!o){let t=function(e){let t=u.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in s)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return s[t];return 5e3}(e)){u.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:c,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&o&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),u.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let s=await a.json();return"GET"!==n||o||function(e,t){if(u.size>=200){let e=u.keys().next().value;void 0!==e&&u.delete(e)}u.set(e,{ts:Date.now(),data:t})}(e,s),s})();if("GET"===n&&!o){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>c(e),post:(e,t)=>c(e,{method:"POST",body:t}),put:(e,t)=>c(e,{method:"PUT",body:t}),patch:(e,t)=>c(e,{method:"PATCH",body:t}),delete:e=>c(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await c("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>c("/api/auth/me"),logout:()=>{i(),u.clear(),window.location.href="/login"}},f=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let i=await n.blob(),o=URL.createObjectURL(i),s=document.createElement("a");s.href=o,s.download=e.split("/").pop()||"export.csv",s.click(),URL.revokeObjectURL(o)}},5389:function(e,t,n){"use strict";n.d(t,{H:function(){return s},a:function(){return u}});var r=n(7437),a=n(2265),i=n(1837);let o=(0,a.createContext)({user:null,loading:!0,login:async()=>{},logout:()=>{},isAuthenticated:!1});function s(e){let{children:t}=e,[n,s]=(0,a.useState)(null),[u,l]=(0,a.useState)(!0);(0,a.useEffect)(()=>{if((0,i.jl)()){let e=setTimeout(()=>{l(!1)},5e3);i.hi.getMe().then(s).catch(()=>{(0,i.qz)(),s(null)}).finally(()=>{clearTimeout(e),l(!1)})}else l(!1)},[]);let c=async(e,t)=>{await i.hi.login(e,t),s(await i.hi.getMe())};return(0,r.jsx)(o.Provider,{value:{user:n,loading:u,login:c,logout:()=>{(0,i.qz)(),s(null),window.location.href="/login"},isAuthenticated:!!n},children:t})}let u=()=>(0,a.useContext)(o)}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=9144)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/login/page-d39f19c4459b9ac3.js b/static/_next/static/chunks/app/login/page-d39f19c4459b9ac3.js deleted file mode 100644 index b58b9b68fdcb3bcf7f1f5327fcdeceba72229977..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/login/page-d39f19c4459b9ac3.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2626],{9144:function(e,t,n){Promise.resolve().then(n.bind(n,8991))},9376:function(e,t,n){"use strict";var r=n(5475);n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function o(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var u=[],l=!1,c=-1;function d(){l&&r&&(l=!1,r.length?u=r.concat(u):c=-1,u.length&&f())}function f(){if(!l){var e=s(d);l=!0;for(var t=u.length;t;){for(r=u,u=[];++c1)for(var n=1;n{t.preventDefault(),l(""),d(!0);try{await f(e,n),h.replace("/")}catch(e){l(e instanceof Error?e.message:"Login failed")}finally{d(!1)}};return(0,r.jsx)("div",{className:"h-screen flex items-center justify-center p-4",style:{background:"#0a0a0a"},children:(0,r.jsxs)("div",{className:"w-full max-w-sm",children:[(0,r.jsxs)("div",{className:"text-center mb-8",children:[(0,r.jsx)("div",{className:"w-12 h-12 bg-nexus-500 rounded-xl flex items-center justify-center text-xl font-black text-white mx-auto mb-4",children:"N"}),(0,r.jsx)("h1",{className:"text-xl font-bold",children:"NexusAI"}),(0,r.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:"Self-hosted AI API Gateway"})]}),(0,r.jsxs)("form",{onSubmit:p,className:"card space-y-4",children:[m&&(0,r.jsx)("div",{className:"text-sm text-yellow-300 bg-yellow-500/10 border border-yellow-500/20 rounded-lg px-3 py-2",children:"Your session has expired. Please sign in again."}),u&&(0,r.jsx)("div",{className:"text-sm text-red-400 bg-red-500/10 rounded-lg px-3 py-2",children:u}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Username"}),(0,r.jsx)("input",{className:"input",value:e,onChange:e=>t(e.target.value),placeholder:"admin",autoComplete:"username",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Password"}),(0,r.jsx)("input",{className:"input",type:"password",value:n,onChange:e=>s(e.target.value),placeholder:"••••••••",autoComplete:"current-password"})]}),(0,r.jsx)("button",{type:"submit",disabled:c,className:"btn-primary w-full justify-center py-2.5 disabled:opacity-50",children:c?(0,r.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):"Sign in"}),(0,r.jsx)("p",{className:"text-xs text-center text-[var(--text-tertiary)]",children:"Default: admin / nexus1234"})]})]})})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return f},hi:function(){return d},jl:function(){return i},qz:function(){return o}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function o(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let s={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},u=new Map,l=new Map;async function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=a(),c={"Content-Type":"application/json",...t.headers};if(i&&(c.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=u.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in s)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return s[t];return 5e3}(e)){u.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:c,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw o(),u.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let s=await a.json();return"GET"!==n||i||function(e,t){if(u.size>=200){let e=u.keys().next().value;void 0!==e&&u.delete(e)}u.set(e,{ts:Date.now(),data:t})}(e,s),s})();if("GET"===n&&!i){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>c(e),post:(e,t)=>c(e,{method:"POST",body:t}),put:(e,t)=>c(e,{method:"PUT",body:t}),patch:(e,t)=>c(e,{method:"PATCH",body:t}),delete:e=>c(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await c("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>c("/api/auth/me"),logout:()=>{o(),u.clear(),window.location.href="/login"}},f=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let o=await n.blob(),i=URL.createObjectURL(o),s=document.createElement("a");s.href=i,s.download=e.split("/").pop()||"export.csv",s.click(),URL.revokeObjectURL(i)}},5389:function(e,t,n){"use strict";n.d(t,{H:function(){return s},a:function(){return u}});var r=n(7437),a=n(2265),o=n(1837);let i=(0,a.createContext)({user:null,loading:!0,login:async()=>{},logout:()=>{},isAuthenticated:!1});function s(e){let{children:t}=e,[n,s]=(0,a.useState)(null),[u,l]=(0,a.useState)(!0);(0,a.useEffect)(()=>{if((0,o.jl)()){let e=setTimeout(()=>{l(!1)},5e3);o.hi.getMe().then(s).catch(()=>{(0,o.qz)(),s(null)}).finally(()=>{clearTimeout(e),l(!1)})}else l(!1)},[]);let c=async(e,t)=>{await o.hi.login(e,t),s(await o.hi.getMe())};return(0,r.jsx)(i.Provider,{value:{user:n,loading:u,login:c,logout:()=>{(0,o.qz)(),s(null),window.location.href="/login"},isAuthenticated:!!n},children:t})}let u=()=>(0,a.useContext)(i)}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=9144)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/login/page-f6080b011a358229.js b/static/_next/static/chunks/app/login/page-f6080b011a358229.js new file mode 100644 index 0000000000000000000000000000000000000000..d66cf6c055b2b767dbd6589280552daaf7387839 --- /dev/null +++ b/static/_next/static/chunks/app/login/page-f6080b011a358229.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2626],{9144:function(e,t,n){Promise.resolve().then(n.bind(n,8991))},9376:function(e,t,n){"use strict";var r=n(5475);n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function o(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var c=[],u=!1,l=-1;function d(){u&&r&&(u=!1,r.length?c=r.concat(c):l=-1,c.length&&f())}function f(){if(!u){var e=s(d);u=!0;for(var t=c.length;t;){for(r=c,c=[];++l1)for(var n=1;n{t.preventDefault(),u(""),d(!0);try{await f(e,n),h.replace("/")}catch(e){u(e instanceof Error?e.message:"Login failed")}finally{d(!1)}};return(0,r.jsx)("div",{className:"h-screen flex items-center justify-center p-4",style:{background:"#0a0a0a"},children:(0,r.jsxs)("div",{className:"w-full max-w-sm",children:[(0,r.jsxs)("div",{className:"text-center mb-8",children:[(0,r.jsx)("div",{className:"w-12 h-12 bg-nexus-500 rounded-xl flex items-center justify-center text-xl font-black text-white mx-auto mb-4",children:"N"}),(0,r.jsx)("h1",{className:"text-xl font-bold",children:"NexusAI"}),(0,r.jsx)("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:"Self-hosted AI API Gateway"})]}),(0,r.jsxs)("form",{onSubmit:p,className:"card space-y-4",children:[m&&(0,r.jsx)("div",{className:"text-sm text-yellow-300 bg-yellow-500/10 border border-yellow-500/20 rounded-lg px-3 py-2",children:"Your session has expired. Please sign in again."}),c&&(0,r.jsx)("div",{className:"text-sm text-red-400 bg-red-500/10 rounded-lg px-3 py-2",children:c}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Username"}),(0,r.jsx)("input",{className:"input",value:e,onChange:e=>t(e.target.value),placeholder:"admin",autoComplete:"username",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Password"}),(0,r.jsx)("input",{className:"input",type:"password",value:n,onChange:e=>s(e.target.value),placeholder:"••••••••",autoComplete:"current-password"})]}),(0,r.jsx)("button",{type:"submit",disabled:l,className:"btn-primary w-full justify-center py-2.5 disabled:opacity-50",children:l?(0,r.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):"Sign in"}),(0,r.jsx)("p",{className:"text-xs text-center text-[var(--text-tertiary)]",children:"Default: admin / nexus1234"})]})]})})}function c(){return(0,r.jsx)(a.Suspense,{fallback:(0,r.jsx)("div",{className:"h-screen",style:{background:"#0a0a0a"}}),children:(0,r.jsx)(s,{})})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return f},hi:function(){return d},jl:function(){return i},qz:function(){return o}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function o(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!a()}let s={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,u=new Map;async function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=a(),l={"Content-Type":"application/json",...t.headers};if(i&&(l.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in s)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return s[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=u.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:l,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw o(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let s=await a.json();return"GET"!==n||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,s),s})();if("GET"===n&&!i){u.set(e,d);try{return await d}finally{u.delete(e)}}return d}let d={get:e=>l(e),post:(e,t)=>l(e,{method:"POST",body:t}),put:(e,t)=>l(e,{method:"PUT",body:t}),patch:(e,t)=>l(e,{method:"PATCH",body:t}),delete:e=>l(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await l("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>l("/api/auth/me"),logout:()=>{o(),c.clear(),window.location.href="/login"}},f=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let o=await n.blob(),i=URL.createObjectURL(o),s=document.createElement("a");s.href=i,s.download=e.split("/").pop()||"export.csv",s.click(),URL.revokeObjectURL(i)}},5389:function(e,t,n){"use strict";n.d(t,{H:function(){return s},a:function(){return c}});var r=n(7437),a=n(2265),o=n(1837);let i=(0,a.createContext)({user:null,loading:!0,login:async()=>{},logout:()=>{},isAuthenticated:!1});function s(e){let{children:t}=e,[n,s]=(0,a.useState)(null),[c,u]=(0,a.useState)(!0);(0,a.useEffect)(()=>{if((0,o.jl)()){let e=setTimeout(()=>{u(!1)},5e3);o.hi.getMe().then(s).catch(()=>{(0,o.qz)(),s(null)}).finally(()=>{clearTimeout(e),u(!1)})}else u(!1)},[]);let l=async(e,t)=>{await o.hi.login(e,t),s(await o.hi.getMe())};return(0,r.jsx)(i.Provider,{value:{user:n,loading:c,login:l,logout:()=>{(0,o.qz)(),s(null),window.location.href="/login"},isAuthenticated:!!n},children:t})}let c=()=>(0,a.useContext)(i)}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=9144)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/middleware/page-0a367244a83d6dfc.js b/static/_next/static/chunks/app/middleware/page-0a367244a83d6dfc.js new file mode 100644 index 0000000000000000000000000000000000000000..3d647cdfdca119559169d66a9f0887fcf6d6fdf9 --- /dev/null +++ b/static/_next/static/chunks/app/middleware/page-0a367244a83d6dfc.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7047],{4149:function(e,t,n){Promise.resolve().then(n.bind(n,3794))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:n,strokeWidth:c?24*Number(o)/Number(a):o,className:i("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,s)=>{let{className:c,...l}=n;return(0,r.createElement)(o,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),c),...l})});return n.displayName="".concat(e),n}},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8906:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var c=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?c=r.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(r=c,c=[];++u1)for(var n=1;n{c(!0),i.hi.get("/api/transformers").then(t).catch(()=>t([])).finally(()=>c(!1))};(0,a.useEffect)(()=>{p()},[]);let x=async e=>{await i.hi.patch("/api/transformers/".concat(e,"/toggle")),p()},g=async e=>{confirm("Delete this transformer?")&&(await i.hi.delete("/api/transformers/".concat(e)),p())},v=async()=>{if(m.name&&m.transform_type)try{await i.hi.post("/api/transformers",m),h(!1),f({name:"",description:"",trigger_pattern:"*",transform_type:"",priority:0}),p()}catch(e){u(e instanceof Error?e.message:"Failed")}};return a.useEffect(()=>{if(l){let e=setTimeout(()=>u(""),3e3);return()=>clearTimeout(e)}},[l]),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Middleware"}),(0,r.jsx)("p",{className:"page-sub",children:"Request transformation and filtering pipelines"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>h(!0),children:[(0,r.jsx)(s.Z,{size:16})," Add Transformer"]})]}),d&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>h(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Transformer"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name"}),(0,r.jsx)("input",{className:"input",value:m.name,onChange:e=>f(t=>({...t,name:e.target.value})),autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Description"}),(0,r.jsx)("input",{className:"input",value:m.description,onChange:e=>f(t=>({...t,description:e.target.value}))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Trigger Pattern (e.g. gpt-4*)"}),(0,r.jsx)("input",{className:"input",value:m.trigger_pattern,onChange:e=>f(t=>({...t,trigger_pattern:e.target.value})),placeholder:"*"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Transform Type"}),(0,r.jsxs)("select",{className:"select",value:m.transform_type,onChange:e=>f(t=>({...t,transform_type:e.target.value})),children:[(0,r.jsx)("option",{value:"",children:"Select type"}),(0,r.jsx)("option",{value:"inject_system_prompt",children:"Inject System Prompt"}),(0,r.jsx)("option",{value:"mask_content",children:"Mask Content"}),(0,r.jsx)("option",{value:"moderate",children:"Moderate"}),(0,r.jsx)("option",{value:"redact",children:"Redact"}),(0,r.jsx)("option",{value:"custom",children:"Custom"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Priority (higher = runs first)"}),(0,r.jsx)("input",{className:"input",type:"number",value:m.priority,onChange:e=>f(t=>({...t,priority:Number(e.target.value)}))})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:v,children:"Create"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>h(!1),children:"Cancel"})]})]})]})}),n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-24 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No transformers configured."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Type"}),(0,r.jsx)("th",{children:"Pattern"}),(0,r.jsx)("th",{children:"Priority"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium",children:e.name}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"badge-blue",children:e.transform_type})}),(0,r.jsx)("td",{children:(0,r.jsx)("code",{className:"text-xs font-mono bg-surface-100 px-2 py-0.5 rounded",children:e.trigger_pattern})}),(0,r.jsx)("td",{children:e.priority}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>x(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsx)("button",{onClick:()=>g(e.id),className:"btn-danger btn-xs",children:"\xd7"})})]},e.id))})]})})}),l&&(0,r.jsx)("div",{className:"toast",children:l})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return s},qz:function(){return i}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function i(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function s(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",s=a(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===n&&!s){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==n||s||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===n&&!s){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>u("/api/auth/me"),logout:()=>{i(),c.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let i=await n.blob(),s=URL.createObjectURL(i),o=document.createElement("a");o.href=s,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=4149)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/middleware/page-1d63a55fd2dd0992.js b/static/_next/static/chunks/app/middleware/page-1d63a55fd2dd0992.js deleted file mode 100644 index 2825d5f1cde95aa46a88c38b3a4748d0a6604ade..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/middleware/page-1d63a55fd2dd0992.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7047],{4149:function(e,t,r){Promise.resolve().then(r.bind(r,3794))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:r,strokeWidth:c?24*Number(o)/Number(a):o,className:i("lucide",l),...h},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:c,...l}=r;return(0,n.createElement)(o,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),c),...l})});return r.displayName="".concat(e),r}},9397:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8906:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c=[],l=!1,u=-1;function d(){l&&n&&(l=!1,n.length?c=n.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(n=c,c=[];++u1)for(var r=1;r{c(!0),i.hi.get("/api/transformers").then(t).catch(()=>t([])).finally(()=>c(!1))};(0,a.useEffect)(()=>{m()},[]);let x=async e=>{await i.hi.patch("/api/transformers/".concat(e,"/toggle")),m()},g=async e=>{confirm("Delete this transformer?")&&(await i.hi.delete("/api/transformers/".concat(e)),m())},v=async()=>{if(f.name&&f.transform_type)try{await i.hi.post("/api/transformers",f),h(!1),p({name:"",description:"",trigger_pattern:"*",transform_type:"",priority:0}),m()}catch(e){u(e instanceof Error?e.message:"Failed")}};return a.useEffect(()=>{if(l){let e=setTimeout(()=>u(""),3e3);return()=>clearTimeout(e)}},[l]),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Middleware"}),(0,n.jsx)("p",{className:"page-sub",children:"Request transformation and filtering pipelines"})]}),(0,n.jsxs)("button",{className:"btn-primary",onClick:()=>h(!0),children:[(0,n.jsx)(s.Z,{size:16})," Add Transformer"]})]}),d&&(0,n.jsx)("div",{className:"modal-overlay",onClick:()=>h(!1),children:(0,n.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Transformer"}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Name"}),(0,n.jsx)("input",{className:"input",value:f.name,onChange:e=>p(t=>({...t,name:e.target.value})),autoFocus:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Description"}),(0,n.jsx)("input",{className:"input",value:f.description,onChange:e=>p(t=>({...t,description:e.target.value}))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Trigger Pattern (e.g. gpt-4*)"}),(0,n.jsx)("input",{className:"input",value:f.trigger_pattern,onChange:e=>p(t=>({...t,trigger_pattern:e.target.value})),placeholder:"*"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Transform Type"}),(0,n.jsxs)("select",{className:"select",value:f.transform_type,onChange:e=>p(t=>({...t,transform_type:e.target.value})),children:[(0,n.jsx)("option",{value:"",children:"Select type"}),(0,n.jsx)("option",{value:"inject_system_prompt",children:"Inject System Prompt"}),(0,n.jsx)("option",{value:"mask_content",children:"Mask Content"}),(0,n.jsx)("option",{value:"moderate",children:"Moderate"}),(0,n.jsx)("option",{value:"redact",children:"Redact"}),(0,n.jsx)("option",{value:"custom",children:"Custom"})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Priority (higher = runs first)"}),(0,n.jsx)("input",{className:"input",type:"number",value:f.priority,onChange:e=>p(t=>({...t,priority:Number(e.target.value)}))})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:v,children:"Create"}),(0,n.jsx)("button",{className:"btn-ghost",onClick:()=>h(!1),children:"Cancel"})]})]})]})}),r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-24 w-full"})}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No transformers configured."})]}):(0,n.jsx)("div",{className:"card p-0",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Name"}),(0,n.jsx)("th",{children:"Type"}),(0,n.jsx)("th",{children:"Pattern"}),(0,n.jsx)("th",{children:"Priority"}),(0,n.jsx)("th",{children:"Status"}),(0,n.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,n.jsx)("tbody",{children:e.map(e=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"font-medium",children:e.name}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"badge-blue",children:e.transform_type})}),(0,n.jsx)("td",{children:(0,n.jsx)("code",{className:"text-xs font-mono bg-surface-100 px-2 py-0.5 rounded",children:e.trigger_pattern})}),(0,n.jsx)("td",{children:e.priority}),(0,n.jsx)("td",{children:(0,n.jsx)("button",{onClick:()=>x(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsx)("button",{onClick:()=>g(e.id),className:"btn-danger btn-xs",children:"\xd7"})})]},e.id))})]})})}),l&&(0,n.jsx)("div",{className:"toast",children:l})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return s},qz:function(){return i}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function s(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",s=a(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===r&&!s){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=l.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==r||s||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===r&&!s){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{i(),c.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let i=await r.blob(),s=URL.createObjectURL(i),o=document.createElement("a");o.href=s,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=4149)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/middleware/page-90a9795296d289fa.js b/static/_next/static/chunks/app/middleware/page-90a9795296d289fa.js deleted file mode 100644 index 2825d5f1cde95aa46a88c38b3a4748d0a6604ade..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/middleware/page-90a9795296d289fa.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7047],{4149:function(e,t,r){Promise.resolve().then(r.bind(r,3794))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:r,strokeWidth:c?24*Number(o)/Number(a):o,className:i("lucide",l),...h},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:c,...l}=r;return(0,n.createElement)(o,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),c),...l})});return r.displayName="".concat(e),r}},9397:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8906:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c=[],l=!1,u=-1;function d(){l&&n&&(l=!1,n.length?c=n.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(n=c,c=[];++u1)for(var r=1;r{c(!0),i.hi.get("/api/transformers").then(t).catch(()=>t([])).finally(()=>c(!1))};(0,a.useEffect)(()=>{m()},[]);let x=async e=>{await i.hi.patch("/api/transformers/".concat(e,"/toggle")),m()},g=async e=>{confirm("Delete this transformer?")&&(await i.hi.delete("/api/transformers/".concat(e)),m())},v=async()=>{if(f.name&&f.transform_type)try{await i.hi.post("/api/transformers",f),h(!1),p({name:"",description:"",trigger_pattern:"*",transform_type:"",priority:0}),m()}catch(e){u(e instanceof Error?e.message:"Failed")}};return a.useEffect(()=>{if(l){let e=setTimeout(()=>u(""),3e3);return()=>clearTimeout(e)}},[l]),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Middleware"}),(0,n.jsx)("p",{className:"page-sub",children:"Request transformation and filtering pipelines"})]}),(0,n.jsxs)("button",{className:"btn-primary",onClick:()=>h(!0),children:[(0,n.jsx)(s.Z,{size:16})," Add Transformer"]})]}),d&&(0,n.jsx)("div",{className:"modal-overlay",onClick:()=>h(!1),children:(0,n.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Transformer"}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Name"}),(0,n.jsx)("input",{className:"input",value:f.name,onChange:e=>p(t=>({...t,name:e.target.value})),autoFocus:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Description"}),(0,n.jsx)("input",{className:"input",value:f.description,onChange:e=>p(t=>({...t,description:e.target.value}))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Trigger Pattern (e.g. gpt-4*)"}),(0,n.jsx)("input",{className:"input",value:f.trigger_pattern,onChange:e=>p(t=>({...t,trigger_pattern:e.target.value})),placeholder:"*"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Transform Type"}),(0,n.jsxs)("select",{className:"select",value:f.transform_type,onChange:e=>p(t=>({...t,transform_type:e.target.value})),children:[(0,n.jsx)("option",{value:"",children:"Select type"}),(0,n.jsx)("option",{value:"inject_system_prompt",children:"Inject System Prompt"}),(0,n.jsx)("option",{value:"mask_content",children:"Mask Content"}),(0,n.jsx)("option",{value:"moderate",children:"Moderate"}),(0,n.jsx)("option",{value:"redact",children:"Redact"}),(0,n.jsx)("option",{value:"custom",children:"Custom"})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Priority (higher = runs first)"}),(0,n.jsx)("input",{className:"input",type:"number",value:f.priority,onChange:e=>p(t=>({...t,priority:Number(e.target.value)}))})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:v,children:"Create"}),(0,n.jsx)("button",{className:"btn-ghost",onClick:()=>h(!1),children:"Cancel"})]})]})]})}),r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-24 w-full"})}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No transformers configured."})]}):(0,n.jsx)("div",{className:"card p-0",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Name"}),(0,n.jsx)("th",{children:"Type"}),(0,n.jsx)("th",{children:"Pattern"}),(0,n.jsx)("th",{children:"Priority"}),(0,n.jsx)("th",{children:"Status"}),(0,n.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,n.jsx)("tbody",{children:e.map(e=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"font-medium",children:e.name}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"badge-blue",children:e.transform_type})}),(0,n.jsx)("td",{children:(0,n.jsx)("code",{className:"text-xs font-mono bg-surface-100 px-2 py-0.5 rounded",children:e.trigger_pattern})}),(0,n.jsx)("td",{children:e.priority}),(0,n.jsx)("td",{children:(0,n.jsx)("button",{onClick:()=>x(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsx)("button",{onClick:()=>g(e.id),className:"btn-danger btn-xs",children:"\xd7"})})]},e.id))})]})})}),l&&(0,n.jsx)("div",{className:"toast",children:l})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return s},qz:function(){return i}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function s(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",s=a(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===r&&!s){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=l.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==r||s||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===r&&!s){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{i(),c.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let i=await r.blob(),s=URL.createObjectURL(i),o=document.createElement("a");o.href=s,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=4149)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/models/page-83431fc35a0305c1.js b/static/_next/static/chunks/app/models/page-83431fc35a0305c1.js deleted file mode 100644 index dfa11cbd99a1dd81ece8932d45527b8d822afa20..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/models/page-83431fc35a0305c1.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4954],{2326:function(e,t,r){Promise.resolve().then(r.bind(r,2697))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:c="",children:u,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:r,strokeWidth:l?24*Number(o)/Number(a):o,className:i("lucide",c),...h},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),l=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:l,...c}=r;return(0,n.createElement)(o,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),l),...c})});return r.displayName="".concat(e),r}},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var l=[],c=!1,u=-1;function d(){c&&n&&(c=!1,n.length?l=n.concat(l):u=-1,l.length&&h())}function h(){if(!c){var e=o(d);c=!0;for(var t=l.length;t;){for(n=l,l=[];++u1)for(var r=1;r{l(!0),u("");let e=new URLSearchParams;d&&e.set("search",d),p&&e.set("provider",p),e.set("sort_by","name"),i.hi.get("/api/catalog?".concat(e)).then(t).catch(e=>u(e instanceof Error?e.message:"Failed to load models")).finally(()=>l(!1))},[d,p]),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Models"}),(0,n.jsx)("p",{className:"page-sub",children:"Model catalog from all providers"})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("input",{className:"input max-w-xs",placeholder:"Search models...",value:d,onChange:e=>f(()=>h(e.target.value))}),e&&e.providers.length>0&&(0,n.jsxs)("select",{className:"select max-w-[160px]",value:p,onChange:e=>f(()=>x(e.target.value)),children:[(0,n.jsx)("option",{value:"",children:"All providers"}),e.providers.map(e=>(0,n.jsxs)("option",{value:e.name,children:[e.name," (",e.count,")"]},e.name))]})]})]}),c?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(s.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,n.jsx)("p",{className:"text-red-400",children:c})]}):r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})}):e&&0!==e.models.length?(0,n.jsxs)("div",{className:"card p-0",children:[(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Model"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Context"}),(0,n.jsx)("th",{children:"Max Output"}),(0,n.jsx)("th",{children:"Input Price"}),(0,n.jsx)("th",{children:"Output Price"}),(0,n.jsx)("th",{children:"Capabilities"})]})}),(0,n.jsx)("tbody",{children:e.models.map(e=>{var t,r;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"font-medium max-w-[240px] truncate",title:e.id,children:e.id}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"capitalize",children:e.provider})}),(0,n.jsx)("td",{className:"text-xs",children:(null===(t=e.context_window)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,n.jsx)("td",{className:"text-xs",children:(null===(r=e.max_output)||void 0===r?void 0:r.toLocaleString())||"-"}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.input_price).toFixed(6)]}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.output_price).toFixed(6)]}),(0,n.jsx)("td",{children:(0,n.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[e.is_free&&(0,n.jsx)("span",{className:"badge-green text-xs",children:"free"}),e.supports_vision&&(0,n.jsx)("span",{className:"badge-blue text-xs",children:"vision"}),e.supports_tools&&(0,n.jsx)("span",{className:"badge-yellow text-xs",children:"tools"})]})})]},e.id)})})]})}),e.pages>1&&(0,n.jsx)("div",{className:"flex items-center justify-between px-3 py-2 border-t border-[var(--border)] text-xs text-[var(--text-tertiary)]",children:(0,n.jsxs)("span",{children:["Page ",e.page," of ",e.pages," (",e.total," models)"]})})]}):(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(o,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No models found in catalog."})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return s},qz:function(){return i}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function s(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",s=a(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===r&&!s){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=c.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==r||s||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===r&&!s){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{i(),l.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let i=await r.blob(),s=URL.createObjectURL(i),o=document.createElement("a");o.href=s,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=2326)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/models/page-117eca1fbb20a433.js b/static/_next/static/chunks/app/models/page-9220ecf2972703a6.js similarity index 52% rename from static/_next/static/chunks/app/models/page-117eca1fbb20a433.js rename to static/_next/static/chunks/app/models/page-9220ecf2972703a6.js index dfa11cbd99a1dd81ece8932d45527b8d822afa20..698d7c8f6d7a7c6e3152a814acdc5944a7c7e70d 100644 --- a/static/_next/static/chunks/app/models/page-117eca1fbb20a433.js +++ b/static/_next/static/chunks/app/models/page-9220ecf2972703a6.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4954],{2326:function(e,t,r){Promise.resolve().then(r.bind(r,2697))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:c="",children:u,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:r,strokeWidth:l?24*Number(o)/Number(a):o,className:i("lucide",c),...h},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),l=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:l,...c}=r;return(0,n.createElement)(o,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),l),...c})});return r.displayName="".concat(e),r}},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var l=[],c=!1,u=-1;function d(){c&&n&&(c=!1,n.length?l=n.concat(l):u=-1,l.length&&h())}function h(){if(!c){var e=o(d);c=!0;for(var t=l.length;t;){for(n=l,l=[];++u1)for(var r=1;r{l(!0),u("");let e=new URLSearchParams;d&&e.set("search",d),p&&e.set("provider",p),e.set("sort_by","name"),i.hi.get("/api/catalog?".concat(e)).then(t).catch(e=>u(e instanceof Error?e.message:"Failed to load models")).finally(()=>l(!1))},[d,p]),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Models"}),(0,n.jsx)("p",{className:"page-sub",children:"Model catalog from all providers"})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("input",{className:"input max-w-xs",placeholder:"Search models...",value:d,onChange:e=>f(()=>h(e.target.value))}),e&&e.providers.length>0&&(0,n.jsxs)("select",{className:"select max-w-[160px]",value:p,onChange:e=>f(()=>x(e.target.value)),children:[(0,n.jsx)("option",{value:"",children:"All providers"}),e.providers.map(e=>(0,n.jsxs)("option",{value:e.name,children:[e.name," (",e.count,")"]},e.name))]})]})]}),c?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(s.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,n.jsx)("p",{className:"text-red-400",children:c})]}):r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})}):e&&0!==e.models.length?(0,n.jsxs)("div",{className:"card p-0",children:[(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Model"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Context"}),(0,n.jsx)("th",{children:"Max Output"}),(0,n.jsx)("th",{children:"Input Price"}),(0,n.jsx)("th",{children:"Output Price"}),(0,n.jsx)("th",{children:"Capabilities"})]})}),(0,n.jsx)("tbody",{children:e.models.map(e=>{var t,r;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"font-medium max-w-[240px] truncate",title:e.id,children:e.id}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"capitalize",children:e.provider})}),(0,n.jsx)("td",{className:"text-xs",children:(null===(t=e.context_window)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,n.jsx)("td",{className:"text-xs",children:(null===(r=e.max_output)||void 0===r?void 0:r.toLocaleString())||"-"}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.input_price).toFixed(6)]}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.output_price).toFixed(6)]}),(0,n.jsx)("td",{children:(0,n.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[e.is_free&&(0,n.jsx)("span",{className:"badge-green text-xs",children:"free"}),e.supports_vision&&(0,n.jsx)("span",{className:"badge-blue text-xs",children:"vision"}),e.supports_tools&&(0,n.jsx)("span",{className:"badge-yellow text-xs",children:"tools"})]})})]},e.id)})})]})}),e.pages>1&&(0,n.jsx)("div",{className:"flex items-center justify-between px-3 py-2 border-t border-[var(--border)] text-xs text-[var(--text-tertiary)]",children:(0,n.jsxs)("span",{children:["Page ",e.page," of ",e.pages," (",e.total," models)"]})})]}):(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(o,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No models found in catalog."})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return s},qz:function(){return i}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function s(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",s=a(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===r&&!s){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=c.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==r||s||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===r&&!s){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{i(),l.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let i=await r.blob(),s=URL.createObjectURL(i),o=document.createElement("a");o.href=s,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=2326)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4954],{2326:function(e,t,r){Promise.resolve().then(r.bind(r,2697))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),o=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:s=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:r,strokeWidth:c?24*Number(s)/Number(a):s,className:o("lucide",l),...h},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:c,...l}=r;return(0,n.createElement)(s,{ref:i,iconNode:t,className:o("lucide-".concat(a(e)),c),...l})});return r.displayName="".concat(e),r}},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function o(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var c=[],l=!1,u=-1;function d(){l&&n&&(l=!1,n.length?c=n.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=s(d);l=!0;for(var t=c.length;t;){for(n=c,c=[];++u1)for(var r=1;r{c(!0),u("");let e=new URLSearchParams;d&&e.set("search",d),p&&e.set("provider",p),e.set("sort_by","name"),o.hi.get("/api/catalog?".concat(e)).then(t).catch(e=>u(e instanceof Error?e.message:"Failed to load models")).finally(()=>c(!1))},[d,p]),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Models"}),(0,n.jsx)("p",{className:"page-sub",children:"Model catalog from all providers"})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("input",{className:"input max-w-xs",placeholder:"Search models...",value:d,onChange:e=>f(()=>h(e.target.value))}),e&&e.providers.length>0&&(0,n.jsxs)("select",{className:"select max-w-[160px]",value:p,onChange:e=>f(()=>x(e.target.value)),children:[(0,n.jsx)("option",{value:"",children:"All providers"}),e.providers.map(e=>(0,n.jsxs)("option",{value:e.name,children:[e.name," (",e.count,")"]},e.name))]})]})]}),l?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(i.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,n.jsx)("p",{className:"text-red-400",children:l})]}):r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})}):e&&0!==e.models.length?(0,n.jsxs)("div",{className:"card p-0",children:[(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Model"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Context"}),(0,n.jsx)("th",{children:"Max Output"}),(0,n.jsx)("th",{children:"Input Price"}),(0,n.jsx)("th",{children:"Output Price"}),(0,n.jsx)("th",{children:"Capabilities"})]})}),(0,n.jsx)("tbody",{children:e.models.map(e=>{var t,r;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"font-medium max-w-[240px] truncate",title:e.id,children:e.id}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"capitalize",children:e.provider})}),(0,n.jsx)("td",{className:"text-xs",children:(null===(t=e.context_window)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,n.jsx)("td",{className:"text-xs",children:(null===(r=e.max_output)||void 0===r?void 0:r.toLocaleString())||"-"}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.input_price).toFixed(6)]}),(0,n.jsxs)("td",{className:"text-xs font-mono",children:["$",Number(e.output_price).toFixed(6)]}),(0,n.jsx)("td",{children:(0,n.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[e.is_free&&(0,n.jsx)("span",{className:"badge-green text-xs",children:"free"}),e.supports_vision&&(0,n.jsx)("span",{className:"badge-blue text-xs",children:"vision"}),e.supports_tools&&(0,n.jsx)("span",{className:"badge-yellow text-xs",children:"tools"})]})})]},e.id)})})]})}),e.pages>1&&(0,n.jsx)("div",{className:"flex items-center justify-between px-3 py-2 border-t border-[var(--border)] text-xs text-[var(--text-tertiary)]",children:(0,n.jsxs)("span",{children:["Page ",e.page," of ",e.pages," (",e.total," models)"]})})]}):(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(s,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No models found in catalog."})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return o}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function o(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!a()}let s={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=a(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in s)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return s[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=l.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw o(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let s=await a.json();return"GET"!==r||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,s),s})();if("GET"===r&&!i){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),function(e,t,r){try{let r="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(r)}catch(e){}}("nexus_token",r,0),n},getMe:()=>u("/api/auth/me"),logout:()=>{o(),c.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let o=await r.blob(),i=URL.createObjectURL(o),s=document.createElement("a");s.href=i,s.download=e.split("/").pop()||"export.csv",s.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=2326)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/not-found-dc2902619d4ad494.js b/static/_next/static/chunks/app/not-found-dc2902619d4ad494.js deleted file mode 100644 index e19806c4ce55159fa324d52406a85c111581e215..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/not-found-dc2902619d4ad494.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9160],{4557:function(e,n,t){Promise.resolve().then(t.bind(t,5292))},5292:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return o}});var i=t(7437);function o(){return(0,i.jsx)("div",{style:{minHeight:"60vh",display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:(0,i.jsxs)("div",{style:{maxWidth:420,width:"100%",textAlign:"center"},children:[(0,i.jsx)("div",{style:{fontSize:96,fontWeight:800,lineHeight:1,color:"var(--accent)",margin:0,letterSpacing:"-0.04em"},children:"404"}),(0,i.jsx)("h1",{style:{fontSize:24,fontWeight:600,margin:"12px 0 8px",color:"var(--text)"},children:"Page not found"}),(0,i.jsx)("p",{style:{color:"var(--text-secondary)",fontSize:14,margin:"0 0 24px"},children:"The page you’re looking for doesn’t exist or has been moved."}),(0,i.jsx)("a",{href:"/",style:{display:"inline-block",background:"var(--accent)",color:"#fff",padding:"10px 20px",borderRadius:8,fontSize:14,fontWeight:500,textDecoration:"none"},children:"Go to dashboard"})]})})}t(2265)}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=4557)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/page-bbfccd1a277e7cd3.js b/static/_next/static/chunks/app/page-bbfccd1a277e7cd3.js deleted file mode 100644 index 554a0958e9a2dec891ab039fbe50c63461e0c1a4..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/page-bbfccd1a277e7cd3.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{3548:function(e,t,r){Promise.resolve().then(r.bind(r,6117))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var s=r(2265);let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,s.forwardRef)((e,t)=>{let{color:r="currentColor",size:n=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,s.createElement)("svg",{ref:t,...i,width:n,height:n,stroke:r,strokeWidth:c?24*Number(l)/Number(n):l,className:a("lucide",o),...h},[...u.map(e=>{let[t,r]=e;return(0,s.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let r=(0,s.forwardRef)((r,i)=>{let{className:c,...o}=r;return(0,s.createElement)(l,{ref:i,iconNode:t,className:a("lucide-".concat(n(e)),c),...o})});return r.displayName="".concat(e),r}},4401:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},5252:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]])},6137:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},525:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]])},1239:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},257:function(e,t,r){"use strict";var s,n;e.exports=(null==(s=r.g.process)?void 0:s.env)&&"object"==typeof(null==(n=r.g.process)?void 0:n.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,s,n=e.exports={};function a(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var c=[],o=!1,d=-1;function u(){o&&s&&(o=!1,s.length?c=s.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(s=c,c=[];++d1)for(var r=1;r{Promise.all([a.hi.get("/api/stats/dashboard"),a.hi.get("/api/uptime").catch(()=>[]),a.hi.get("/api/stats/today").catch(()=>null)]).then(e=>{let[r,s,n]=e;t(r),v(s),x(n)}).catch(e=>g(e instanceof Error?e.message:"Failed to load dashboard")).finally(()=>f(!1))},[]),p)?(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"page-header",children:(0,s.jsx)("h1",{className:"page-title",children:"Dashboard"})}),(0,s.jsxs)("div",{className:"card text-center py-12",children:[(0,s.jsx)(i.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,s.jsx)("p",{className:"text-red-400",children:p})]})]}):m||!e?(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"page-header",children:(0,s.jsx)("h1",{className:"page-title",children:"Dashboard"})}),(0,s.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[void 0,void 0,void 0,void 0].map((e,t)=>(0,s.jsx)("div",{className:"card h-24",children:(0,s.jsx)("div",{className:"skeleton h-full w-full"})},t))})]}):(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"page-header",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"page-title",children:"Dashboard"}),(0,s.jsx)("p",{className:"page-sub",children:"Real-time gateway metrics"})]}),(0,s.jsx)("button",{className:"btn-ghost btn-sm",onClick:()=>window.location.reload(),children:"↻ Refresh"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[(0,s.jsx)(h,{icon:l.Z,label:"Total Requests",value:e.total_requests.toLocaleString(),sub:"".concat(e.requests_today," today"),color:"#3b82f6"}),(0,s.jsx)(h,{icon:c.Z,label:"Total Cost",value:"$".concat(e.total_cost.toFixed(4)),sub:"$".concat(e.today_cost.toFixed(4)," today"),color:"#22c55e"}),(0,s.jsx)(h,{icon:o.Z,label:"Avg Latency",value:"".concat(Math.round(e.avg_latency_ms),"ms"),sub:"".concat(e.error_rate.toFixed(1),"% error rate"),color:"#f97316"}),(0,s.jsx)(h,{icon:d.Z,label:"Cache Hit Rate",value:"".concat(e.cache_hit_rate.toFixed(1),"%"),sub:"".concat(e.active_keys," active keys"),color:"#a855f7"})]}),r&&(0,s.jsxs)("div",{className:"card mb-8",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-3",children:"Today"}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Requests"}),(0,s.jsx)("p",{className:"text-2xl font-semibold",children:r.requests.toLocaleString()})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Cost"}),(0,s.jsxs)("p",{className:"text-2xl font-semibold",children:["$",r.cost.toFixed(4)]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Tokens"}),(0,s.jsx)("p",{className:"text-2xl font-semibold",children:r.tokens.toLocaleString()})]})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8",children:[(0,s.jsxs)("div",{className:"card lg:col-span-2",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-4",children:"Top Models"}),0===e.top_models.length?(0,s.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No data yet"}):(0,s.jsx)("div",{className:"table-wrap",children:(0,s.jsxs)("table",{children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Model"}),(0,s.jsx)("th",{children:"Requests"}),(0,s.jsx)("th",{children:"Avg Latency"}),(0,s.jsx)("th",{children:"Cost"}),(0,s.jsx)("th",{children:"Error Rate"})]})}),(0,s.jsx)("tbody",{children:e.top_models.map(e=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"font-medium",children:e.model}),(0,s.jsx)("td",{children:e.requests}),(0,s.jsxs)("td",{children:[Math.round(e.avg_latency),"ms"]}),(0,s.jsxs)("td",{children:["$",e.cost.toFixed(4)]}),(0,s.jsx)("td",{children:(0,s.jsxs)("span",{className:e.error_rate>10?"badge-red":e.error_rate>2?"badge-yellow":"badge-green",children:[e.error_rate.toFixed(1),"%"]})})]},e.model))})]})})]}),(0,s.jsxs)("div",{className:"card",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-4",children:"Provider Health"}),0===y.length?(0,s.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No health data yet"}):(0,s.jsx)("div",{className:"space-y-3",children:y.map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full ".concat("healthy"===e.last_status?"bg-green-400":"degraded"===e.last_status?"bg-yellow-400":"bg-red-400")}),(0,s.jsx)("span",{className:"text-sm capitalize",children:e.provider})]}),(0,s.jsx)("span",{className:"text-xs text-[var(--text-secondary)]",children:null!==e.uptime_pct?"".concat(e.uptime_pct.toFixed(1),"%"):"N/A"})]},e.provider))})]})]}),Object.keys(e.requests_by_provider).length>0&&(0,s.jsxs)("div",{className:"card",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-4",children:"Requests by Provider"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(e.requests_by_provider).map(e=>{let[t,r]=e;return(0,s.jsxs)("div",{className:"badge-blue flex items-center gap-2 px-3 py-1.5",children:[(0,s.jsx)(u.Z,{size:14}),(0,s.jsx)("span",{className:"capitalize",children:t}),(0,s.jsx)("span",{className:"font-medium",children:r})]},t)})})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return a}});let s=r(257).env.NEXT_PUBLIC_API_BASE||"";function n(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function i(){return!!n()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=n(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let u=(async()=>{let n=await fetch("".concat(s).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return n;if(401===n.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!n.ok)throw Error((await n.json().catch(()=>({detail:n.statusText}))).detail||"HTTP ".concat(n.status));if(204===n.status)return;let l=await n.json();return"GET"!==r||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===r&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let s=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=s.access_token,localStorage.setItem("nexus_token",r),s},getMe:()=>d("/api/auth/me"),logout:()=>{a(),c.clear(),window.location.href="/login"}},h=async e=>{let t=n(),r=await fetch("".concat(s).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let a=await r.blob(),i=URL.createObjectURL(a),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3548)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/page-4b5cd43f939ed408.js b/static/_next/static/chunks/app/page-d699e41196a151c5.js similarity index 71% rename from static/_next/static/chunks/app/page-4b5cd43f939ed408.js rename to static/_next/static/chunks/app/page-d699e41196a151c5.js index 554a0958e9a2dec891ab039fbe50c63461e0c1a4..80c2eaa07c5f744c5b1e97ad84269655ee942472 100644 --- a/static/_next/static/chunks/app/page-4b5cd43f939ed408.js +++ b/static/_next/static/chunks/app/page-d699e41196a151c5.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{3548:function(e,t,r){Promise.resolve().then(r.bind(r,6117))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var s=r(2265);let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,s.forwardRef)((e,t)=>{let{color:r="currentColor",size:n=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,s.createElement)("svg",{ref:t,...i,width:n,height:n,stroke:r,strokeWidth:c?24*Number(l)/Number(n):l,className:a("lucide",o),...h},[...u.map(e=>{let[t,r]=e;return(0,s.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let r=(0,s.forwardRef)((r,i)=>{let{className:c,...o}=r;return(0,s.createElement)(l,{ref:i,iconNode:t,className:a("lucide-".concat(n(e)),c),...o})});return r.displayName="".concat(e),r}},4401:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},5252:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]])},6137:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},525:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]])},1239:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},257:function(e,t,r){"use strict";var s,n;e.exports=(null==(s=r.g.process)?void 0:s.env)&&"object"==typeof(null==(n=r.g.process)?void 0:n.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,s,n=e.exports={};function a(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var c=[],o=!1,d=-1;function u(){o&&s&&(o=!1,s.length?c=s.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(s=c,c=[];++d1)for(var r=1;r{Promise.all([a.hi.get("/api/stats/dashboard"),a.hi.get("/api/uptime").catch(()=>[]),a.hi.get("/api/stats/today").catch(()=>null)]).then(e=>{let[r,s,n]=e;t(r),v(s),x(n)}).catch(e=>g(e instanceof Error?e.message:"Failed to load dashboard")).finally(()=>f(!1))},[]),p)?(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"page-header",children:(0,s.jsx)("h1",{className:"page-title",children:"Dashboard"})}),(0,s.jsxs)("div",{className:"card text-center py-12",children:[(0,s.jsx)(i.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,s.jsx)("p",{className:"text-red-400",children:p})]})]}):m||!e?(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"page-header",children:(0,s.jsx)("h1",{className:"page-title",children:"Dashboard"})}),(0,s.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[void 0,void 0,void 0,void 0].map((e,t)=>(0,s.jsx)("div",{className:"card h-24",children:(0,s.jsx)("div",{className:"skeleton h-full w-full"})},t))})]}):(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"page-header",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"page-title",children:"Dashboard"}),(0,s.jsx)("p",{className:"page-sub",children:"Real-time gateway metrics"})]}),(0,s.jsx)("button",{className:"btn-ghost btn-sm",onClick:()=>window.location.reload(),children:"↻ Refresh"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[(0,s.jsx)(h,{icon:l.Z,label:"Total Requests",value:e.total_requests.toLocaleString(),sub:"".concat(e.requests_today," today"),color:"#3b82f6"}),(0,s.jsx)(h,{icon:c.Z,label:"Total Cost",value:"$".concat(e.total_cost.toFixed(4)),sub:"$".concat(e.today_cost.toFixed(4)," today"),color:"#22c55e"}),(0,s.jsx)(h,{icon:o.Z,label:"Avg Latency",value:"".concat(Math.round(e.avg_latency_ms),"ms"),sub:"".concat(e.error_rate.toFixed(1),"% error rate"),color:"#f97316"}),(0,s.jsx)(h,{icon:d.Z,label:"Cache Hit Rate",value:"".concat(e.cache_hit_rate.toFixed(1),"%"),sub:"".concat(e.active_keys," active keys"),color:"#a855f7"})]}),r&&(0,s.jsxs)("div",{className:"card mb-8",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-3",children:"Today"}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Requests"}),(0,s.jsx)("p",{className:"text-2xl font-semibold",children:r.requests.toLocaleString()})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Cost"}),(0,s.jsxs)("p",{className:"text-2xl font-semibold",children:["$",r.cost.toFixed(4)]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Tokens"}),(0,s.jsx)("p",{className:"text-2xl font-semibold",children:r.tokens.toLocaleString()})]})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8",children:[(0,s.jsxs)("div",{className:"card lg:col-span-2",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-4",children:"Top Models"}),0===e.top_models.length?(0,s.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No data yet"}):(0,s.jsx)("div",{className:"table-wrap",children:(0,s.jsxs)("table",{children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Model"}),(0,s.jsx)("th",{children:"Requests"}),(0,s.jsx)("th",{children:"Avg Latency"}),(0,s.jsx)("th",{children:"Cost"}),(0,s.jsx)("th",{children:"Error Rate"})]})}),(0,s.jsx)("tbody",{children:e.top_models.map(e=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"font-medium",children:e.model}),(0,s.jsx)("td",{children:e.requests}),(0,s.jsxs)("td",{children:[Math.round(e.avg_latency),"ms"]}),(0,s.jsxs)("td",{children:["$",e.cost.toFixed(4)]}),(0,s.jsx)("td",{children:(0,s.jsxs)("span",{className:e.error_rate>10?"badge-red":e.error_rate>2?"badge-yellow":"badge-green",children:[e.error_rate.toFixed(1),"%"]})})]},e.model))})]})})]}),(0,s.jsxs)("div",{className:"card",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-4",children:"Provider Health"}),0===y.length?(0,s.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No health data yet"}):(0,s.jsx)("div",{className:"space-y-3",children:y.map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full ".concat("healthy"===e.last_status?"bg-green-400":"degraded"===e.last_status?"bg-yellow-400":"bg-red-400")}),(0,s.jsx)("span",{className:"text-sm capitalize",children:e.provider})]}),(0,s.jsx)("span",{className:"text-xs text-[var(--text-secondary)]",children:null!==e.uptime_pct?"".concat(e.uptime_pct.toFixed(1),"%"):"N/A"})]},e.provider))})]})]}),Object.keys(e.requests_by_provider).length>0&&(0,s.jsxs)("div",{className:"card",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-4",children:"Requests by Provider"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(e.requests_by_provider).map(e=>{let[t,r]=e;return(0,s.jsxs)("div",{className:"badge-blue flex items-center gap-2 px-3 py-1.5",children:[(0,s.jsx)(u.Z,{size:14}),(0,s.jsx)("span",{className:"capitalize",children:t}),(0,s.jsx)("span",{className:"font-medium",children:r})]},t)})})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return a}});let s=r(257).env.NEXT_PUBLIC_API_BASE||"";function n(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function i(){return!!n()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=n(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let u=(async()=>{let n=await fetch("".concat(s).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return n;if(401===n.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!n.ok)throw Error((await n.json().catch(()=>({detail:n.statusText}))).detail||"HTTP ".concat(n.status));if(204===n.status)return;let l=await n.json();return"GET"!==r||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===r&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let s=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=s.access_token,localStorage.setItem("nexus_token",r),s},getMe:()=>d("/api/auth/me"),logout:()=>{a(),c.clear(),window.location.href="/login"}},h=async e=>{let t=n(),r=await fetch("".concat(s).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let a=await r.blob(),i=URL.createObjectURL(a),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3548)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{3548:function(e,t,r){Promise.resolve().then(r.bind(r,6117))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var s=r(2265);let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,s.forwardRef)((e,t)=>{let{color:r="currentColor",size:n=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:l="",children:d,iconNode:u,...h}=e;return(0,s.createElement)("svg",{ref:t,...i,width:n,height:n,stroke:r,strokeWidth:o?24*Number(c)/Number(n):c,className:a("lucide",l),...h},[...u.map(e=>{let[t,r]=e;return(0,s.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),o=(e,t)=>{let r=(0,s.forwardRef)((r,i)=>{let{className:o,...l}=r;return(0,s.createElement)(c,{ref:i,iconNode:t,className:a("lucide-".concat(n(e)),o),...l})});return r.displayName="".concat(e),r}},4401:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},5252:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]])},6137:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},525:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]])},1239:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});let s=(0,r(9205).Z)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},257:function(e,t,r){"use strict";var s,n;e.exports=(null==(s=r.g.process)?void 0:s.env)&&"object"==typeof(null==(n=r.g.process)?void 0:n.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,s,n=e.exports={};function a(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var o=[],l=!1,d=-1;function u(){l&&s&&(l=!1,s.length?o=s.concat(o):d=-1,o.length&&h())}function h(){if(!l){var e=c(u);l=!0;for(var t=o.length;t;){for(s=o,o=[];++d1)for(var r=1;r{Promise.all([a.hi.get("/api/stats/dashboard"),a.hi.get("/api/uptime").catch(()=>[]),a.hi.get("/api/stats/today").catch(()=>null)]).then(e=>{let[r,s,n]=e;t(r),v(s),x(n)}).catch(e=>g(e instanceof Error?e.message:"Failed to load dashboard")).finally(()=>f(!1))},[]),p)?(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"page-header",children:(0,s.jsx)("h1",{className:"page-title",children:"Dashboard"})}),(0,s.jsxs)("div",{className:"card text-center py-12",children:[(0,s.jsx)(i.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,s.jsx)("p",{className:"text-red-400",children:p})]})]}):m||!e?(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"page-header",children:(0,s.jsx)("h1",{className:"page-title",children:"Dashboard"})}),(0,s.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[void 0,void 0,void 0,void 0].map((e,t)=>(0,s.jsx)("div",{className:"card h-24",children:(0,s.jsx)("div",{className:"skeleton h-full w-full"})},t))})]}):(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"page-header",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"page-title",children:"Dashboard"}),(0,s.jsx)("p",{className:"page-sub",children:"Real-time gateway metrics"})]}),(0,s.jsx)("button",{className:"btn-ghost btn-sm",onClick:()=>window.location.reload(),children:"↻ Refresh"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[(0,s.jsx)(h,{icon:c.Z,label:"Total Requests",value:e.total_requests.toLocaleString(),sub:"".concat(e.requests_today," today"),color:"#3b82f6"}),(0,s.jsx)(h,{icon:o.Z,label:"Total Cost",value:"$".concat(e.total_cost.toFixed(4)),sub:"$".concat(e.today_cost.toFixed(4)," today"),color:"#22c55e"}),(0,s.jsx)(h,{icon:l.Z,label:"Avg Latency",value:"".concat(Math.round(e.avg_latency_ms),"ms"),sub:"".concat(e.error_rate.toFixed(1),"% error rate"),color:"#f97316"}),(0,s.jsx)(h,{icon:d.Z,label:"Cache Hit Rate",value:"".concat(e.cache_hit_rate.toFixed(1),"%"),sub:"".concat(e.active_keys," active keys"),color:"#a855f7"})]}),r&&(0,s.jsxs)("div",{className:"card mb-8",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-3",children:"Today"}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Requests"}),(0,s.jsx)("p",{className:"text-2xl font-semibold",children:r.requests.toLocaleString()})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Cost"}),(0,s.jsxs)("p",{className:"text-2xl font-semibold",children:["$",r.cost.toFixed(4)]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:"Tokens"}),(0,s.jsx)("p",{className:"text-2xl font-semibold",children:r.tokens.toLocaleString()})]})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8",children:[(0,s.jsxs)("div",{className:"card lg:col-span-2",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-4",children:"Top Models"}),0===e.top_models.length?(0,s.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No data yet"}):(0,s.jsx)("div",{className:"table-wrap",children:(0,s.jsxs)("table",{children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Model"}),(0,s.jsx)("th",{children:"Requests"}),(0,s.jsx)("th",{children:"Avg Latency"}),(0,s.jsx)("th",{children:"Cost"}),(0,s.jsx)("th",{children:"Error Rate"})]})}),(0,s.jsx)("tbody",{children:e.top_models.map(e=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"font-medium",children:e.model}),(0,s.jsx)("td",{children:e.requests}),(0,s.jsxs)("td",{children:[Math.round(e.avg_latency),"ms"]}),(0,s.jsxs)("td",{children:["$",e.cost.toFixed(4)]}),(0,s.jsx)("td",{children:(0,s.jsxs)("span",{className:e.error_rate>10?"badge-red":e.error_rate>2?"badge-yellow":"badge-green",children:[e.error_rate.toFixed(1),"%"]})})]},e.model))})]})})]}),(0,s.jsxs)("div",{className:"card",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-4",children:"Provider Health"}),0===y.length?(0,s.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No health data yet"}):(0,s.jsx)("div",{className:"space-y-3",children:y.map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full ".concat("healthy"===e.last_status?"bg-green-400":"degraded"===e.last_status?"bg-yellow-400":"bg-red-400")}),(0,s.jsx)("span",{className:"text-sm capitalize",children:e.provider})]}),(0,s.jsx)("span",{className:"text-xs text-[var(--text-secondary)]",children:null!==e.uptime_pct?"".concat(e.uptime_pct.toFixed(1),"%"):"N/A"})]},e.provider))})]})]}),Object.keys(e.requests_by_provider).length>0&&(0,s.jsxs)("div",{className:"card",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-4",children:"Requests by Provider"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(e.requests_by_provider).map(e=>{let[t,r]=e;return(0,s.jsxs)("div",{className:"badge-blue flex items-center gap-2 px-3 py-1.5",children:[(0,s.jsx)(u.Z,{size:14}),(0,s.jsx)("span",{className:"capitalize",children:t}),(0,s.jsx)("span",{className:"font-medium",children:r})]},t)})})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return a}});let s=r(257).env.NEXT_PUBLIC_API_BASE||"";function n(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function a(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!n()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,l=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=n(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=l.get(e);if(r)return r}let u=(async()=>{let n=await fetch("".concat(s).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return n;if(401===n.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!n.ok)throw Error((await n.json().catch(()=>({detail:n.statusText}))).detail||"HTTP ".concat(n.status));if(204===n.status)return;let c=await n.json();return"GET"!==r||i||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===r&&!i){l.set(e,u);try{return await u}finally{l.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let s=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=s.access_token,localStorage.setItem("nexus_token",r),function(e,t,r){try{let r="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(r)}catch(e){}}("nexus_token",r,0),s},getMe:()=>d("/api/auth/me"),logout:()=>{a(),o.clear(),window.location.href="/login"}},h=async e=>{let t=n(),r=await fetch("".concat(s).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let a=await r.blob(),i=URL.createObjectURL(a),c=document.createElement("a");c.href=i,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3548)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/playground/page-66b5ce70d1dd254e.js b/static/_next/static/chunks/app/playground/page-4596e02c5be42048.js similarity index 78% rename from static/_next/static/chunks/app/playground/page-66b5ce70d1dd254e.js rename to static/_next/static/chunks/app/playground/page-4596e02c5be42048.js index a4e4f17f32f142c623f7f1e871db667d2dcdcbdf..6f8e0d41b8c756e9068e5c04d5c71fd75c87b8a0 100644 --- a/static/_next/static/chunks/app/playground/page-66b5ce70d1dd254e.js +++ b/static/_next/static/chunks/app/playground/page-4596e02c5be42048.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2383],{1124:function(e,t,a){Promise.resolve().then(a.bind(a,5427))},9205:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var r=a(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n=function(){for(var e=arguments.length,t=Array(e),a=0;a!!e&&a.indexOf(e)===t).join(" ")};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,r.forwardRef)((e,t)=>{let{color:a="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...x}=e;return(0,r.createElement)("svg",{ref:t,...l,width:s,height:s,stroke:a,strokeWidth:c?24*Number(i)/Number(s):i,className:n("lucide",o),...x},[...u.map(e=>{let[t,a]=e;return(0,r.createElement)(t,a)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let a=(0,r.forwardRef)((a,l)=>{let{className:c,...o}=a;return(0,r.createElement)(i,{ref:l,iconNode:t,className:n("lucide-".concat(s(e)),c),...o})});return a.displayName="".concat(e),a}},401:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},1723:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},8867:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},5252:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]])},3276:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},4743:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},8930:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,a){"use strict";var r,s;e.exports=(null==(r=a.g.process)?void 0:r.env)&&"object"==typeof(null==(s=a.g.process)?void 0:s.env)?a.g.process:a(4227)},4227:function(e){!function(){var t={229:function(e){var t,a,r,s=e.exports={};function n(){throw Error("setTimeout has not been defined")}function l(){throw Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===n||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(a){try{return t.call(null,e,0)}catch(a){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:n}catch(e){t=n}try{a="function"==typeof clearTimeout?clearTimeout:l}catch(e){a=l}}();var c=[],o=!1,d=-1;function u(){o&&r&&(o=!1,r.length?c=r.concat(c):d=-1,c.length&&x())}function x(){if(!o){var e=i(u);o=!0;for(var t=c.length;t;){for(r=c,c=[];++d1)for(var a=1;a{n.hi.get("/v1/models").then(e=>{let t=(e.data||[]).map(e=>({id:e.id})).sort((e,t)=>e.id.localeCompare(t.id));l(t),!v&&t.length>0&&g(t[0].id)}).catch(()=>{}),n.hi.get("/api/providers").then(e=>y(Object.keys(e))).catch(()=>{})},[]),(0,s.useEffect)(()=>{var e;null===(e=X.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[_,M]);let ee=(0,s.useCallback)(async()=>{if(!A.trim()||!v||O)return;F("");let e=[..._,{role:"user",content:A.trim()}];z(e),P(""),L(!0),D("");let t=[];for(let a of(N.trim()&&t.push({role:"system",content:N.trim()}),e))t.push({role:a.role,content:a.content});let a={model:v,messages:t,temperature:k,max_tokens:S,top_p:E,stream:!0};b&&(a.provider=b),Q.current=new AbortController;try{var r,s,n,l,i;let e=localStorage.getItem("nexus_token"),t=await fetch("/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",...e?{Authorization:"Bearer ".concat(e)}:{}},body:JSON.stringify(a),signal:Q.current.signal});if(!t.ok){let e=await t.text();try{let t=JSON.parse(e);F((null===(s=t.error)||void 0===s?void 0:s.message)||t.message||e)}catch(t){F(e)}L(!1);return}let c=null===(r=t.body)||void 0===r?void 0:r.getReader();if(!c){F("No response body"),L(!1);return}let o=new TextDecoder,d="",u="";for(;;){let{done:e,value:t}=await c.read();if(e)break;let a=(u+=o.decode(t,{stream:!0})).split("\n");for(let e of(u=a.pop()||"",a)){if(!e.startsWith("data: "))continue;let t=e.slice(6).trim();if("[DONE]"!==t)try{let e=JSON.parse(t),a=(null===(i=e.choices)||void 0===i?void 0:null===(l=i[0])||void 0===l?void 0:null===(n=l.delta)||void 0===n?void 0:n.content)||"";a&&(d+=a,D(d))}catch(e){}}}z(e=>[...e,{role:"assistant",content:d}]),D("")}catch(e){e instanceof Error&&"AbortError"!==e.name&&F(e.message)}finally{L(!1),Q.current=null}},[A,v,b,N,k,S,E,_,O]),et=async()=>{let e=[..._].reverse().find(e=>"assistant"===e.role);if(e)try{await navigator.clipboard.writeText(e.content),B(!0),setTimeout(()=>B(!1),2e3)}catch(e){}},ea=e=>{U(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},er=async()=>{if(q.trim()&&0!==H.length){K(!0),F(""),G([]);try{let e=await n.hi.post("/api/playground/compare",{prompt:q.trim(),models:H});G(e.results)}catch(e){F(e instanceof Error?e.message:"Comparison failed")}finally{K(!1)}}},es=e=>e.tokens_in/1e3*.01+e.tokens_out/1e3*.03;return(0,r.jsxs)("div",{className:"flex flex-col h-[calc(100vh-6rem)]",children:[(0,r.jsxs)("div",{className:"page-header flex-shrink-0",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Playground"}),(0,r.jsx)("p",{className:"page-sub",children:"Chat with models and compare responses"})]}),(0,r.jsx)("div",{className:"flex items-center gap-3",children:(0,r.jsxs)("div",{className:"flex gap-1 bg-[var(--surface-100)] p-1 rounded-lg",children:[(0,r.jsx)("button",{className:"px-3 py-1.5 rounded-md text-sm font-medium transition-all ".concat("chat"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("chat"),children:"Chat"}),(0,r.jsx)("button",{className:"px-3 py-1.5 rounded-md text-sm font-medium transition-all ".concat("compare"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("compare"),children:"Compare"})]})})]}),(0,r.jsx)("div",{className:"flex-1 flex gap-4 min-h-0",children:"chat"===e?(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"flex-1 flex flex-col gap-4 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"card flex flex-col gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("label",{className:"label !mb-0",children:"Model"}),(0,r.jsx)("button",{className:"btn-ghost btn-xs",onClick:()=>{n.hi.get("/v1/models").then(e=>{l((e.data||[]).map(e=>({id:e.id})).sort((e,t)=>e.id.localeCompare(t.id)))}).catch(()=>{})},children:"↻ Refresh"})]}),(0,r.jsx)("input",{className:"input",list:"model-list",value:v,onChange:e=>g(e.target.value),placeholder:"Select a model..."}),(0,r.jsx)("datalist",{id:"model-list",children:a.map(e=>(0,r.jsx)("option",{value:e.id},e.id))})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("label",{className:"label",children:"System Prompt"}),(0,r.jsx)("textarea",{className:"input !min-h-[60px]",rows:2,value:N,onChange:e=>w(e.target.value),placeholder:"You are a helpful assistant."})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("button",{className:"btn-ghost btn-sm ".concat(Y?"text-[var(--accent)]":""),onClick:()=>$(!Y),children:[(0,r.jsx)(i,{size:14}),"Parameters"]}),_.length>0&&(0,r.jsxs)("button",{className:"btn-ghost btn-sm text-[var(--text-tertiary)]",onClick:()=>{z([]),D(""),F("")},children:[(0,r.jsx)(c.Z,{size:14})," Clear"]})]}),Y&&(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Temperature"}),(0,r.jsx)("input",{type:"range",min:"0",max:"2",step:"0.05",value:k,onChange:e=>C(parseFloat(e.target.value)),className:"w-full accent-[var(--accent)]"}),(0,r.jsx)("span",{className:"text-xs text-[var(--text-tertiary)]",children:k.toFixed(2)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Max Tokens"}),(0,r.jsx)("input",{className:"input",type:"number",min:"1",max:"16384",value:S,onChange:e=>T(parseInt(e.target.value)||1024)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Top P"}),(0,r.jsx)("input",{type:"range",min:"0",max:"1",step:"0.05",value:E,onChange:e=>Z(parseFloat(e.target.value)),className:"w-full accent-[var(--accent)]"}),(0,r.jsx)("span",{className:"text-xs text-[var(--text-tertiary)]",children:E.toFixed(2)})]})]}),(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("label",{className:"label",children:"Provider Override"}),(0,r.jsxs)("select",{className:"select",value:b,onChange:e=>j(e.target.value),children:[(0,r.jsx)("option",{value:"",children:"Auto-detect"}),f.map(e=>(0,r.jsx)("option",{value:e,children:e},e))]})]})]}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col gap-3 overflow-y-auto min-h-0",children:[0===_.length&&!O&&(0,r.jsxs)("div",{className:"card flex flex-col items-center justify-center py-12 text-center",children:[(0,r.jsx)(o.Z,{size:32,className:"text-[var(--text-tertiary)] mb-3"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"Select a model and start chatting"})]}),_.map((e,t)=>(0,r.jsxs)("div",{className:"card !p-3 ".concat("user"===e.role?"border-nexus-500/20 bg-nexus-500/5":""," ").concat("system"===e.role?"border-yellow-500/20 bg-yellow-500/5":""),children:[(0,r.jsx)("div",{className:"text-xs font-medium uppercase tracking-wider text-[var(--text-tertiary)] mb-1",children:"user"===e.role?"You":"system"===e.role?"System":"Assistant"}),(0,r.jsx)("div",{className:"text-sm whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed",children:e.content})]},t)),O&&M&&(0,r.jsxs)("div",{className:"card !p-3 border border-[var(--accent)]/20",children:[(0,r.jsxs)("div",{className:"text-xs font-medium uppercase tracking-wider text-[var(--text-tertiary)] mb-1",children:["Assistant",(0,r.jsxs)("span",{className:"inline-flex ml-2 gap-0.5",children:[(0,r.jsx)("span",{className:"w-1 h-1 bg-[var(--accent)] rounded-full animate-bounce",style:{animationDelay:"0ms"}}),(0,r.jsx)("span",{className:"w-1 h-1 bg-[var(--accent)] rounded-full animate-bounce",style:{animationDelay:"150ms"}}),(0,r.jsx)("span",{className:"w-1 h-1 bg-[var(--accent)] rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})]}),(0,r.jsx)("div",{className:"text-sm whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed",children:M})]}),(0,r.jsx)("div",{ref:X})]}),R&&(0,r.jsx)("div",{className:"card border border-red-500/30 bg-red-500/5",children:(0,r.jsx)("p",{className:"text-sm text-red-400",children:R})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("input",{className:"input flex-1",value:A,onChange:e=>P(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ee())},placeholder:"Type a message...",disabled:O||!v}),O?(0,r.jsx)("button",{className:"btn-danger justify-center px-4",onClick:()=>{var e;null===(e=Q.current)||void 0===e||e.abort(),L(!1)},children:"Stop"}):(0,r.jsx)("button",{className:"btn-primary justify-center px-4",onClick:ee,disabled:!A.trim()||!v,children:(0,r.jsx)(o.Z,{size:16})}),_.some(e=>"assistant"===e.role)&&(0,r.jsx)("button",{className:"btn-ghost px-3",onClick:et,title:"Copy last response",children:I?(0,r.jsx)(d.Z,{size:16,className:"text-green-400"}):(0,r.jsx)(u.Z,{size:16})})]})]})}):(0,r.jsxs)("div",{className:"flex-1 flex flex-col gap-4 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("label",{className:"label",children:"Prompt"}),(0,r.jsx)("textarea",{className:"input !min-h-[120px]",rows:4,value:q,onChange:e=>V(e.target.value),placeholder:"Enter a prompt to send to all selected models..."})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("label",{className:"label !mb-0",children:"Models"}),(0,r.jsxs)("span",{className:"text-xs text-[var(--text-tertiary)]",children:[H.length," selected"]})]}),0===a.length?(0,r.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No models available"}):(0,r.jsx)("div",{className:"flex flex-wrap gap-2 max-h-48 overflow-y-auto",children:a.map(e=>(0,r.jsxs)("label",{className:"px-3 py-1.5 rounded-lg text-sm cursor-pointer border transition-all ".concat(H.includes(e.id)?"border-[var(--accent)] bg-[var(--accent)]/10 text-[var(--accent)]":"border-[var(--border)] text-[var(--text-secondary)] hover:border-[var(--text-tertiary)]"),children:[(0,r.jsx)("input",{type:"checkbox",className:"hidden",checked:H.includes(e.id),onChange:()=>ea(e.id)}),e.id]},e.id))})]}),(0,r.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:er,disabled:J||!q.trim()||0===H.length,children:[J?(0,r.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,r.jsx)(x.Z,{size:16}),J?" Comparing...":" Compare"]}),W.length>0&&(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:W.map(e=>(0,r.jsxs)("div",{className:"card flex flex-col",children:[(0,r.jsx)("div",{className:"flex items-center justify-between mb-3 pb-2 border-b border-[var(--border)]",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-semibold text-sm",children:e.model}),(0,r.jsx)("span",{className:"text-xs text-[var(--text-tertiary)] ml-2 capitalize",children:e.provider})]})}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto max-h-[300px] mb-3",children:(0,r.jsx)("pre",{className:"text-sm whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed font-sans",children:e.response_text})}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-2 pt-2 border-t border-[var(--border)]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 text-xs text-[var(--text-tertiary)]",children:[(0,r.jsx)(m.Z,{size:12}),(0,r.jsxs)("span",{children:[e.latency_ms,"ms"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1 text-xs text-[var(--text-tertiary)]",children:[(0,r.jsx)(h,{size:12}),(0,r.jsxs)("span",{children:[e.tokens_in," → ",e.tokens_out]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1 text-xs text-[var(--text-tertiary)]",children:[(0,r.jsx)(p.Z,{size:12}),(0,r.jsxs)("span",{children:["$",es(e).toFixed(6)]})]})]})]},e.model))}),!J&&0===W.length&&!R&&(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(x.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"Select models and enter a prompt to compare."})]})]})})]})}},1837:function(e,t,a){"use strict";a.d(t,{KF:function(){return x},hi:function(){return u},jl:function(){return l},qz:function(){return n}});let r=a(257).env.NEXT_PUBLIC_API_BASE||"";function s(){return localStorage.getItem("nexus_token")}function n(){localStorage.removeItem("nexus_token")}function l(){return!!s()}let i={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.method||"GET",l=s(),d={"Content-Type":"application/json",...t.headers};if(l&&(d.Authorization="Bearer ".concat(l)),"GET"===a&&!l){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in i)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return i[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let a=o.get(e);if(a)return a}let u=(async()=>{let s=await fetch("".concat(r).concat(e),{method:a,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&l&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw n(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let i=await s.json();return"GET"!==a||l||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,i),i})();if("GET"===a&&!l){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var a;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return a=r.access_token,localStorage.setItem("nexus_token",a),r},getMe:()=>d("/api/auth/me"),logout:()=>{n(),c.clear(),window.location.href="/login"}},x=async e=>{let t=s(),a=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!a.ok)throw Error("Failed to download");let n=await a.blob(),l=URL.createObjectURL(n),i=document.createElement("a");i.href=l,i.download=e.split("/").pop()||"export.csv",i.click(),URL.revokeObjectURL(l)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1124)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2383],{1124:function(e,t,a){Promise.resolve().then(a.bind(a,5427))},9205:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var r=a(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n=function(){for(var e=arguments.length,t=Array(e),a=0;a!!e&&a.indexOf(e)===t).join(" ")};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,r.forwardRef)((e,t)=>{let{color:a="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...x}=e;return(0,r.createElement)("svg",{ref:t,...l,width:s,height:s,stroke:a,strokeWidth:c?24*Number(i)/Number(s):i,className:n("lucide",o),...x},[...u.map(e=>{let[t,a]=e;return(0,r.createElement)(t,a)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let a=(0,r.forwardRef)((a,l)=>{let{className:c,...o}=a;return(0,r.createElement)(i,{ref:l,iconNode:t,className:n("lucide-".concat(s(e)),c),...o})});return a.displayName="".concat(e),a}},401:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},1723:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},8867:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},5252:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]])},3276:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},4743:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},8930:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,a){"use strict";var r,s;e.exports=(null==(r=a.g.process)?void 0:r.env)&&"object"==typeof(null==(s=a.g.process)?void 0:s.env)?a.g.process:a(4227)},4227:function(e){!function(){var t={229:function(e){var t,a,r,s=e.exports={};function n(){throw Error("setTimeout has not been defined")}function l(){throw Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===n||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(a){try{return t.call(null,e,0)}catch(a){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:n}catch(e){t=n}try{a="function"==typeof clearTimeout?clearTimeout:l}catch(e){a=l}}();var c=[],o=!1,d=-1;function u(){o&&r&&(o=!1,r.length?c=r.concat(c):d=-1,c.length&&x())}function x(){if(!o){var e=i(u);o=!0;for(var t=c.length;t;){for(r=c,c=[];++d1)for(var a=1;a{n.hi.get("/v1/models").then(e=>{let t=(e.data||[]).map(e=>({id:e.id})).sort((e,t)=>e.id.localeCompare(t.id));l(t),!v&&t.length>0&&g(t[0].id)}).catch(()=>{}),n.hi.get("/api/providers").then(e=>y(Object.keys(e))).catch(()=>{})},[]),(0,s.useEffect)(()=>{var e;null===(e=X.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[_,M]);let ee=(0,s.useCallback)(async()=>{if(!A.trim()||!v||O)return;I("");let e=[..._,{role:"user",content:A.trim()}];z(e),P(""),L(!0),R("");let t=[];for(let a of(N.trim()&&t.push({role:"system",content:N.trim()}),e))t.push({role:a.role,content:a.content});let a={model:v,messages:t,temperature:k,max_tokens:C,top_p:E,stream:!0};b&&(a.provider=b),Q.current=new AbortController;try{var r,s,n,l,i;let e=localStorage.getItem("nexus_token"),t=await fetch("/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",...e?{Authorization:"Bearer ".concat(e)}:{}},body:JSON.stringify(a),signal:Q.current.signal});if(!t.ok){let e=await t.text();try{let t=JSON.parse(e);I((null===(s=t.error)||void 0===s?void 0:s.message)||t.message||e)}catch(t){I(e)}L(!1);return}let c=null===(r=t.body)||void 0===r?void 0:r.getReader();if(!c){I("No response body"),L(!1);return}let o=new TextDecoder,d="",u="";for(;;){let{done:e,value:t}=await c.read();if(e)break;let a=(u+=o.decode(t,{stream:!0})).split("\n");for(let e of(u=a.pop()||"",a)){if(!e.startsWith("data: "))continue;let t=e.slice(6).trim();if("[DONE]"!==t)try{let e=JSON.parse(t),a=(null===(i=e.choices)||void 0===i?void 0:null===(l=i[0])||void 0===l?void 0:null===(n=l.delta)||void 0===n?void 0:n.content)||"";a&&(d+=a,R(d))}catch(e){}}}z(e=>[...e,{role:"assistant",content:d}]),R("")}catch(e){e instanceof Error&&"AbortError"!==e.name&&I(e.message)}finally{L(!1),Q.current=null}},[A,v,b,N,k,C,E,_,O]),et=async()=>{let e=[..._].reverse().find(e=>"assistant"===e.role);if(e)try{await navigator.clipboard.writeText(e.content),U(!0),setTimeout(()=>U(!1),2e3)}catch(e){}},ea=e=>{H(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},er=async()=>{if(q.trim()&&0!==B.length){K(!0),I(""),G([]);try{let e=await n.hi.post("/api/playground/compare",{prompt:q.trim(),models:B});G(e.results)}catch(e){I(e instanceof Error?e.message:"Comparison failed")}finally{K(!1)}}},es=e=>e.tokens_in/1e3*.01+e.tokens_out/1e3*.03;return(0,r.jsxs)("div",{className:"flex flex-col h-[calc(100vh-6rem)]",children:[(0,r.jsxs)("div",{className:"page-header flex-shrink-0",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Playground"}),(0,r.jsx)("p",{className:"page-sub",children:"Chat with models and compare responses"})]}),(0,r.jsx)("div",{className:"flex items-center gap-3",children:(0,r.jsxs)("div",{className:"flex gap-1 bg-[var(--surface-100)] p-1 rounded-lg",children:[(0,r.jsx)("button",{className:"px-3 py-1.5 rounded-md text-sm font-medium transition-all ".concat("chat"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("chat"),children:"Chat"}),(0,r.jsx)("button",{className:"px-3 py-1.5 rounded-md text-sm font-medium transition-all ".concat("compare"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("compare"),children:"Compare"})]})})]}),(0,r.jsx)("div",{className:"flex-1 flex gap-4 min-h-0",children:"chat"===e?(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"flex-1 flex flex-col gap-4 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"card flex flex-col gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("label",{className:"label !mb-0",children:"Model"}),(0,r.jsx)("button",{className:"btn-ghost btn-xs",onClick:()=>{n.hi.get("/v1/models").then(e=>{l((e.data||[]).map(e=>({id:e.id})).sort((e,t)=>e.id.localeCompare(t.id)))}).catch(()=>{})},children:"↻ Refresh"})]}),(0,r.jsx)("input",{className:"input",list:"model-list",value:v,onChange:e=>g(e.target.value),placeholder:"Select a model..."}),(0,r.jsx)("datalist",{id:"model-list",children:a.map(e=>(0,r.jsx)("option",{value:e.id},e.id))})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("label",{className:"label",children:"System Prompt"}),(0,r.jsx)("textarea",{className:"input !min-h-[60px]",rows:2,value:N,onChange:e=>w(e.target.value),placeholder:"You are a helpful assistant."})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("button",{className:"btn-ghost btn-sm ".concat(Y?"text-[var(--accent)]":""),onClick:()=>$(!Y),children:[(0,r.jsx)(i,{size:14}),"Parameters"]}),_.length>0&&(0,r.jsxs)("button",{className:"btn-ghost btn-sm text-[var(--text-tertiary)]",onClick:()=>{z([]),R(""),I("")},children:[(0,r.jsx)(c.Z,{size:14})," Clear"]})]}),Y&&(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Temperature"}),(0,r.jsx)("input",{type:"range",min:"0",max:"2",step:"0.05",value:k,onChange:e=>S(parseFloat(e.target.value)),className:"w-full accent-[var(--accent)]"}),(0,r.jsx)("span",{className:"text-xs text-[var(--text-tertiary)]",children:k.toFixed(2)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Max Tokens"}),(0,r.jsx)("input",{className:"input",type:"number",min:"1",max:"16384",value:C,onChange:e=>T(parseInt(e.target.value)||1024)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Top P"}),(0,r.jsx)("input",{type:"range",min:"0",max:"1",step:"0.05",value:E,onChange:e=>Z(parseFloat(e.target.value)),className:"w-full accent-[var(--accent)]"}),(0,r.jsx)("span",{className:"text-xs text-[var(--text-tertiary)]",children:E.toFixed(2)})]})]}),(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("label",{className:"label",children:"Provider Override"}),(0,r.jsxs)("select",{className:"select",value:b,onChange:e=>j(e.target.value),children:[(0,r.jsx)("option",{value:"",children:"Auto-detect"}),f.map(e=>(0,r.jsx)("option",{value:e,children:e},e))]})]})]}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col gap-3 overflow-y-auto min-h-0",children:[0===_.length&&!O&&(0,r.jsxs)("div",{className:"card flex flex-col items-center justify-center py-12 text-center",children:[(0,r.jsx)(o.Z,{size:32,className:"text-[var(--text-tertiary)] mb-3"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"Select a model and start chatting"})]}),_.map((e,t)=>(0,r.jsxs)("div",{className:"card !p-3 ".concat("user"===e.role?"border-nexus-500/20 bg-nexus-500/5":""," ").concat("system"===e.role?"border-yellow-500/20 bg-yellow-500/5":""),children:[(0,r.jsx)("div",{className:"text-xs font-medium uppercase tracking-wider text-[var(--text-tertiary)] mb-1",children:"user"===e.role?"You":"system"===e.role?"System":"Assistant"}),(0,r.jsx)("div",{className:"text-sm whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed",children:e.content})]},t)),O&&M&&(0,r.jsxs)("div",{className:"card !p-3 border border-[var(--accent)]/20",children:[(0,r.jsxs)("div",{className:"text-xs font-medium uppercase tracking-wider text-[var(--text-tertiary)] mb-1",children:["Assistant",(0,r.jsxs)("span",{className:"inline-flex ml-2 gap-0.5",children:[(0,r.jsx)("span",{className:"w-1 h-1 bg-[var(--accent)] rounded-full animate-bounce",style:{animationDelay:"0ms"}}),(0,r.jsx)("span",{className:"w-1 h-1 bg-[var(--accent)] rounded-full animate-bounce",style:{animationDelay:"150ms"}}),(0,r.jsx)("span",{className:"w-1 h-1 bg-[var(--accent)] rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})]}),(0,r.jsx)("div",{className:"text-sm whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed",children:M})]}),(0,r.jsx)("div",{ref:X})]}),D&&(0,r.jsx)("div",{className:"card border border-red-500/30 bg-red-500/5",children:(0,r.jsx)("p",{className:"text-sm text-red-400",children:D})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("input",{className:"input flex-1",value:A,onChange:e=>P(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ee())},placeholder:"Type a message...",disabled:O||!v}),O?(0,r.jsx)("button",{className:"btn-danger justify-center px-4",onClick:()=>{var e;null===(e=Q.current)||void 0===e||e.abort(),L(!1)},children:"Stop"}):(0,r.jsx)("button",{className:"btn-primary justify-center px-4",onClick:ee,disabled:!A.trim()||!v,children:(0,r.jsx)(o.Z,{size:16})}),_.some(e=>"assistant"===e.role)&&(0,r.jsx)("button",{className:"btn-ghost px-3",onClick:et,title:"Copy last response",children:F?(0,r.jsx)(d.Z,{size:16,className:"text-green-400"}):(0,r.jsx)(u.Z,{size:16})})]})]})}):(0,r.jsxs)("div",{className:"flex-1 flex flex-col gap-4 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("label",{className:"label",children:"Prompt"}),(0,r.jsx)("textarea",{className:"input !min-h-[120px]",rows:4,value:q,onChange:e=>V(e.target.value),placeholder:"Enter a prompt to send to all selected models..."})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("label",{className:"label !mb-0",children:"Models"}),(0,r.jsxs)("span",{className:"text-xs text-[var(--text-tertiary)]",children:[B.length," selected"]})]}),0===a.length?(0,r.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No models available"}):(0,r.jsx)("div",{className:"flex flex-wrap gap-2 max-h-48 overflow-y-auto",children:a.map(e=>(0,r.jsxs)("label",{className:"px-3 py-1.5 rounded-lg text-sm cursor-pointer border transition-all ".concat(B.includes(e.id)?"border-[var(--accent)] bg-[var(--accent)]/10 text-[var(--accent)]":"border-[var(--border)] text-[var(--text-secondary)] hover:border-[var(--text-tertiary)]"),children:[(0,r.jsx)("input",{type:"checkbox",className:"hidden",checked:B.includes(e.id),onChange:()=>ea(e.id)}),e.id]},e.id))})]}),(0,r.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:er,disabled:J||!q.trim()||0===B.length,children:[J?(0,r.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,r.jsx)(x.Z,{size:16}),J?" Comparing...":" Compare"]}),W.length>0&&(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:W.map(e=>(0,r.jsxs)("div",{className:"card flex flex-col",children:[(0,r.jsx)("div",{className:"flex items-center justify-between mb-3 pb-2 border-b border-[var(--border)]",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-semibold text-sm",children:e.model}),(0,r.jsx)("span",{className:"text-xs text-[var(--text-tertiary)] ml-2 capitalize",children:e.provider})]})}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto max-h-[300px] mb-3",children:(0,r.jsx)("pre",{className:"text-sm whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed font-sans",children:e.response_text})}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-2 pt-2 border-t border-[var(--border)]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 text-xs text-[var(--text-tertiary)]",children:[(0,r.jsx)(m.Z,{size:12}),(0,r.jsxs)("span",{children:[e.latency_ms,"ms"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1 text-xs text-[var(--text-tertiary)]",children:[(0,r.jsx)(h,{size:12}),(0,r.jsxs)("span",{children:[e.tokens_in," → ",e.tokens_out]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1 text-xs text-[var(--text-tertiary)]",children:[(0,r.jsx)(p.Z,{size:12}),(0,r.jsxs)("span",{children:["$",es(e).toFixed(6)]})]})]})]},e.model))}),!J&&0===W.length&&!D&&(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(x.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"Select models and enter a prompt to compare."})]})]})})]})}},1837:function(e,t,a){"use strict";a.d(t,{KF:function(){return x},hi:function(){return u},jl:function(){return l},qz:function(){return n}});let r=a(257).env.NEXT_PUBLIC_API_BASE||"";function s(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function n(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function l(){return!!s()}let i={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.method||"GET",l=s(),d={"Content-Type":"application/json",...t.headers};if(l&&(d.Authorization="Bearer ".concat(l)),"GET"===a&&!l){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in i)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return i[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let a=o.get(e);if(a)return a}let u=(async()=>{let s=await fetch("".concat(r).concat(e),{method:a,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&l&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw n(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let i=await s.json();return"GET"!==a||l||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,i),i})();if("GET"===a&&!l){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var a;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return a=r.access_token,localStorage.setItem("nexus_token",a),function(e,t,a){try{let a="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(a)}catch(e){}}("nexus_token",a,0),r},getMe:()=>d("/api/auth/me"),logout:()=>{n(),c.clear(),window.location.href="/login"}},x=async e=>{let t=s(),a=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!a.ok)throw Error("Failed to download");let n=await a.blob(),l=URL.createObjectURL(n),i=document.createElement("a");i.href=l,i.download=e.split("/").pop()||"export.csv",i.click(),URL.revokeObjectURL(l)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1124)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/playground/page-dfb6ba9b0879370b.js b/static/_next/static/chunks/app/playground/page-dfb6ba9b0879370b.js deleted file mode 100644 index a4e4f17f32f142c623f7f1e871db667d2dcdcbdf..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/playground/page-dfb6ba9b0879370b.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2383],{1124:function(e,t,a){Promise.resolve().then(a.bind(a,5427))},9205:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var r=a(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n=function(){for(var e=arguments.length,t=Array(e),a=0;a!!e&&a.indexOf(e)===t).join(" ")};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,r.forwardRef)((e,t)=>{let{color:a="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...x}=e;return(0,r.createElement)("svg",{ref:t,...l,width:s,height:s,stroke:a,strokeWidth:c?24*Number(i)/Number(s):i,className:n("lucide",o),...x},[...u.map(e=>{let[t,a]=e;return(0,r.createElement)(t,a)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let a=(0,r.forwardRef)((a,l)=>{let{className:c,...o}=a;return(0,r.createElement)(i,{ref:l,iconNode:t,className:n("lucide-".concat(s(e)),c),...o})});return a.displayName="".concat(e),a}},401:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},1723:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},8867:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},5252:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]])},3276:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},4743:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},8930:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,a){"use strict";var r,s;e.exports=(null==(r=a.g.process)?void 0:r.env)&&"object"==typeof(null==(s=a.g.process)?void 0:s.env)?a.g.process:a(4227)},4227:function(e){!function(){var t={229:function(e){var t,a,r,s=e.exports={};function n(){throw Error("setTimeout has not been defined")}function l(){throw Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===n||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(a){try{return t.call(null,e,0)}catch(a){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:n}catch(e){t=n}try{a="function"==typeof clearTimeout?clearTimeout:l}catch(e){a=l}}();var c=[],o=!1,d=-1;function u(){o&&r&&(o=!1,r.length?c=r.concat(c):d=-1,c.length&&x())}function x(){if(!o){var e=i(u);o=!0;for(var t=c.length;t;){for(r=c,c=[];++d1)for(var a=1;a{n.hi.get("/v1/models").then(e=>{let t=(e.data||[]).map(e=>({id:e.id})).sort((e,t)=>e.id.localeCompare(t.id));l(t),!v&&t.length>0&&g(t[0].id)}).catch(()=>{}),n.hi.get("/api/providers").then(e=>y(Object.keys(e))).catch(()=>{})},[]),(0,s.useEffect)(()=>{var e;null===(e=X.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[_,M]);let ee=(0,s.useCallback)(async()=>{if(!A.trim()||!v||O)return;F("");let e=[..._,{role:"user",content:A.trim()}];z(e),P(""),L(!0),D("");let t=[];for(let a of(N.trim()&&t.push({role:"system",content:N.trim()}),e))t.push({role:a.role,content:a.content});let a={model:v,messages:t,temperature:k,max_tokens:S,top_p:E,stream:!0};b&&(a.provider=b),Q.current=new AbortController;try{var r,s,n,l,i;let e=localStorage.getItem("nexus_token"),t=await fetch("/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",...e?{Authorization:"Bearer ".concat(e)}:{}},body:JSON.stringify(a),signal:Q.current.signal});if(!t.ok){let e=await t.text();try{let t=JSON.parse(e);F((null===(s=t.error)||void 0===s?void 0:s.message)||t.message||e)}catch(t){F(e)}L(!1);return}let c=null===(r=t.body)||void 0===r?void 0:r.getReader();if(!c){F("No response body"),L(!1);return}let o=new TextDecoder,d="",u="";for(;;){let{done:e,value:t}=await c.read();if(e)break;let a=(u+=o.decode(t,{stream:!0})).split("\n");for(let e of(u=a.pop()||"",a)){if(!e.startsWith("data: "))continue;let t=e.slice(6).trim();if("[DONE]"!==t)try{let e=JSON.parse(t),a=(null===(i=e.choices)||void 0===i?void 0:null===(l=i[0])||void 0===l?void 0:null===(n=l.delta)||void 0===n?void 0:n.content)||"";a&&(d+=a,D(d))}catch(e){}}}z(e=>[...e,{role:"assistant",content:d}]),D("")}catch(e){e instanceof Error&&"AbortError"!==e.name&&F(e.message)}finally{L(!1),Q.current=null}},[A,v,b,N,k,S,E,_,O]),et=async()=>{let e=[..._].reverse().find(e=>"assistant"===e.role);if(e)try{await navigator.clipboard.writeText(e.content),B(!0),setTimeout(()=>B(!1),2e3)}catch(e){}},ea=e=>{U(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},er=async()=>{if(q.trim()&&0!==H.length){K(!0),F(""),G([]);try{let e=await n.hi.post("/api/playground/compare",{prompt:q.trim(),models:H});G(e.results)}catch(e){F(e instanceof Error?e.message:"Comparison failed")}finally{K(!1)}}},es=e=>e.tokens_in/1e3*.01+e.tokens_out/1e3*.03;return(0,r.jsxs)("div",{className:"flex flex-col h-[calc(100vh-6rem)]",children:[(0,r.jsxs)("div",{className:"page-header flex-shrink-0",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Playground"}),(0,r.jsx)("p",{className:"page-sub",children:"Chat with models and compare responses"})]}),(0,r.jsx)("div",{className:"flex items-center gap-3",children:(0,r.jsxs)("div",{className:"flex gap-1 bg-[var(--surface-100)] p-1 rounded-lg",children:[(0,r.jsx)("button",{className:"px-3 py-1.5 rounded-md text-sm font-medium transition-all ".concat("chat"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("chat"),children:"Chat"}),(0,r.jsx)("button",{className:"px-3 py-1.5 rounded-md text-sm font-medium transition-all ".concat("compare"===e?"bg-[var(--surface)] text-white shadow-sm":"text-[var(--text-secondary)] hover:text-white"),onClick:()=>t("compare"),children:"Compare"})]})})]}),(0,r.jsx)("div",{className:"flex-1 flex gap-4 min-h-0",children:"chat"===e?(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"flex-1 flex flex-col gap-4 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"card flex flex-col gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("label",{className:"label !mb-0",children:"Model"}),(0,r.jsx)("button",{className:"btn-ghost btn-xs",onClick:()=>{n.hi.get("/v1/models").then(e=>{l((e.data||[]).map(e=>({id:e.id})).sort((e,t)=>e.id.localeCompare(t.id)))}).catch(()=>{})},children:"↻ Refresh"})]}),(0,r.jsx)("input",{className:"input",list:"model-list",value:v,onChange:e=>g(e.target.value),placeholder:"Select a model..."}),(0,r.jsx)("datalist",{id:"model-list",children:a.map(e=>(0,r.jsx)("option",{value:e.id},e.id))})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("label",{className:"label",children:"System Prompt"}),(0,r.jsx)("textarea",{className:"input !min-h-[60px]",rows:2,value:N,onChange:e=>w(e.target.value),placeholder:"You are a helpful assistant."})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("button",{className:"btn-ghost btn-sm ".concat(Y?"text-[var(--accent)]":""),onClick:()=>$(!Y),children:[(0,r.jsx)(i,{size:14}),"Parameters"]}),_.length>0&&(0,r.jsxs)("button",{className:"btn-ghost btn-sm text-[var(--text-tertiary)]",onClick:()=>{z([]),D(""),F("")},children:[(0,r.jsx)(c.Z,{size:14})," Clear"]})]}),Y&&(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Temperature"}),(0,r.jsx)("input",{type:"range",min:"0",max:"2",step:"0.05",value:k,onChange:e=>C(parseFloat(e.target.value)),className:"w-full accent-[var(--accent)]"}),(0,r.jsx)("span",{className:"text-xs text-[var(--text-tertiary)]",children:k.toFixed(2)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Max Tokens"}),(0,r.jsx)("input",{className:"input",type:"number",min:"1",max:"16384",value:S,onChange:e=>T(parseInt(e.target.value)||1024)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Top P"}),(0,r.jsx)("input",{type:"range",min:"0",max:"1",step:"0.05",value:E,onChange:e=>Z(parseFloat(e.target.value)),className:"w-full accent-[var(--accent)]"}),(0,r.jsx)("span",{className:"text-xs text-[var(--text-tertiary)]",children:E.toFixed(2)})]})]}),(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("label",{className:"label",children:"Provider Override"}),(0,r.jsxs)("select",{className:"select",value:b,onChange:e=>j(e.target.value),children:[(0,r.jsx)("option",{value:"",children:"Auto-detect"}),f.map(e=>(0,r.jsx)("option",{value:e,children:e},e))]})]})]}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col gap-3 overflow-y-auto min-h-0",children:[0===_.length&&!O&&(0,r.jsxs)("div",{className:"card flex flex-col items-center justify-center py-12 text-center",children:[(0,r.jsx)(o.Z,{size:32,className:"text-[var(--text-tertiary)] mb-3"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"Select a model and start chatting"})]}),_.map((e,t)=>(0,r.jsxs)("div",{className:"card !p-3 ".concat("user"===e.role?"border-nexus-500/20 bg-nexus-500/5":""," ").concat("system"===e.role?"border-yellow-500/20 bg-yellow-500/5":""),children:[(0,r.jsx)("div",{className:"text-xs font-medium uppercase tracking-wider text-[var(--text-tertiary)] mb-1",children:"user"===e.role?"You":"system"===e.role?"System":"Assistant"}),(0,r.jsx)("div",{className:"text-sm whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed",children:e.content})]},t)),O&&M&&(0,r.jsxs)("div",{className:"card !p-3 border border-[var(--accent)]/20",children:[(0,r.jsxs)("div",{className:"text-xs font-medium uppercase tracking-wider text-[var(--text-tertiary)] mb-1",children:["Assistant",(0,r.jsxs)("span",{className:"inline-flex ml-2 gap-0.5",children:[(0,r.jsx)("span",{className:"w-1 h-1 bg-[var(--accent)] rounded-full animate-bounce",style:{animationDelay:"0ms"}}),(0,r.jsx)("span",{className:"w-1 h-1 bg-[var(--accent)] rounded-full animate-bounce",style:{animationDelay:"150ms"}}),(0,r.jsx)("span",{className:"w-1 h-1 bg-[var(--accent)] rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})]}),(0,r.jsx)("div",{className:"text-sm whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed",children:M})]}),(0,r.jsx)("div",{ref:X})]}),R&&(0,r.jsx)("div",{className:"card border border-red-500/30 bg-red-500/5",children:(0,r.jsx)("p",{className:"text-sm text-red-400",children:R})}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("input",{className:"input flex-1",value:A,onChange:e=>P(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ee())},placeholder:"Type a message...",disabled:O||!v}),O?(0,r.jsx)("button",{className:"btn-danger justify-center px-4",onClick:()=>{var e;null===(e=Q.current)||void 0===e||e.abort(),L(!1)},children:"Stop"}):(0,r.jsx)("button",{className:"btn-primary justify-center px-4",onClick:ee,disabled:!A.trim()||!v,children:(0,r.jsx)(o.Z,{size:16})}),_.some(e=>"assistant"===e.role)&&(0,r.jsx)("button",{className:"btn-ghost px-3",onClick:et,title:"Copy last response",children:I?(0,r.jsx)(d.Z,{size:16,className:"text-green-400"}):(0,r.jsx)(u.Z,{size:16})})]})]})}):(0,r.jsxs)("div",{className:"flex-1 flex flex-col gap-4 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"card",children:[(0,r.jsx)("label",{className:"label",children:"Prompt"}),(0,r.jsx)("textarea",{className:"input !min-h-[120px]",rows:4,value:q,onChange:e=>V(e.target.value),placeholder:"Enter a prompt to send to all selected models..."})]}),(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("label",{className:"label !mb-0",children:"Models"}),(0,r.jsxs)("span",{className:"text-xs text-[var(--text-tertiary)]",children:[H.length," selected"]})]}),0===a.length?(0,r.jsx)("p",{className:"text-sm text-[var(--text-tertiary)]",children:"No models available"}):(0,r.jsx)("div",{className:"flex flex-wrap gap-2 max-h-48 overflow-y-auto",children:a.map(e=>(0,r.jsxs)("label",{className:"px-3 py-1.5 rounded-lg text-sm cursor-pointer border transition-all ".concat(H.includes(e.id)?"border-[var(--accent)] bg-[var(--accent)]/10 text-[var(--accent)]":"border-[var(--border)] text-[var(--text-secondary)] hover:border-[var(--text-tertiary)]"),children:[(0,r.jsx)("input",{type:"checkbox",className:"hidden",checked:H.includes(e.id),onChange:()=>ea(e.id)}),e.id]},e.id))})]}),(0,r.jsxs)("button",{className:"btn-primary justify-center py-2.5",onClick:er,disabled:J||!q.trim()||0===H.length,children:[J?(0,r.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,r.jsx)(x.Z,{size:16}),J?" Comparing...":" Compare"]}),W.length>0&&(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:W.map(e=>(0,r.jsxs)("div",{className:"card flex flex-col",children:[(0,r.jsx)("div",{className:"flex items-center justify-between mb-3 pb-2 border-b border-[var(--border)]",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-semibold text-sm",children:e.model}),(0,r.jsx)("span",{className:"text-xs text-[var(--text-tertiary)] ml-2 capitalize",children:e.provider})]})}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto max-h-[300px] mb-3",children:(0,r.jsx)("pre",{className:"text-sm whitespace-pre-wrap text-[var(--text-secondary)] leading-relaxed font-sans",children:e.response_text})}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-2 pt-2 border-t border-[var(--border)]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 text-xs text-[var(--text-tertiary)]",children:[(0,r.jsx)(m.Z,{size:12}),(0,r.jsxs)("span",{children:[e.latency_ms,"ms"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1 text-xs text-[var(--text-tertiary)]",children:[(0,r.jsx)(h,{size:12}),(0,r.jsxs)("span",{children:[e.tokens_in," → ",e.tokens_out]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1 text-xs text-[var(--text-tertiary)]",children:[(0,r.jsx)(p.Z,{size:12}),(0,r.jsxs)("span",{children:["$",es(e).toFixed(6)]})]})]})]},e.model))}),!J&&0===W.length&&!R&&(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(x.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"Select models and enter a prompt to compare."})]})]})})]})}},1837:function(e,t,a){"use strict";a.d(t,{KF:function(){return x},hi:function(){return u},jl:function(){return l},qz:function(){return n}});let r=a(257).env.NEXT_PUBLIC_API_BASE||"";function s(){return localStorage.getItem("nexus_token")}function n(){localStorage.removeItem("nexus_token")}function l(){return!!s()}let i={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.method||"GET",l=s(),d={"Content-Type":"application/json",...t.headers};if(l&&(d.Authorization="Bearer ".concat(l)),"GET"===a&&!l){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in i)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return i[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let a=o.get(e);if(a)return a}let u=(async()=>{let s=await fetch("".concat(r).concat(e),{method:a,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&l&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw n(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let i=await s.json();return"GET"!==a||l||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,i),i})();if("GET"===a&&!l){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var a;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return a=r.access_token,localStorage.setItem("nexus_token",a),r},getMe:()=>d("/api/auth/me"),logout:()=>{n(),c.clear(),window.location.href="/login"}},x=async e=>{let t=s(),a=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!a.ok)throw Error("Failed to download");let n=await a.blob(),l=URL.createObjectURL(n),i=document.createElement("a");i.href=l,i.download=e.split("/").pop()||"export.csv",i.click(),URL.revokeObjectURL(l)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1124)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/presets/page-0fb7b2f1bd7304bf.js b/static/_next/static/chunks/app/presets/page-0fb7b2f1bd7304bf.js deleted file mode 100644 index fb56f12f6281d814e75054548d83533c0ad8d437..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/presets/page-0fb7b2f1bd7304bf.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6782],{2490:function(e,t,r){Promise.resolve().then(r.bind(r,7517))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:d,...p}=e;return(0,n.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:r,strokeWidth:o?24*Number(l)/Number(a):l,className:s("lucide",c),...p},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:o,...c}=r;return(0,n.createElement)(l,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),o),...c})});return r.displayName="".concat(e),r}},1178:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]])},9397:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8930:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var o=[],c=!1,u=-1;function d(){c&&n&&(c=!1,n.length?o=n.concat(o):u=-1,o.length&&p())}function p(){if(!c){var e=l(d);c=!0;for(var t=o.length;t;){for(n=o,o=[];++u1)for(var r=1;r{u(!0),s.hi.get("/api/presets").then(t).finally(()=>u(!1))};(0,a.useEffect)(()=>{N()},[]),a.useEffect(()=>{if(g){let e=setTimeout(()=>y(""),3e3);return()=>clearTimeout(e)}},[g]);let b=e=>{h(e),f({name:e.name,description:e.description||"",model:e.model,provider:e.provider||"",temperature:null!=e.temperature?String(e.temperature):"",max_tokens:null!=e.max_tokens?String(e.max_tokens):"",top_p:null!=e.top_p?String(e.top_p):"",system_prompt:e.system_prompt||""}),p(!0)},k=async()=>{if(x.name.trim()&&x.model.trim()){j(!0);try{let e={name:x.name,model:x.model};x.description&&(e.description=x.description),x.provider&&(e.provider=x.provider),x.temperature&&(e.temperature=parseFloat(x.temperature)),x.max_tokens&&(e.max_tokens=parseInt(x.max_tokens,10)),x.top_p&&(e.top_p=parseFloat(x.top_p)),x.system_prompt&&(e.system_prompt=x.system_prompt),m?(await s.hi.put("/api/presets/".concat(m.id),e),y("Preset updated")):(await s.hi.post("/api/presets",e),y("Preset created")),p(!1),N()}catch(e){y(e instanceof Error?e.message:"Failed to save")}finally{j(!1)}}},w=async e=>{confirm("Delete this preset?")&&(await s.hi.delete("/api/presets/".concat(e)),N(),y("Preset deleted"))};return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Presets"}),(0,n.jsx)("p",{className:"page-sub",children:"Saved model configuration presets"})]}),(0,n.jsxs)("button",{className:"btn-primary",onClick:()=>{h(null),f(c),p(!0)},children:[(0,n.jsx)(i.Z,{size:16})," Create Preset"]})]}),d&&(0,n.jsx)("div",{className:"modal-overlay",onClick:()=>p(!1),children:(0,n.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4",children:m?"Edit Preset":"New Preset"}),(0,n.jsxs)("div",{className:"space-y-4 max-h-[60vh] overflow-y-auto",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Name *"}),(0,n.jsx)("input",{className:"input",value:x.name,onChange:e=>f(t=>({...t,name:e.target.value})),placeholder:"My Preset",autoFocus:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Description"}),(0,n.jsx)("input",{className:"input",value:x.description,onChange:e=>f(t=>({...t,description:e.target.value})),placeholder:"Optional description"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Model *"}),(0,n.jsx)("input",{className:"input",value:x.model,onChange:e=>f(t=>({...t,model:e.target.value})),placeholder:"gpt-4o"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Provider"}),(0,n.jsx)("input",{className:"input",value:x.provider,onChange:e=>f(t=>({...t,provider:e.target.value})),placeholder:"openai"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Temperature"}),(0,n.jsx)("input",{className:"input",type:"number",step:"0.1",min:"0",max:"2",value:x.temperature,onChange:e=>f(t=>({...t,temperature:e.target.value})),placeholder:"0.7"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Max Tokens"}),(0,n.jsx)("input",{className:"input",type:"number",step:"1",min:"1",value:x.max_tokens,onChange:e=>f(t=>({...t,max_tokens:e.target.value})),placeholder:"4096"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Top P"}),(0,n.jsx)("input",{className:"input",type:"number",step:"0.05",min:"0",max:"1",value:x.top_p,onChange:e=>f(t=>({...t,top_p:e.target.value})),placeholder:"1.0"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"System Prompt"}),(0,n.jsx)("textarea",{className:"input min-h-[80px]",value:x.system_prompt,onChange:e=>f(t=>({...t,system_prompt:e.target.value})),placeholder:"You are a helpful assistant..."})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:k,disabled:v,children:v?"Saving...":"Save"}),(0,n.jsx)("button",{className:"btn-ghost",onClick:()=>p(!1),children:"Cancel"})]})]})]})}),r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No presets yet. Create one to save model configurations."})]}):(0,n.jsx)("div",{className:"card p-0",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Name"}),(0,n.jsx)("th",{children:"Description"}),(0,n.jsx)("th",{children:"Model"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Temperature"}),(0,n.jsx)("th",{children:"Max Tokens"}),(0,n.jsx)("th",{children:"Top P"}),(0,n.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,n.jsx)("tbody",{children:e.map(e=>{var t,r,a;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"font-medium",children:e.name}),(0,n.jsx)("td",{className:"text-xs max-w-[180px] truncate text-[var(--text-tertiary)]",title:e.description||"",children:e.description||"-"}),(0,n.jsx)("td",{className:"text-sm max-w-[160px] truncate",title:e.model,children:e.model}),(0,n.jsx)("td",{className:"text-sm capitalize",children:e.provider||"-"}),(0,n.jsx)("td",{className:"text-xs",children:null!==(r=e.temperature)&&void 0!==r?r:"-"}),(0,n.jsx)("td",{className:"text-xs",children:(null===(t=e.max_tokens)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,n.jsx)("td",{className:"text-xs",children:null!==(a=e.top_p)&&void 0!==a?a:"-"}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsxs)("div",{className:"flex gap-1 justify-end",children:[(0,n.jsx)("button",{onClick:()=>b(e),className:"btn-ghost btn-xs",children:"Edit"}),(0,n.jsx)("button",{onClick:()=>w(e.id),className:"btn-danger btn-xs",children:(0,n.jsx)(o.Z,{size:14})})]})})]},e.id)})})]})})}),g&&(0,n.jsx)("div",{className:"toast",children:g})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return p},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=a(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=c.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let l=await a.json();return"GET"!==r||i||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===r&&!i){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{s(),o.clear(),window.location.href="/login"}},p=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let s=await r.blob(),i=URL.createObjectURL(s),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=2490)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/presets/page-dd9839af3202a963.js b/static/_next/static/chunks/app/presets/page-dd9839af3202a963.js new file mode 100644 index 0000000000000000000000000000000000000000..db5332c2da00eb94917054afabd656bdf8e45366 --- /dev/null +++ b/static/_next/static/chunks/app/presets/page-dd9839af3202a963.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6782],{2490:function(e,t,n){Promise.resolve().then(n.bind(n,7517))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:c="",children:u,iconNode:d,...p}=e;return(0,r.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:n,strokeWidth:l?24*Number(o)/Number(a):o,className:s("lucide",c),...p},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),l=(e,t)=>{let n=(0,r.forwardRef)((n,i)=>{let{className:l,...c}=n;return(0,r.createElement)(o,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),l),...c})});return n.displayName="".concat(e),n}},1178:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var l=[],c=!1,u=-1;function d(){c&&r&&(c=!1,r.length?l=r.concat(l):u=-1,l.length&&p())}function p(){if(!c){var e=o(d);c=!0;for(var t=l.length;t;){for(r=l,l=[];++u1)for(var n=1;n{u(!0),s.hi.get("/api/presets").then(t).finally(()=>u(!1))};(0,a.useEffect)(()=>{N()},[]),a.useEffect(()=>{if(j){let e=setTimeout(()=>y(""),3e3);return()=>clearTimeout(e)}},[j]);let b=e=>{h(e),f({name:e.name,description:e.description||"",model:e.model,provider:e.provider||"",temperature:null!=e.temperature?String(e.temperature):"",max_tokens:null!=e.max_tokens?String(e.max_tokens):"",top_p:null!=e.top_p?String(e.top_p):"",system_prompt:e.system_prompt||""}),p(!0)},k=async()=>{if(x.name.trim()&&x.model.trim()){g(!0);try{let e={name:x.name,model:x.model};x.description&&(e.description=x.description),x.provider&&(e.provider=x.provider),x.temperature&&(e.temperature=parseFloat(x.temperature)),x.max_tokens&&(e.max_tokens=parseInt(x.max_tokens,10)),x.top_p&&(e.top_p=parseFloat(x.top_p)),x.system_prompt&&(e.system_prompt=x.system_prompt),m?(await s.hi.put("/api/presets/".concat(m.id),e),y("Preset updated")):(await s.hi.post("/api/presets",e),y("Preset created")),p(!1),N()}catch(e){y(e instanceof Error?e.message:"Failed to save")}finally{g(!1)}}},w=async e=>{confirm("Delete this preset?")&&(await s.hi.delete("/api/presets/".concat(e)),N(),y("Preset deleted"))};return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Presets"}),(0,r.jsx)("p",{className:"page-sub",children:"Saved model configuration presets"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>{h(null),f(c),p(!0)},children:[(0,r.jsx)(i.Z,{size:16})," Create Preset"]})]}),d&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>p(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:m?"Edit Preset":"New Preset"}),(0,r.jsxs)("div",{className:"space-y-4 max-h-[60vh] overflow-y-auto",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name *"}),(0,r.jsx)("input",{className:"input",value:x.name,onChange:e=>f(t=>({...t,name:e.target.value})),placeholder:"My Preset",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Description"}),(0,r.jsx)("input",{className:"input",value:x.description,onChange:e=>f(t=>({...t,description:e.target.value})),placeholder:"Optional description"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Model *"}),(0,r.jsx)("input",{className:"input",value:x.model,onChange:e=>f(t=>({...t,model:e.target.value})),placeholder:"gpt-4o"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Provider"}),(0,r.jsx)("input",{className:"input",value:x.provider,onChange:e=>f(t=>({...t,provider:e.target.value})),placeholder:"openai"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Temperature"}),(0,r.jsx)("input",{className:"input",type:"number",step:"0.1",min:"0",max:"2",value:x.temperature,onChange:e=>f(t=>({...t,temperature:e.target.value})),placeholder:"0.7"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Max Tokens"}),(0,r.jsx)("input",{className:"input",type:"number",step:"1",min:"1",value:x.max_tokens,onChange:e=>f(t=>({...t,max_tokens:e.target.value})),placeholder:"4096"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Top P"}),(0,r.jsx)("input",{className:"input",type:"number",step:"0.05",min:"0",max:"1",value:x.top_p,onChange:e=>f(t=>({...t,top_p:e.target.value})),placeholder:"1.0"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"System Prompt"}),(0,r.jsx)("textarea",{className:"input min-h-[80px]",value:x.system_prompt,onChange:e=>f(t=>({...t,system_prompt:e.target.value})),placeholder:"You are a helpful assistant..."})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:k,disabled:v,children:v?"Saving...":"Save"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>p(!1),children:"Cancel"})]})]})]})}),n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No presets yet. Create one to save model configurations."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Description"}),(0,r.jsx)("th",{children:"Model"}),(0,r.jsx)("th",{children:"Provider"}),(0,r.jsx)("th",{children:"Temperature"}),(0,r.jsx)("th",{children:"Max Tokens"}),(0,r.jsx)("th",{children:"Top P"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>{var t,n,a;return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium",children:e.name}),(0,r.jsx)("td",{className:"text-xs max-w-[180px] truncate text-[var(--text-tertiary)]",title:e.description||"",children:e.description||"-"}),(0,r.jsx)("td",{className:"text-sm max-w-[160px] truncate",title:e.model,children:e.model}),(0,r.jsx)("td",{className:"text-sm capitalize",children:e.provider||"-"}),(0,r.jsx)("td",{className:"text-xs",children:null!==(n=e.temperature)&&void 0!==n?n:"-"}),(0,r.jsx)("td",{className:"text-xs",children:(null===(t=e.max_tokens)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,r.jsx)("td",{className:"text-xs",children:null!==(a=e.top_p)&&void 0!==a?a:"-"}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsxs)("div",{className:"flex gap-1 justify-end",children:[(0,r.jsx)("button",{onClick:()=>b(e),className:"btn-ghost btn-xs",children:"Edit"}),(0,r.jsx)("button",{onClick:()=>w(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(l.Z,{size:14})})]})})]},e.id)})})]})})}),j&&(0,r.jsx)("div",{className:"toast",children:j})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return p},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function s(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=a(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=c.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==n||i||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===n&&!i){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>u("/api/auth/me"),logout:()=>{s(),l.clear(),window.location.href="/login"}},p=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let s=await n.blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=2490)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/presets/page-e75a52cbe12d5661.js b/static/_next/static/chunks/app/presets/page-e75a52cbe12d5661.js deleted file mode 100644 index fb56f12f6281d814e75054548d83533c0ad8d437..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/presets/page-e75a52cbe12d5661.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6782],{2490:function(e,t,r){Promise.resolve().then(r.bind(r,7517))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:d,...p}=e;return(0,n.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:r,strokeWidth:o?24*Number(l)/Number(a):l,className:s("lucide",c),...p},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:o,...c}=r;return(0,n.createElement)(l,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),o),...c})});return r.displayName="".concat(e),r}},1178:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]])},9397:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8930:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var o=[],c=!1,u=-1;function d(){c&&n&&(c=!1,n.length?o=n.concat(o):u=-1,o.length&&p())}function p(){if(!c){var e=l(d);c=!0;for(var t=o.length;t;){for(n=o,o=[];++u1)for(var r=1;r{u(!0),s.hi.get("/api/presets").then(t).finally(()=>u(!1))};(0,a.useEffect)(()=>{N()},[]),a.useEffect(()=>{if(g){let e=setTimeout(()=>y(""),3e3);return()=>clearTimeout(e)}},[g]);let b=e=>{h(e),f({name:e.name,description:e.description||"",model:e.model,provider:e.provider||"",temperature:null!=e.temperature?String(e.temperature):"",max_tokens:null!=e.max_tokens?String(e.max_tokens):"",top_p:null!=e.top_p?String(e.top_p):"",system_prompt:e.system_prompt||""}),p(!0)},k=async()=>{if(x.name.trim()&&x.model.trim()){j(!0);try{let e={name:x.name,model:x.model};x.description&&(e.description=x.description),x.provider&&(e.provider=x.provider),x.temperature&&(e.temperature=parseFloat(x.temperature)),x.max_tokens&&(e.max_tokens=parseInt(x.max_tokens,10)),x.top_p&&(e.top_p=parseFloat(x.top_p)),x.system_prompt&&(e.system_prompt=x.system_prompt),m?(await s.hi.put("/api/presets/".concat(m.id),e),y("Preset updated")):(await s.hi.post("/api/presets",e),y("Preset created")),p(!1),N()}catch(e){y(e instanceof Error?e.message:"Failed to save")}finally{j(!1)}}},w=async e=>{confirm("Delete this preset?")&&(await s.hi.delete("/api/presets/".concat(e)),N(),y("Preset deleted"))};return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Presets"}),(0,n.jsx)("p",{className:"page-sub",children:"Saved model configuration presets"})]}),(0,n.jsxs)("button",{className:"btn-primary",onClick:()=>{h(null),f(c),p(!0)},children:[(0,n.jsx)(i.Z,{size:16})," Create Preset"]})]}),d&&(0,n.jsx)("div",{className:"modal-overlay",onClick:()=>p(!1),children:(0,n.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4",children:m?"Edit Preset":"New Preset"}),(0,n.jsxs)("div",{className:"space-y-4 max-h-[60vh] overflow-y-auto",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Name *"}),(0,n.jsx)("input",{className:"input",value:x.name,onChange:e=>f(t=>({...t,name:e.target.value})),placeholder:"My Preset",autoFocus:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Description"}),(0,n.jsx)("input",{className:"input",value:x.description,onChange:e=>f(t=>({...t,description:e.target.value})),placeholder:"Optional description"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Model *"}),(0,n.jsx)("input",{className:"input",value:x.model,onChange:e=>f(t=>({...t,model:e.target.value})),placeholder:"gpt-4o"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Provider"}),(0,n.jsx)("input",{className:"input",value:x.provider,onChange:e=>f(t=>({...t,provider:e.target.value})),placeholder:"openai"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Temperature"}),(0,n.jsx)("input",{className:"input",type:"number",step:"0.1",min:"0",max:"2",value:x.temperature,onChange:e=>f(t=>({...t,temperature:e.target.value})),placeholder:"0.7"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Max Tokens"}),(0,n.jsx)("input",{className:"input",type:"number",step:"1",min:"1",value:x.max_tokens,onChange:e=>f(t=>({...t,max_tokens:e.target.value})),placeholder:"4096"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Top P"}),(0,n.jsx)("input",{className:"input",type:"number",step:"0.05",min:"0",max:"1",value:x.top_p,onChange:e=>f(t=>({...t,top_p:e.target.value})),placeholder:"1.0"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"System Prompt"}),(0,n.jsx)("textarea",{className:"input min-h-[80px]",value:x.system_prompt,onChange:e=>f(t=>({...t,system_prompt:e.target.value})),placeholder:"You are a helpful assistant..."})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:k,disabled:v,children:v?"Saving...":"Save"}),(0,n.jsx)("button",{className:"btn-ghost",onClick:()=>p(!1),children:"Cancel"})]})]})]})}),r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No presets yet. Create one to save model configurations."})]}):(0,n.jsx)("div",{className:"card p-0",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Name"}),(0,n.jsx)("th",{children:"Description"}),(0,n.jsx)("th",{children:"Model"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Temperature"}),(0,n.jsx)("th",{children:"Max Tokens"}),(0,n.jsx)("th",{children:"Top P"}),(0,n.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,n.jsx)("tbody",{children:e.map(e=>{var t,r,a;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"font-medium",children:e.name}),(0,n.jsx)("td",{className:"text-xs max-w-[180px] truncate text-[var(--text-tertiary)]",title:e.description||"",children:e.description||"-"}),(0,n.jsx)("td",{className:"text-sm max-w-[160px] truncate",title:e.model,children:e.model}),(0,n.jsx)("td",{className:"text-sm capitalize",children:e.provider||"-"}),(0,n.jsx)("td",{className:"text-xs",children:null!==(r=e.temperature)&&void 0!==r?r:"-"}),(0,n.jsx)("td",{className:"text-xs",children:(null===(t=e.max_tokens)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,n.jsx)("td",{className:"text-xs",children:null!==(a=e.top_p)&&void 0!==a?a:"-"}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsxs)("div",{className:"flex gap-1 justify-end",children:[(0,n.jsx)("button",{onClick:()=>b(e),className:"btn-ghost btn-xs",children:"Edit"}),(0,n.jsx)("button",{onClick:()=>w(e.id),className:"btn-danger btn-xs",children:(0,n.jsx)(o.Z,{size:14})})]})})]},e.id)})})]})})}),g&&(0,n.jsx)("div",{className:"toast",children:g})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return p},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=a(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=c.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let l=await a.json();return"GET"!==r||i||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===r&&!i){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{s(),o.clear(),window.location.href="/login"}},p=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let s=await r.blob(),i=URL.createObjectURL(s),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=2490)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/pricing/page-268e5d92bfa33e28.js b/static/_next/static/chunks/app/pricing/page-268e5d92bfa33e28.js deleted file mode 100644 index 49cfefd73659a07ee96df8093941bddec78f3269..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/pricing/page-268e5d92bfa33e28.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9979],{6169:function(e,t,r){Promise.resolve().then(r.bind(r,7889))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:i=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...s,width:i,height:i,stroke:r,strokeWidth:c?24*Number(o)/Number(i):o,className:a("lucide",l),...h},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:c,...l}=r;return(0,n.createElement)(o,{ref:s,iconNode:t,className:a("lucide-".concat(i(e)),c),...l})});return r.displayName="".concat(e),r}},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},5252:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]])},3247:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},257:function(e,t,r){"use strict";var n,i;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(i=r.g.process)?void 0:i.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,i=e.exports={};function a(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c=[],l=!1,u=-1;function d(){l&&n&&(l=!1,n.length?c=n.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(n=c,c=[];++u1)for(var r=1;r{l(!0),a.hi.get("/api/pricing").then(t).catch(e=>d(e instanceof Error?e.message:"Failed to load pricing")).finally(()=>l(!1))},[]);let x=Object.entries(e||{}).filter(e=>{let[t,r]=e;return!h||t.toLowerCase().includes(h.toLowerCase())||r.name.toLowerCase().includes(h.toLowerCase())||r.provider.toLowerCase().includes(h.toLowerCase())});return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Pricing"}),(0,n.jsx)("p",{className:"page-sub",children:"Model pricing by provider"})]}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(s.Z,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)]"}),(0,n.jsx)("input",{className:"input pl-9 max-w-xs",placeholder:"Search models...",value:h,onChange:e=>p(()=>f(e.target.value))})]})]}),u?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,n.jsx)("p",{className:"text-red-400",children:u})]}):r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-48 w-full"})}):e&&0!==x.length?(0,n.jsx)("div",{className:"card p-0",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Model ID"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Context Window"}),(0,n.jsx)("th",{children:"Input / 1M tokens"}),(0,n.jsx)("th",{children:"Output / 1M tokens"}),(0,n.jsx)("th",{children:"Capabilities"})]})}),(0,n.jsx)("tbody",{children:x.map(e=>{var t;let[r,i]=e;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"font-medium text-sm max-w-[240px] truncate",title:r,children:r}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"capitalize text-sm",children:i.provider})}),(0,n.jsx)("td",{className:"text-xs",children:(null===(t=i.context_window)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,n.jsxs)("td",{className:"font-mono text-xs",children:["$",Number(i.input_per_1m).toFixed(2)]}),(0,n.jsxs)("td",{className:"font-mono text-xs",children:["$",Number(i.output_per_1m).toFixed(2)]}),(0,n.jsx)("td",{children:(0,n.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[i.is_free&&(0,n.jsx)("span",{className:"badge-green text-xs",children:"free"}),i.supports_vision&&(0,n.jsx)("span",{className:"badge-blue text-xs",children:"vision"}),i.supports_tools&&(0,n.jsx)("span",{className:"badge-yellow text-xs",children:"tools"})]})})]},r)})})]})})}):(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No pricing data available."})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return s},qz:function(){return a}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function i(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function s(){return!!i()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",s=i(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===r&&!s){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=l.get(e);if(r)return r}let d=(async()=>{let i=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let o=await i.json();return"GET"!==r||s||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===r&&!s){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{a(),c.clear(),window.location.href="/login"}},h=async e=>{let t=i(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let a=await r.blob(),s=URL.createObjectURL(a),o=document.createElement("a");o.href=s,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=6169)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/pricing/page-71ebf02060044864.js b/static/_next/static/chunks/app/pricing/page-71ebf02060044864.js new file mode 100644 index 0000000000000000000000000000000000000000..cd84bd969ef48c94ccc026c936eaf21b19a270bf --- /dev/null +++ b/static/_next/static/chunks/app/pricing/page-71ebf02060044864.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9979],{6169:function(e,t,n){Promise.resolve().then(n.bind(n,7889))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),o=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...a,width:i,height:i,stroke:n,strokeWidth:c?24*Number(s)/Number(i):s,className:o("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,a)=>{let{className:c,...l}=n;return(0,r.createElement)(s,{ref:a,iconNode:t,className:o("lucide-".concat(i(e)),c),...l})});return n.displayName="".concat(e),n}},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},5252:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]])},3247:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},257:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function o(){throw Error("setTimeout has not been defined")}function a(){throw Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var c=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?c=r.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=s(d);l=!0;for(var t=c.length;t;){for(r=c,c=[];++u1)for(var n=1;n{l(!0),o.hi.get("/api/pricing").then(t).catch(e=>d(e instanceof Error?e.message:"Failed to load pricing")).finally(()=>l(!1))},[]);let x=Object.entries(e||{}).filter(e=>{let[t,n]=e;return!h||t.toLowerCase().includes(h.toLowerCase())||n.name.toLowerCase().includes(h.toLowerCase())||n.provider.toLowerCase().includes(h.toLowerCase())});return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Pricing"}),(0,r.jsx)("p",{className:"page-sub",children:"Model pricing by provider"})]}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(a.Z,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)]"}),(0,r.jsx)("input",{className:"input pl-9 max-w-xs",placeholder:"Search models...",value:h,onChange:e=>p(()=>f(e.target.value))})]})]}),u?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(s.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:u})]}):n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-48 w-full"})}):e&&0!==x.length?(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Model ID"}),(0,r.jsx)("th",{children:"Provider"}),(0,r.jsx)("th",{children:"Context Window"}),(0,r.jsx)("th",{children:"Input / 1M tokens"}),(0,r.jsx)("th",{children:"Output / 1M tokens"}),(0,r.jsx)("th",{children:"Capabilities"})]})}),(0,r.jsx)("tbody",{children:x.map(e=>{var t;let[n,i]=e;return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium text-sm max-w-[240px] truncate",title:n,children:n}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"capitalize text-sm",children:i.provider})}),(0,r.jsx)("td",{className:"text-xs",children:(null===(t=i.context_window)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,r.jsxs)("td",{className:"font-mono text-xs",children:["$",Number(i.input_per_1m).toFixed(2)]}),(0,r.jsxs)("td",{className:"font-mono text-xs",children:["$",Number(i.output_per_1m).toFixed(2)]}),(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[i.is_free&&(0,r.jsx)("span",{className:"badge-green text-xs",children:"free"}),i.supports_vision&&(0,r.jsx)("span",{className:"badge-blue text-xs",children:"vision"}),i.supports_tools&&(0,r.jsx)("span",{className:"badge-yellow text-xs",children:"tools"})]})})]},n)})})]})})}):(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No pricing data available."})]})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return a},qz:function(){return o}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function i(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function o(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function a(){return!!i()}let s={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",a=i(),u={"Content-Type":"application/json",...t.headers};if(a&&(u.Authorization="Bearer ".concat(a)),"GET"===n&&!a){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in s)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return s[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let i=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&a&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw o(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let s=await i.json();return"GET"!==n||a||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,s),s})();if("GET"===n&&!a){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>u("/api/auth/me"),logout:()=>{o(),c.clear(),window.location.href="/login"}},h=async e=>{let t=i(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let o=await n.blob(),a=URL.createObjectURL(o),s=document.createElement("a");s.href=a,s.download=e.split("/").pop()||"export.csv",s.click(),URL.revokeObjectURL(a)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=6169)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/pricing/page-9f2846c18c318db8.js b/static/_next/static/chunks/app/pricing/page-9f2846c18c318db8.js deleted file mode 100644 index 49cfefd73659a07ee96df8093941bddec78f3269..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/pricing/page-9f2846c18c318db8.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9979],{6169:function(e,t,r){Promise.resolve().then(r.bind(r,7889))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:i=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...s,width:i,height:i,stroke:r,strokeWidth:c?24*Number(o)/Number(i):o,className:a("lucide",l),...h},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:c,...l}=r;return(0,n.createElement)(o,{ref:s,iconNode:t,className:a("lucide-".concat(i(e)),c),...l})});return r.displayName="".concat(e),r}},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},5252:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]])},3247:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},257:function(e,t,r){"use strict";var n,i;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(i=r.g.process)?void 0:i.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,i=e.exports={};function a(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c=[],l=!1,u=-1;function d(){l&&n&&(l=!1,n.length?c=n.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(n=c,c=[];++u1)for(var r=1;r{l(!0),a.hi.get("/api/pricing").then(t).catch(e=>d(e instanceof Error?e.message:"Failed to load pricing")).finally(()=>l(!1))},[]);let x=Object.entries(e||{}).filter(e=>{let[t,r]=e;return!h||t.toLowerCase().includes(h.toLowerCase())||r.name.toLowerCase().includes(h.toLowerCase())||r.provider.toLowerCase().includes(h.toLowerCase())});return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Pricing"}),(0,n.jsx)("p",{className:"page-sub",children:"Model pricing by provider"})]}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(s.Z,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)]"}),(0,n.jsx)("input",{className:"input pl-9 max-w-xs",placeholder:"Search models...",value:h,onChange:e=>p(()=>f(e.target.value))})]})]}),u?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,n.jsx)("p",{className:"text-red-400",children:u})]}):r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-48 w-full"})}):e&&0!==x.length?(0,n.jsx)("div",{className:"card p-0",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Model ID"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Context Window"}),(0,n.jsx)("th",{children:"Input / 1M tokens"}),(0,n.jsx)("th",{children:"Output / 1M tokens"}),(0,n.jsx)("th",{children:"Capabilities"})]})}),(0,n.jsx)("tbody",{children:x.map(e=>{var t;let[r,i]=e;return(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"font-medium text-sm max-w-[240px] truncate",title:r,children:r}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"capitalize text-sm",children:i.provider})}),(0,n.jsx)("td",{className:"text-xs",children:(null===(t=i.context_window)||void 0===t?void 0:t.toLocaleString())||"-"}),(0,n.jsxs)("td",{className:"font-mono text-xs",children:["$",Number(i.input_per_1m).toFixed(2)]}),(0,n.jsxs)("td",{className:"font-mono text-xs",children:["$",Number(i.output_per_1m).toFixed(2)]}),(0,n.jsx)("td",{children:(0,n.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[i.is_free&&(0,n.jsx)("span",{className:"badge-green text-xs",children:"free"}),i.supports_vision&&(0,n.jsx)("span",{className:"badge-blue text-xs",children:"vision"}),i.supports_tools&&(0,n.jsx)("span",{className:"badge-yellow text-xs",children:"tools"})]})})]},r)})})]})})}):(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No pricing data available."})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return s},qz:function(){return a}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function i(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function s(){return!!i()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",s=i(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===r&&!s){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=l.get(e);if(r)return r}let d=(async()=>{let i=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let o=await i.json();return"GET"!==r||s||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===r&&!s){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{a(),c.clear(),window.location.href="/login"}},h=async e=>{let t=i(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let a=await r.blob(),s=URL.createObjectURL(a),o=document.createElement("a");o.href=s,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=6169)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/prompt-templates/page-8b45083831cf0f9f.js b/static/_next/static/chunks/app/prompt-templates/page-8b45083831cf0f9f.js new file mode 100644 index 0000000000000000000000000000000000000000..2fdf4d92c6cc68e4bd6c3cfccb55de59e840954e --- /dev/null +++ b/static/_next/static/chunks/app/prompt-templates/page-8b45083831cf0f9f.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1820],{6623:function(e,t,n){Promise.resolve().then(n.bind(n,7416))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var a=n(2265);let r=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,a.forwardRef)((e,t)=>{let{color:n="currentColor",size:r=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,a.createElement)("svg",{ref:t,...i,width:r,height:r,stroke:n,strokeWidth:c?24*Number(o)/Number(r):o,className:s("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,a.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let n=(0,a.forwardRef)((n,i)=>{let{className:c,...l}=n;return(0,a.createElement)(o,{ref:i,iconNode:t,className:s("lucide-".concat(r(e)),c),...l})});return n.displayName="".concat(e),n}},8736:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var a,r;e.exports=(null==(a=n.g.process)?void 0:a.env)&&"object"==typeof(null==(r=n.g.process)?void 0:r.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,a,r=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var c=[],l=!1,u=-1;function d(){l&&a&&(l=!1,a.length?c=a.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(a=c,c=[];++u1)for(var n=1;n{d(!0),s.hi.get("/api/prompt-templates").then(t).finally(()=>d(!1))};(0,r.useEffect)(()=>{w()},[]),r.useEffect(()=>{if(j){let e=setTimeout(()=>b(""),3e3);return()=>clearTimeout(e)}},[j]);let k=e=>{f(e.id),y({name:e.name,description:e.description||"",system_prompt:e.system_prompt}),p(!0)},N=async()=>{if(x.name.trim()&&x.system_prompt.trim()){g(!0);try{m?(await s.hi.put("/api/prompt-templates/".concat(m),x),b("Template updated")):(await s.hi.post("/api/prompt-templates",x),b("Template created")),p(!1),w()}catch(e){b(e instanceof Error?e.message:"Failed to save")}finally{g(!1)}}},T=async e=>{await s.hi.patch("/api/prompt-templates/".concat(e,"/toggle")),w(),b("Template toggled")},E=async e=>{confirm("Delete this prompt template?")&&(await s.hi.delete("/api/prompt-templates/".concat(e)),w(),b("Template deleted"))},_=(e,t)=>e?e.length>t?e.slice(0,t)+"...":e:"-";return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"page-header",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"Prompt Templates"}),(0,a.jsx)("p",{className:"page-sub",children:"Manage reusable system prompt templates"})]}),(0,a.jsxs)("button",{className:"btn-primary",onClick:()=>{f(null),y(u),p(!0)},children:[(0,a.jsx)(i.Z,{size:16})," Create Template"]})]}),h&&(0,a.jsx)("div",{className:"modal-overlay",onClick:()=>p(!1),children:(0,a.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("h2",{className:"text-lg font-semibold mb-4",children:m?"Edit Template":"New Template"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Name"}),(0,a.jsx)("input",{className:"input",value:x.name,onChange:e=>y(t=>({...t,name:e.target.value})),placeholder:"Template name",autoFocus:!0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Description"}),(0,a.jsx)("input",{className:"input",value:x.description,onChange:e=>y(t=>({...t,description:e.target.value})),placeholder:"What is this template for?"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"System Prompt"}),(0,a.jsx)("textarea",{className:"input font-mono",rows:10,value:x.system_prompt,onChange:e=>y(t=>({...t,system_prompt:e.target.value})),placeholder:"You are a helpful assistant that..."})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("button",{className:"btn-primary flex-1 justify-center",onClick:N,disabled:v,children:[v?(0,a.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):null,m?"Update":"Create"]}),(0,a.jsx)("button",{className:"btn-ghost",onClick:()=>p(!1),children:"Cancel"})]})]})]})}),n?(0,a.jsx)("div",{className:"card",children:(0,a.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,a.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No prompt templates yet. Create one to get started."})]}):(0,a.jsx)("div",{className:"card p-0",children:(0,a.jsx)("div",{className:"table-wrap",children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Name"}),(0,a.jsx)("th",{children:"Description"}),(0,a.jsx)("th",{children:"System Prompt"}),(0,a.jsx)("th",{children:"Used"}),(0,a.jsx)("th",{children:"Status"}),(0,a.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,a.jsx)("tbody",{children:e.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"font-medium",children:e.name}),(0,a.jsx)("td",{className:"max-w-[200px] truncate text-sm text-[var(--text-secondary)]",title:e.description||"",children:_(e.description,60)}),(0,a.jsx)("td",{className:"max-w-[300px] truncate text-sm font-mono text-[var(--text-tertiary)]",title:e.system_prompt,children:_(e.system_prompt,80)}),(0,a.jsx)("td",{className:"text-sm",children:e.times_used}),(0,a.jsx)("td",{children:(0,a.jsx)("button",{onClick:()=>T(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,a.jsx)("td",{className:"text-right",children:(0,a.jsxs)("div",{className:"flex gap-1 justify-end",children:[(0,a.jsx)("button",{onClick:()=>k(e),className:"btn-ghost btn-xs",children:(0,a.jsx)(c,{size:14})}),(0,a.jsx)("button",{onClick:()=>T(e.id),className:"btn-ghost btn-xs",children:e.is_active?"Disable":"Enable"}),(0,a.jsx)("button",{onClick:()=>E(e.id),className:"btn-danger btn-xs",children:(0,a.jsx)(l.Z,{size:14})})]})})]},e.id))})]})})}),j&&(0,a.jsx)("div",{className:"toast",children:j})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let a=n(257).env.NEXT_PUBLIC_API_BASE||"";function r(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function s(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!r()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=r(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let r=await fetch("".concat(a).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return r;if(401===r.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!r.ok)throw Error((await r.json().catch(()=>({detail:r.statusText}))).detail||"HTTP ".concat(r.status));if(204===r.status)return;let o=await r.json();return"GET"!==n||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===n&&!i){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let a=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=a.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),a},getMe:()=>u("/api/auth/me"),logout:()=>{s(),c.clear(),window.location.href="/login"}},h=async e=>{let t=r(),n=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let s=await n.blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=6623)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/prompt-templates/page-d7b73ef5e135a78f.js b/static/_next/static/chunks/app/prompt-templates/page-d7b73ef5e135a78f.js deleted file mode 100644 index 0f072c1ce10967340c90efc906585f5f76f924d4..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/prompt-templates/page-d7b73ef5e135a78f.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1820],{6623:function(e,t,n){Promise.resolve().then(n.bind(n,7416))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:c="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:n,strokeWidth:l?24*Number(o)/Number(a):o,className:s("lucide",c),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),l=(e,t)=>{let n=(0,r.forwardRef)((n,i)=>{let{className:l,...c}=n;return(0,r.createElement)(o,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),l),...c})});return n.displayName="".concat(e),n}},8736:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var l=[],c=!1,u=-1;function d(){c&&r&&(c=!1,r.length?l=r.concat(l):u=-1,l.length&&h())}function h(){if(!c){var e=o(d);c=!0;for(var t=l.length;t;){for(r=l,l=[];++u1)for(var n=1;n{d(!0),s.hi.get("/api/prompt-templates").then(t).finally(()=>d(!1))};(0,a.useEffect)(()=>{w()},[]),a.useEffect(()=>{if(j){let e=setTimeout(()=>b(""),3e3);return()=>clearTimeout(e)}},[j]);let N=e=>{f(e.id),y({name:e.name,description:e.description||"",system_prompt:e.system_prompt}),p(!0)},k=async()=>{if(x.name.trim()&&x.system_prompt.trim()){g(!0);try{m?(await s.hi.put("/api/prompt-templates/".concat(m),x),b("Template updated")):(await s.hi.post("/api/prompt-templates",x),b("Template created")),p(!1),w()}catch(e){b(e instanceof Error?e.message:"Failed to save")}finally{g(!1)}}},T=async e=>{await s.hi.patch("/api/prompt-templates/".concat(e,"/toggle")),w(),b("Template toggled")},E=async e=>{confirm("Delete this prompt template?")&&(await s.hi.delete("/api/prompt-templates/".concat(e)),w(),b("Template deleted"))},_=(e,t)=>e?e.length>t?e.slice(0,t)+"...":e:"-";return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Prompt Templates"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage reusable system prompt templates"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>{f(null),y(u),p(!0)},children:[(0,r.jsx)(i.Z,{size:16})," Create Template"]})]}),h&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>p(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:m?"Edit Template":"New Template"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name"}),(0,r.jsx)("input",{className:"input",value:x.name,onChange:e=>y(t=>({...t,name:e.target.value})),placeholder:"Template name",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Description"}),(0,r.jsx)("input",{className:"input",value:x.description,onChange:e=>y(t=>({...t,description:e.target.value})),placeholder:"What is this template for?"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"System Prompt"}),(0,r.jsx)("textarea",{className:"input font-mono",rows:10,value:x.system_prompt,onChange:e=>y(t=>({...t,system_prompt:e.target.value})),placeholder:"You are a helpful assistant that..."})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsxs)("button",{className:"btn-primary flex-1 justify-center",onClick:k,disabled:v,children:[v?(0,r.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):null,m?"Update":"Create"]}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>p(!1),children:"Cancel"})]})]})]})}),n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No prompt templates yet. Create one to get started."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Description"}),(0,r.jsx)("th",{children:"System Prompt"}),(0,r.jsx)("th",{children:"Used"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium",children:e.name}),(0,r.jsx)("td",{className:"max-w-[200px] truncate text-sm text-[var(--text-secondary)]",title:e.description||"",children:_(e.description,60)}),(0,r.jsx)("td",{className:"max-w-[300px] truncate text-sm font-mono text-[var(--text-tertiary)]",title:e.system_prompt,children:_(e.system_prompt,80)}),(0,r.jsx)("td",{className:"text-sm",children:e.times_used}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>T(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsxs)("div",{className:"flex gap-1 justify-end",children:[(0,r.jsx)("button",{onClick:()=>N(e),className:"btn-ghost btn-xs",children:(0,r.jsx)(l,{size:14})}),(0,r.jsx)("button",{onClick:()=>T(e.id),className:"btn-ghost btn-xs",children:e.is_active?"Disable":"Enable"}),(0,r.jsx)("button",{onClick:()=>E(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(c.Z,{size:14})})]})})]},e.id))})]})})}),j&&(0,r.jsx)("div",{className:"toast",children:j})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=a(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=c.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==n||i||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===n&&!i){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>u("/api/auth/me"),logout:()=>{s(),l.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let s=await n.blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=6623)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/prompt-templates/page-de4025af16d978a0.js b/static/_next/static/chunks/app/prompt-templates/page-de4025af16d978a0.js deleted file mode 100644 index 0f072c1ce10967340c90efc906585f5f76f924d4..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/prompt-templates/page-de4025af16d978a0.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1820],{6623:function(e,t,n){Promise.resolve().then(n.bind(n,7416))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:c="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:n,strokeWidth:l?24*Number(o)/Number(a):o,className:s("lucide",c),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),l=(e,t)=>{let n=(0,r.forwardRef)((n,i)=>{let{className:l,...c}=n;return(0,r.createElement)(o,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),l),...c})});return n.displayName="".concat(e),n}},8736:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var l=[],c=!1,u=-1;function d(){c&&r&&(c=!1,r.length?l=r.concat(l):u=-1,l.length&&h())}function h(){if(!c){var e=o(d);c=!0;for(var t=l.length;t;){for(r=l,l=[];++u1)for(var n=1;n{d(!0),s.hi.get("/api/prompt-templates").then(t).finally(()=>d(!1))};(0,a.useEffect)(()=>{w()},[]),a.useEffect(()=>{if(j){let e=setTimeout(()=>b(""),3e3);return()=>clearTimeout(e)}},[j]);let N=e=>{f(e.id),y({name:e.name,description:e.description||"",system_prompt:e.system_prompt}),p(!0)},k=async()=>{if(x.name.trim()&&x.system_prompt.trim()){g(!0);try{m?(await s.hi.put("/api/prompt-templates/".concat(m),x),b("Template updated")):(await s.hi.post("/api/prompt-templates",x),b("Template created")),p(!1),w()}catch(e){b(e instanceof Error?e.message:"Failed to save")}finally{g(!1)}}},T=async e=>{await s.hi.patch("/api/prompt-templates/".concat(e,"/toggle")),w(),b("Template toggled")},E=async e=>{confirm("Delete this prompt template?")&&(await s.hi.delete("/api/prompt-templates/".concat(e)),w(),b("Template deleted"))},_=(e,t)=>e?e.length>t?e.slice(0,t)+"...":e:"-";return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Prompt Templates"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage reusable system prompt templates"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>{f(null),y(u),p(!0)},children:[(0,r.jsx)(i.Z,{size:16})," Create Template"]})]}),h&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>p(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:m?"Edit Template":"New Template"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name"}),(0,r.jsx)("input",{className:"input",value:x.name,onChange:e=>y(t=>({...t,name:e.target.value})),placeholder:"Template name",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Description"}),(0,r.jsx)("input",{className:"input",value:x.description,onChange:e=>y(t=>({...t,description:e.target.value})),placeholder:"What is this template for?"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"System Prompt"}),(0,r.jsx)("textarea",{className:"input font-mono",rows:10,value:x.system_prompt,onChange:e=>y(t=>({...t,system_prompt:e.target.value})),placeholder:"You are a helpful assistant that..."})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsxs)("button",{className:"btn-primary flex-1 justify-center",onClick:k,disabled:v,children:[v?(0,r.jsx)("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):null,m?"Update":"Create"]}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>p(!1),children:"Cancel"})]})]})]})}),n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No prompt templates yet. Create one to get started."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Description"}),(0,r.jsx)("th",{children:"System Prompt"}),(0,r.jsx)("th",{children:"Used"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium",children:e.name}),(0,r.jsx)("td",{className:"max-w-[200px] truncate text-sm text-[var(--text-secondary)]",title:e.description||"",children:_(e.description,60)}),(0,r.jsx)("td",{className:"max-w-[300px] truncate text-sm font-mono text-[var(--text-tertiary)]",title:e.system_prompt,children:_(e.system_prompt,80)}),(0,r.jsx)("td",{className:"text-sm",children:e.times_used}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>T(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsxs)("div",{className:"flex gap-1 justify-end",children:[(0,r.jsx)("button",{onClick:()=>N(e),className:"btn-ghost btn-xs",children:(0,r.jsx)(l,{size:14})}),(0,r.jsx)("button",{onClick:()=>T(e.id),className:"btn-ghost btn-xs",children:e.is_active?"Disable":"Enable"}),(0,r.jsx)("button",{onClick:()=>E(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(c.Z,{size:14})})]})})]},e.id))})]})})}),j&&(0,r.jsx)("div",{className:"toast",children:j})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,c=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=a(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=c.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==n||i||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===n&&!i){c.set(e,d);try{return await d}finally{c.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>u("/api/auth/me"),logout:()=>{s(),l.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let s=await n.blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=6623)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/provider-keys/page-315aa0b9e4487251.js b/static/_next/static/chunks/app/provider-keys/page-315aa0b9e4487251.js deleted file mode 100644 index 310715064648b1297ae16b5a0213bd2db27dba41..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/provider-keys/page-315aa0b9e4487251.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2705],{5837:function(e,t,r){Promise.resolve().then(r.bind(r,2180))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,n.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:r,strokeWidth:c?24*Number(l)/Number(a):l,className:s("lucide",o),...h},[...u.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:c,...o}=r;return(0,n.createElement)(l,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),c),...o})});return r.displayName="".concat(e),r}},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},3276:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},9397:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},6137:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},8930:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var c=[],o=!1,d=-1;function u(){o&&n&&(o=!1,n.length?c=n.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(n=c,c=[];++d1)for(var r=1;r{f(!0),v(""),Promise.all([s.hi.get("/api/keys"),s.hi.get("/api/providers")]).then(e=>{let[r,n]=e;t(r),o(Object.keys(n))}).catch(e=>v(e instanceof Error?e.message:"Failed to load provider keys")).finally(()=>f(!1))};(0,a.useEffect)(()=>{E()},[]);let P=async()=>{if(_.api_key)try{await s.hi.post("/api/keys",{provider:_.provider,name:_.name||_.provider,api_key:_.api_key,base_url:_.base_url||void 0,rpm_limit:_.rpm,tpm_limit:_.tpm,cost_budget:_.budget}),j(!1),C(T),E(),k("Key created")}catch(e){k(e instanceof Error?e.message:"Failed")}},A=async e=>{confirm("Delete this key?")&&(await s.hi.delete("/api/keys/".concat(e)),E(),k("Key deleted"))},L=async e=>{await s.hi.patch("/api/keys/".concat(e,"/toggle")),E()},Z=async e=>{w(e);try{let t=await s.hi.post("/api/keys/".concat(e,"/test"));k(t.ok?"✅ Healthy":"❌ ".concat(t.message))}catch(e){k(e instanceof Error?e.message:"Test failed")}finally{w(null)}},S=async e=>{try{await s.hi.post("/api/keys/".concat(e,"/clear-cooldown")),k("Cooldown cleared"),E()}catch(e){k(e instanceof Error?e.message:"Failed to clear cooldown")}};return a.useEffect(()=>{if(b){let e=setTimeout(()=>k(""),3e3);return()=>clearTimeout(e)}},[b]),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Provider Keys"}),(0,n.jsx)("p",{className:"page-sub",children:"Manage upstream API provider keys"})]}),(0,n.jsxs)("button",{className:"btn-primary",onClick:()=>j(!0),children:[(0,n.jsx)(i.Z,{size:16})," Add Key"]})]}),g&&(0,n.jsx)("div",{className:"modal-overlay",onClick:()=>j(!1),children:(0,n.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Add Provider Key"}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Provider"}),(0,n.jsx)("select",{className:"select",value:_.provider,onChange:e=>C(t=>({...t,provider:e.target.value})),children:r.map(e=>(0,n.jsx)("option",{value:e,children:e},e))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Name (optional, defaults to provider)"}),(0,n.jsx)("input",{className:"input",value:_.name,onChange:e=>C(t=>({...t,name:e.target.value}))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"API Key"}),(0,n.jsx)("input",{className:"input",value:_.api_key,onChange:e=>C(t=>({...t,api_key:e.target.value})),autoFocus:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Base URL (optional)"}),(0,n.jsx)("input",{className:"input",value:_.base_url,onChange:e=>C(t=>({...t,base_url:e.target.value})),placeholder:"https://..."})]}),(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"RPM Limit"}),(0,n.jsx)("input",{className:"input",type:"number",value:_.rpm,onChange:e=>C(t=>({...t,rpm:Number(e.target.value)}))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"TPM Limit"}),(0,n.jsx)("input",{className:"input",type:"number",value:_.tpm,onChange:e=>C(t=>({...t,tpm:Number(e.target.value)}))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Budget ($)"}),(0,n.jsx)("input",{className:"input",type:"number",step:"0.01",value:_.budget,onChange:e=>C(t=>({...t,budget:Number(e.target.value)}))})]})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:P,children:"Add Key"}),(0,n.jsx)("button",{className:"btn-ghost",onClick:()=>j(!1),children:"Cancel"})]})]})]})}),y?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,n.jsx)("p",{className:"text-red-400",children:y})]}):x?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No provider keys yet. Add one to start routing requests."})]}):(0,n.jsx)("div",{className:"card p-0",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Name"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Key"}),(0,n.jsx)("th",{children:"Limits"}),(0,n.jsx)("th",{children:"Usage"}),(0,n.jsx)("th",{children:"Status"}),(0,n.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,n.jsx)("tbody",{children:e.map(e=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"font-medium",children:e.name}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"capitalize",children:e.provider})}),(0,n.jsx)("td",{children:(0,n.jsx)("code",{className:"text-xs font-mono text-[var(--text-tertiary)]",children:e.api_key_masked})}),(0,n.jsxs)("td",{className:"text-xs",children:["RPM: ",e.rpm_limit||"∞"," \xb7 TPM: ",e.tpm_limit||"∞"," \xb7 $",e.cost_budget||"∞"]}),(0,n.jsxs)("td",{className:"text-xs",children:[e.total_requests," req \xb7 $",e.total_cost.toFixed(4)]}),(0,n.jsx)("td",{children:e.cooldown_until?(0,n.jsx)("span",{className:"badge-yellow",children:"Cooldown"}):e.is_active?(0,n.jsx)("span",{className:"badge-green",children:"Active"}):(0,n.jsx)("span",{className:"badge-red",children:"Disabled"})}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[e.cooldown_until&&(0,n.jsx)("button",{onClick:()=>S(e.id),className:"btn-ghost btn-xs",title:"Clear cooldown",children:(0,n.jsx)(d,{size:14})}),(0,n.jsx)("button",{onClick:()=>Z(e.id),disabled:N===e.id,className:"btn-ghost btn-xs",children:N===e.id?(0,n.jsx)("span",{className:"w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,n.jsx)(u.Z,{size:14})}),(0,n.jsx)("button",{onClick:()=>L(e.id),className:"btn-ghost btn-xs",children:e.is_active?(0,n.jsx)(h,{size:14}):(0,n.jsx)(m,{size:14})}),(0,n.jsx)("button",{onClick:()=>A(e.id),className:"btn-danger btn-xs",children:(0,n.jsx)(p.Z,{size:14})})]})})]},e.id))})]})})}),b&&(0,n.jsx)("div",{className:"toast",children:b})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return s}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=a(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let u=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let l=await a.json();return"GET"!==r||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===r&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>d("/api/auth/me"),logout:()=>{s(),c.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let s=await r.blob(),i=URL.createObjectURL(s),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=5837)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/provider-keys/page-37e31932382ae6c2.js b/static/_next/static/chunks/app/provider-keys/page-37e31932382ae6c2.js new file mode 100644 index 0000000000000000000000000000000000000000..e5bdbf19decf541404ad4b12352b05b64a3cb265 --- /dev/null +++ b/static/_next/static/chunks/app/provider-keys/page-37e31932382ae6c2.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2705],{5837:function(e,t,n){Promise.resolve().then(n.bind(n,2180))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:o="",children:d,iconNode:u,...h}=e;return(0,r.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:n,strokeWidth:l?24*Number(c)/Number(a):c,className:i("lucide",o),...h},[...u.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let n=(0,r.forwardRef)((n,s)=>{let{className:l,...o}=n;return(0,r.createElement)(c,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),l),...o})});return n.displayName="".concat(e),n}},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},3276:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},6137:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var l=[],o=!1,d=-1;function u(){o&&r&&(o=!1,r.length?l=r.concat(l):d=-1,l.length&&h())}function h(){if(!o){var e=c(u);o=!0;for(var t=l.length;t;){for(r=l,l=[];++d1)for(var n=1;n{f(!0),v(""),Promise.all([i.hi.get("/api/keys"),i.hi.get("/api/providers")]).then(e=>{let[n,r]=e;t(n),o(Object.keys(r))}).catch(e=>v(e instanceof Error?e.message:"Failed to load provider keys")).finally(()=>f(!1))};(0,a.useEffect)(()=>{E()},[]);let P=async()=>{if(T.api_key)try{await i.hi.post("/api/keys",{provider:T.provider,name:T.name||T.provider,api_key:T.api_key,base_url:T.base_url||void 0,rpm_limit:T.rpm,tpm_limit:T.tpm,cost_budget:T.budget}),j(!1),C(_),E(),k("Key created")}catch(e){k(e instanceof Error?e.message:"Failed")}},L=async e=>{confirm("Delete this key?")&&(await i.hi.delete("/api/keys/".concat(e)),E(),k("Key deleted"))},S=async e=>{await i.hi.patch("/api/keys/".concat(e,"/toggle")),E()},A=async e=>{N(e);try{let t=await i.hi.post("/api/keys/".concat(e,"/test"));k(t.ok?"✅ Healthy":"❌ ".concat(t.message))}catch(e){k(e instanceof Error?e.message:"Test failed")}finally{N(null)}},Z=async e=>{try{await i.hi.post("/api/keys/".concat(e,"/clear-cooldown")),k("Cooldown cleared"),E()}catch(e){k(e instanceof Error?e.message:"Failed to clear cooldown")}};return a.useEffect(()=>{if(b){let e=setTimeout(()=>k(""),3e3);return()=>clearTimeout(e)}},[b]),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Provider Keys"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage upstream API provider keys"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>j(!0),children:[(0,r.jsx)(s.Z,{size:16})," Add Key"]})]}),g&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>j(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Add Provider Key"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Provider"}),(0,r.jsx)("select",{className:"select",value:T.provider,onChange:e=>C(t=>({...t,provider:e.target.value})),children:n.map(e=>(0,r.jsx)("option",{value:e,children:e},e))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name (optional, defaults to provider)"}),(0,r.jsx)("input",{className:"input",value:T.name,onChange:e=>C(t=>({...t,name:e.target.value}))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"API Key"}),(0,r.jsx)("input",{className:"input",value:T.api_key,onChange:e=>C(t=>({...t,api_key:e.target.value})),autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Base URL (optional)"}),(0,r.jsx)("input",{className:"input",value:T.base_url,onChange:e=>C(t=>({...t,base_url:e.target.value})),placeholder:"https://..."})]}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"RPM Limit"}),(0,r.jsx)("input",{className:"input",type:"number",value:T.rpm,onChange:e=>C(t=>({...t,rpm:Number(e.target.value)}))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"TPM Limit"}),(0,r.jsx)("input",{className:"input",type:"number",value:T.tpm,onChange:e=>C(t=>({...t,tpm:Number(e.target.value)}))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Budget ($)"}),(0,r.jsx)("input",{className:"input",type:"number",step:"0.01",value:T.budget,onChange:e=>C(t=>({...t,budget:Number(e.target.value)}))})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:P,children:"Add Key"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>j(!1),children:"Cancel"})]})]})]})}),y?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:y})]}):x?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No provider keys yet. Add one to start routing requests."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Provider"}),(0,r.jsx)("th",{children:"Key"}),(0,r.jsx)("th",{children:"Limits"}),(0,r.jsx)("th",{children:"Usage"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium",children:e.name}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:"capitalize",children:e.provider})}),(0,r.jsx)("td",{children:(0,r.jsx)("code",{className:"text-xs font-mono text-[var(--text-tertiary)]",children:e.api_key_masked})}),(0,r.jsxs)("td",{className:"text-xs",children:["RPM: ",e.rpm_limit||"∞"," \xb7 TPM: ",e.tpm_limit||"∞"," \xb7 $",e.cost_budget||"∞"]}),(0,r.jsxs)("td",{className:"text-xs",children:[e.total_requests," req \xb7 $",e.total_cost.toFixed(4)]}),(0,r.jsx)("td",{children:e.cooldown_until?(0,r.jsx)("span",{className:"badge-yellow",children:"Cooldown"}):e.is_active?(0,r.jsx)("span",{className:"badge-green",children:"Active"}):(0,r.jsx)("span",{className:"badge-red",children:"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[e.cooldown_until&&(0,r.jsx)("button",{onClick:()=>Z(e.id),className:"btn-ghost btn-xs",title:"Clear cooldown",children:(0,r.jsx)(d,{size:14})}),(0,r.jsx)("button",{onClick:()=>A(e.id),disabled:w===e.id,className:"btn-ghost btn-xs",children:w===e.id?(0,r.jsx)("span",{className:"w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,r.jsx)(u.Z,{size:14})}),(0,r.jsx)("button",{onClick:()=>S(e.id),className:"btn-ghost btn-xs",children:e.is_active?(0,r.jsx)(h,{size:14}):(0,r.jsx)(m,{size:14})}),(0,r.jsx)("button",{onClick:()=>L(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(p.Z,{size:14})})]})})]},e.id))})]})})}),b&&(0,r.jsx)("div",{className:"toast",children:b})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return s},qz:function(){return i}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function i(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function s(){return!!a()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",s=a(),d={"Content-Type":"application/json",...t.headers};if(s&&(d.Authorization="Bearer ".concat(s)),"GET"===n&&!s){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=o.get(e);if(n)return n}let u=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let c=await a.json();return"GET"!==n||s||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===n&&!s){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>d("/api/auth/me"),logout:()=>{i(),l.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let i=await n.blob(),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=5837)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/provider-keys/page-a507c5d60a14edbb.js b/static/_next/static/chunks/app/provider-keys/page-a507c5d60a14edbb.js deleted file mode 100644 index 310715064648b1297ae16b5a0213bd2db27dba41..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/provider-keys/page-a507c5d60a14edbb.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2705],{5837:function(e,t,r){Promise.resolve().then(r.bind(r,2180))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:a=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,n.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:r,strokeWidth:c?24*Number(l)/Number(a):l,className:s("lucide",o),...h},[...u.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let r=(0,n.forwardRef)((r,i)=>{let{className:c,...o}=r;return(0,n.createElement)(l,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),c),...o})});return r.displayName="".concat(e),r}},9322:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},3276:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},9397:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},6137:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},8930:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},257:function(e,t,r){"use strict";var n,a;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(a=r.g.process)?void 0:a.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var c=[],o=!1,d=-1;function u(){o&&n&&(o=!1,n.length?c=n.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(n=c,c=[];++d1)for(var r=1;r{f(!0),v(""),Promise.all([s.hi.get("/api/keys"),s.hi.get("/api/providers")]).then(e=>{let[r,n]=e;t(r),o(Object.keys(n))}).catch(e=>v(e instanceof Error?e.message:"Failed to load provider keys")).finally(()=>f(!1))};(0,a.useEffect)(()=>{E()},[]);let P=async()=>{if(_.api_key)try{await s.hi.post("/api/keys",{provider:_.provider,name:_.name||_.provider,api_key:_.api_key,base_url:_.base_url||void 0,rpm_limit:_.rpm,tpm_limit:_.tpm,cost_budget:_.budget}),j(!1),C(T),E(),k("Key created")}catch(e){k(e instanceof Error?e.message:"Failed")}},A=async e=>{confirm("Delete this key?")&&(await s.hi.delete("/api/keys/".concat(e)),E(),k("Key deleted"))},L=async e=>{await s.hi.patch("/api/keys/".concat(e,"/toggle")),E()},Z=async e=>{w(e);try{let t=await s.hi.post("/api/keys/".concat(e,"/test"));k(t.ok?"✅ Healthy":"❌ ".concat(t.message))}catch(e){k(e instanceof Error?e.message:"Test failed")}finally{w(null)}},S=async e=>{try{await s.hi.post("/api/keys/".concat(e,"/clear-cooldown")),k("Cooldown cleared"),E()}catch(e){k(e instanceof Error?e.message:"Failed to clear cooldown")}};return a.useEffect(()=>{if(b){let e=setTimeout(()=>k(""),3e3);return()=>clearTimeout(e)}},[b]),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Provider Keys"}),(0,n.jsx)("p",{className:"page-sub",children:"Manage upstream API provider keys"})]}),(0,n.jsxs)("button",{className:"btn-primary",onClick:()=>j(!0),children:[(0,n.jsx)(i.Z,{size:16})," Add Key"]})]}),g&&(0,n.jsx)("div",{className:"modal-overlay",onClick:()=>j(!1),children:(0,n.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"Add Provider Key"}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Provider"}),(0,n.jsx)("select",{className:"select",value:_.provider,onChange:e=>C(t=>({...t,provider:e.target.value})),children:r.map(e=>(0,n.jsx)("option",{value:e,children:e},e))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Name (optional, defaults to provider)"}),(0,n.jsx)("input",{className:"input",value:_.name,onChange:e=>C(t=>({...t,name:e.target.value}))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"API Key"}),(0,n.jsx)("input",{className:"input",value:_.api_key,onChange:e=>C(t=>({...t,api_key:e.target.value})),autoFocus:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Base URL (optional)"}),(0,n.jsx)("input",{className:"input",value:_.base_url,onChange:e=>C(t=>({...t,base_url:e.target.value})),placeholder:"https://..."})]}),(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"RPM Limit"}),(0,n.jsx)("input",{className:"input",type:"number",value:_.rpm,onChange:e=>C(t=>({...t,rpm:Number(e.target.value)}))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"TPM Limit"}),(0,n.jsx)("input",{className:"input",type:"number",value:_.tpm,onChange:e=>C(t=>({...t,tpm:Number(e.target.value)}))})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Budget ($)"}),(0,n.jsx)("input",{className:"input",type:"number",step:"0.01",value:_.budget,onChange:e=>C(t=>({...t,budget:Number(e.target.value)}))})]})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:P,children:"Add Key"}),(0,n.jsx)("button",{className:"btn-ghost",onClick:()=>j(!1),children:"Cancel"})]})]})]})}),y?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,n.jsx)("p",{className:"text-red-400",children:y})]}):x?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No provider keys yet. Add one to start routing requests."})]}):(0,n.jsx)("div",{className:"card p-0",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Name"}),(0,n.jsx)("th",{children:"Provider"}),(0,n.jsx)("th",{children:"Key"}),(0,n.jsx)("th",{children:"Limits"}),(0,n.jsx)("th",{children:"Usage"}),(0,n.jsx)("th",{children:"Status"}),(0,n.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,n.jsx)("tbody",{children:e.map(e=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:"font-medium",children:e.name}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"capitalize",children:e.provider})}),(0,n.jsx)("td",{children:(0,n.jsx)("code",{className:"text-xs font-mono text-[var(--text-tertiary)]",children:e.api_key_masked})}),(0,n.jsxs)("td",{className:"text-xs",children:["RPM: ",e.rpm_limit||"∞"," \xb7 TPM: ",e.tpm_limit||"∞"," \xb7 $",e.cost_budget||"∞"]}),(0,n.jsxs)("td",{className:"text-xs",children:[e.total_requests," req \xb7 $",e.total_cost.toFixed(4)]}),(0,n.jsx)("td",{children:e.cooldown_until?(0,n.jsx)("span",{className:"badge-yellow",children:"Cooldown"}):e.is_active?(0,n.jsx)("span",{className:"badge-green",children:"Active"}):(0,n.jsx)("span",{className:"badge-red",children:"Disabled"})}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[e.cooldown_until&&(0,n.jsx)("button",{onClick:()=>S(e.id),className:"btn-ghost btn-xs",title:"Clear cooldown",children:(0,n.jsx)(d,{size:14})}),(0,n.jsx)("button",{onClick:()=>Z(e.id),disabled:N===e.id,className:"btn-ghost btn-xs",children:N===e.id?(0,n.jsx)("span",{className:"w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,n.jsx)(u.Z,{size:14})}),(0,n.jsx)("button",{onClick:()=>L(e.id),className:"btn-ghost btn-xs",children:e.is_active?(0,n.jsx)(h,{size:14}):(0,n.jsx)(m,{size:14})}),(0,n.jsx)("button",{onClick:()=>A(e.id),className:"btn-danger btn-xs",children:(0,n.jsx)(p.Z,{size:14})})]})})]},e.id))})]})})}),b&&(0,n.jsx)("div",{className:"toast",children:b})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return s}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",i=a(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===r&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let u=(async()=>{let a=await fetch("".concat(n).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let l=await a.json();return"GET"!==r||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===r&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>d("/api/auth/me"),logout:()=>{s(),c.clear(),window.location.href="/login"}},h=async e=>{let t=a(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let s=await r.blob(),i=URL.createObjectURL(s),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=5837)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/rag/page-d3fb4e1b1cf4fbff.js b/static/_next/static/chunks/app/rag/page-3831eea5c6d27ccd.js similarity index 68% rename from static/_next/static/chunks/app/rag/page-d3fb4e1b1cf4fbff.js rename to static/_next/static/chunks/app/rag/page-3831eea5c6d27ccd.js index 73e2cf0b29c466764d1a5519cc2b14a23c7b25b6..90f1e44fed4780286481f028cd52d82eb457fb5a 100644 --- a/static/_next/static/chunks/app/rag/page-d3fb4e1b1cf4fbff.js +++ b/static/_next/static/chunks/app/rag/page-3831eea5c6d27ccd.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7240],{269:function(e,t,n){Promise.resolve().then(n.bind(n,9420))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var a=n(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,a.forwardRef)((e,t)=>{let{color:n="currentColor",size:s=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...i,width:s,height:s,stroke:n,strokeWidth:c?24*Number(l)/Number(s):l,className:r("lucide",o),...h},[...u.map(e=>{let[t,n]=e;return(0,a.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let n=(0,a.forwardRef)((n,i)=>{let{className:c,...o}=n;return(0,a.createElement)(l,{ref:i,iconNode:t,className:r("lucide-".concat(s(e)),c),...o})});return n.displayName="".concat(e),n}},91:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},2208:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},8736:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},7689:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},2489:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},257:function(e,t,n){"use strict";var a,s;e.exports=(null==(a=n.g.process)?void 0:a.env)&&"object"==typeof(null==(s=n.g.process)?void 0:s.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,a,s=e.exports={};function r(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var c=[],o=!1,d=-1;function u(){o&&a&&(o=!1,a.length?c=a.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(a=c,c=[];++d1)for(var n=1;n{x(!0),f(null),r.hi.get("/api/rag/sessions").then(t).catch(e=>f(e instanceof Error?e.message:"Failed to load sessions")).finally(()=>x(!1))};(0,s.useEffect)(()=>{P()},[]);let D=async e=>{if(confirm("Delete this session?")){g(e);try{await r.hi.delete("/api/rag/sessions/".concat(e)),t(t=>t.filter(t=>t.id!==e)),(null==p?void 0:p.id)===e&&v(null)}catch(e){f(e instanceof Error?e.message:"Failed to delete")}finally{g(null)}}},L=async()=>{if(confirm("Delete all RAG sessions?")){b(!0);try{await r.hi.delete("/api/rag/all"),t([]),v(null)}catch(e){f(e instanceof Error?e.message:"Failed to clear")}finally{b(!1)}}},M=async()=>{if(N){A(!0),_("");try{let e=new FormData;e.append("file",N);let t=localStorage.getItem("nexus_token"),n=await fetch("/v1/documents/parse",{method:"POST",headers:t?{Authorization:"Bearer ".concat(t)}:{},body:e});if(!n.ok){let e=await n.json().catch(()=>({detail:n.statusText}));throw Error(e.detail||"HTTP ".concat(n.status))}let a=await n.json();_("Parsed ".concat(a.filename,": ").concat(a.total_chunks," chunks (showing first 3)"))}catch(e){_("Parse failed: ".concat(e instanceof Error?e.message:"Unknown error"))}finally{A(!1)}}},R=async()=>{if(N&&S){A(!0),_("");try{let e=new FormData;e.append("file",N);let t=localStorage.getItem("nexus_token"),n=new URLSearchParams({session_id:S}),a=await fetch("/v1/documents/parse-and-ingest?".concat(n),{method:"POST",headers:t?{Authorization:"Bearer ".concat(t)}:{},body:e});if(!a.ok){let e=await a.json().catch(()=>({detail:a.statusText}));throw Error(e.detail||"HTTP ".concat(a.status))}let s=await a.json();_("Ingested ".concat(s.filename,": ").concat(s.chunks_stored," chunks into session ").concat(s.session_id)),k(!1),P()}catch(e){_("Ingest failed: ".concat(e instanceof Error?e.message:"Unknown error"))}finally{A(!1)}}};return n?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"page-header",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"RAG Sessions"}),(0,a.jsx)("p",{className:"page-sub",children:"Retrieval-Augmented Generation session management"})]})}),(0,a.jsx)("div",{className:"card",children:(0,a.jsx)("div",{className:"skeleton h-32 w-full"})})]}):m?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"page-header",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"RAG Sessions"}),(0,a.jsx)("p",{className:"page-sub",children:"Retrieval-Augmented Generation session management"})]})}),(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)("p",{className:"text-red-400 mb-4",children:m}),(0,a.jsx)("button",{className:"btn-primary",onClick:P,children:"Retry"})]})]}):(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"page-header",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"RAG Sessions"}),(0,a.jsx)("p",{className:"page-sub",children:"Retrieval-Augmented Generation session management"})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("button",{className:"btn-secondary",onClick:()=>{var t;if(0===e.length){f("Create a RAG session first (via /v1/chat/completions with RAG enabled)");return}E((null===(t=e[0])||void 0===t?void 0:t.id)||""),T(null),_(""),k(!0)},children:[(0,a.jsx)(i.Z,{size:16})," Upload Document"]}),e.length>0&&(0,a.jsxs)("button",{className:"btn-danger",onClick:L,disabled:j,children:[(0,a.jsx)(l.Z,{size:16}),j?"Clearing...":"Clear All"]})]})]}),0===e.length?(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,a.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No RAG sessions"})]}):(0,a.jsx)("div",{className:"card p-0",children:(0,a.jsx)("div",{className:"table-wrap",children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Title"}),(0,a.jsx)("th",{children:"Documents"}),(0,a.jsx)("th",{children:"Created"}),(0,a.jsx)("th",{children:"Updated"}),(0,a.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,a.jsx)("tbody",{children:e.map(e=>(0,a.jsxs)(s.Fragment,{children:[(0,a.jsxs)("tr",{className:"cursor-pointer ".concat((null==p?void 0:p.id)===e.id?"bg-[var(--surface-200)]":"hover:bg-[var(--surface-100)]"),onClick:()=>v((null==p?void 0:p.id)===e.id?null:e),children:[(0,a.jsx)("td",{className:"font-medium",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(o.Z,{size:14,className:"text-[var(--text-tertiary)]"}),e.title]})}),(0,a.jsx)("td",{children:e.document_count}),(0,a.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:new Date(e.created_at).toLocaleString()}),(0,a.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:new Date(e.updated_at).toLocaleString()}),(0,a.jsx)("td",{className:"text-right",children:(0,a.jsx)("button",{className:"btn-danger btn-xs",onClick:t=>{t.stopPropagation(),D(e.id)},disabled:y===e.id,children:y===e.id?(0,a.jsx)("span",{className:"w-3 h-3 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(l.Z,{size:14})})})]}),(null==p?void 0:p.id)===e.id&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:5,className:"p-0",children:(0,a.jsxs)("div",{className:"px-4 py-3 bg-[var(--surface-100)] border-t border-[var(--surface-200)]",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-sm font-medium text-[var(--text-secondary)]",children:[(0,a.jsx)(d.Z,{size:14}),"Session Details"]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"ID:"})," ",(0,a.jsx)("span",{className:"font-mono text-xs",children:e.id})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Title:"})," ",e.title]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Documents:"})," ",e.document_count]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Created:"})," ",new Date(e.created_at).toLocaleString()]}),(0,a.jsxs)("div",{className:"col-span-2",children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Updated:"})," ",new Date(e.updated_at).toLocaleString()]})]})]})})})]},e.id))})]})})}),w&&(0,a.jsx)("div",{className:"modal-overlay",onClick:()=>!C&&k(!1),children:(0,a.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Upload Document"}),(0,a.jsx)("button",{onClick:()=>!C&&k(!1),className:"btn-ghost btn-xs",children:(0,a.jsx)(u.Z,{size:14})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Document File (PDF, DOCX, TXT)"}),(0,a.jsx)("input",{ref:z,type:"file",className:"input",accept:".pdf,.docx,.txt,.md",onChange:e=>{var t;return T((null===(t=e.target.files)||void 0===t?void 0:t[0])||null)},disabled:C}),N&&(0,a.jsxs)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:["Selected: ",N.name," (",(N.size/1024).toFixed(1)," KB)"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Target Session (for ingest)"}),(0,a.jsxs)("select",{className:"select",value:S,onChange:e=>E(e.target.value),disabled:C,children:[(0,a.jsx)("option",{value:"",children:"Select a session"}),e.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.title," (",e.id,")"]},e.id))]})]}),Z&&(0,a.jsx)("p",{className:"text-sm text-[var(--text-secondary)] bg-[var(--surface-100)] rounded p-2",children:Z}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("button",{className:"btn-secondary flex-1 justify-center",onClick:M,disabled:!N||C,children:[(0,a.jsx)(h,{size:16})," ",C?"Parsing...":"Parse Only"]}),(0,a.jsxs)("button",{className:"btn-primary flex-1 justify-center",onClick:R,disabled:!N||!S||C,children:[(0,a.jsx)(i.Z,{size:16})," ",C?"Ingesting...":"Parse & Ingest"]})]}),(0,a.jsx)("button",{className:"btn-ghost w-full justify-center",onClick:()=>!C&&k(!1),disabled:C,children:"Cancel"})]})]})})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return r}});let a=n(257).env.NEXT_PUBLIC_API_BASE||"";function s(){return localStorage.getItem("nexus_token")}function r(){localStorage.removeItem("nexus_token")}function i(){return!!s()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=s(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=o.get(e);if(n)return n}let u=(async()=>{let s=await fetch("".concat(a).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw r(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let l=await s.json();return"GET"!==n||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===n&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=a.access_token,localStorage.setItem("nexus_token",n),a},getMe:()=>d("/api/auth/me"),logout:()=>{r(),c.clear(),window.location.href="/login"}},h=async e=>{let t=s(),n=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let r=await n.blob(),i=URL.createObjectURL(r),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=269)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7240],{269:function(e,t,n){Promise.resolve().then(n.bind(n,9420))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var a=n(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,a.forwardRef)((e,t)=>{let{color:n="currentColor",size:s=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:o="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...i,width:s,height:s,stroke:n,strokeWidth:l?24*Number(c)/Number(s):c,className:r("lucide",o),...h},[...u.map(e=>{let[t,n]=e;return(0,a.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let n=(0,a.forwardRef)((n,i)=>{let{className:l,...o}=n;return(0,a.createElement)(c,{ref:i,iconNode:t,className:r("lucide-".concat(s(e)),l),...o})});return n.displayName="".concat(e),n}},91:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},2208:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},8736:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},7689:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},2489:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},257:function(e,t,n){"use strict";var a,s;e.exports=(null==(a=n.g.process)?void 0:a.env)&&"object"==typeof(null==(s=n.g.process)?void 0:s.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,a,s=e.exports={};function r(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var l=[],o=!1,d=-1;function u(){o&&a&&(o=!1,a.length?l=a.concat(l):d=-1,l.length&&h())}function h(){if(!o){var e=c(u);o=!0;for(var t=l.length;t;){for(a=l,l=[];++d1)for(var n=1;n{x(!0),f(null),r.hi.get("/api/rag/sessions").then(t).catch(e=>f(e instanceof Error?e.message:"Failed to load sessions")).finally(()=>x(!1))};(0,s.useEffect)(()=>{P()},[]);let D=async e=>{if(confirm("Delete this session?")){g(e);try{await r.hi.delete("/api/rag/sessions/".concat(e)),t(t=>t.filter(t=>t.id!==e)),(null==p?void 0:p.id)===e&&v(null)}catch(e){f(e instanceof Error?e.message:"Failed to delete")}finally{g(null)}}},R=async()=>{if(confirm("Delete all RAG sessions?")){b(!0);try{await r.hi.delete("/api/rag/all"),t([]),v(null)}catch(e){f(e instanceof Error?e.message:"Failed to clear")}finally{b(!1)}}},L=async()=>{if(N){_(!0),Z("");try{let e=new FormData;e.append("file",N);let t=localStorage.getItem("nexus_token"),n=await fetch("/v1/documents/parse",{method:"POST",headers:t?{Authorization:"Bearer ".concat(t)}:{},body:e});if(!n.ok){let e=await n.json().catch(()=>({detail:n.statusText}));throw Error(e.detail||"HTTP ".concat(n.status))}let a=await n.json();Z("Parsed ".concat(a.filename,": ").concat(a.total_chunks," chunks (showing first 3)"))}catch(e){Z("Parse failed: ".concat(e instanceof Error?e.message:"Unknown error"))}finally{_(!1)}}},M=async()=>{if(N&&S){_(!0),Z("");try{let e=new FormData;e.append("file",N);let t=localStorage.getItem("nexus_token"),n=new URLSearchParams({session_id:S}),a=await fetch("/v1/documents/parse-and-ingest?".concat(n),{method:"POST",headers:t?{Authorization:"Bearer ".concat(t)}:{},body:e});if(!a.ok){let e=await a.json().catch(()=>({detail:a.statusText}));throw Error(e.detail||"HTTP ".concat(a.status))}let s=await a.json();Z("Ingested ".concat(s.filename,": ").concat(s.chunks_stored," chunks into session ").concat(s.session_id)),w(!1),P()}catch(e){Z("Ingest failed: ".concat(e instanceof Error?e.message:"Unknown error"))}finally{_(!1)}}};return n?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"page-header",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"RAG Sessions"}),(0,a.jsx)("p",{className:"page-sub",children:"Retrieval-Augmented Generation session management"})]})}),(0,a.jsx)("div",{className:"card",children:(0,a.jsx)("div",{className:"skeleton h-32 w-full"})})]}):m?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"page-header",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"RAG Sessions"}),(0,a.jsx)("p",{className:"page-sub",children:"Retrieval-Augmented Generation session management"})]})}),(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)("p",{className:"text-red-400 mb-4",children:m}),(0,a.jsx)("button",{className:"btn-primary",onClick:P,children:"Retry"})]})]}):(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"page-header",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"RAG Sessions"}),(0,a.jsx)("p",{className:"page-sub",children:"Retrieval-Augmented Generation session management"})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("button",{className:"btn-secondary",onClick:()=>{var t;if(0===e.length){f("Create a RAG session first (via /v1/chat/completions with RAG enabled)");return}E((null===(t=e[0])||void 0===t?void 0:t.id)||""),T(null),Z(""),w(!0)},children:[(0,a.jsx)(i.Z,{size:16})," Upload Document"]}),e.length>0&&(0,a.jsxs)("button",{className:"btn-danger",onClick:R,disabled:j,children:[(0,a.jsx)(c.Z,{size:16}),j?"Clearing...":"Clear All"]})]})]}),0===e.length?(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,a.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No RAG sessions"})]}):(0,a.jsx)("div",{className:"card p-0",children:(0,a.jsx)("div",{className:"table-wrap",children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Title"}),(0,a.jsx)("th",{children:"Documents"}),(0,a.jsx)("th",{children:"Created"}),(0,a.jsx)("th",{children:"Updated"}),(0,a.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,a.jsx)("tbody",{children:e.map(e=>(0,a.jsxs)(s.Fragment,{children:[(0,a.jsxs)("tr",{className:"cursor-pointer ".concat((null==p?void 0:p.id)===e.id?"bg-[var(--surface-200)]":"hover:bg-[var(--surface-100)]"),onClick:()=>v((null==p?void 0:p.id)===e.id?null:e),children:[(0,a.jsx)("td",{className:"font-medium",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(o.Z,{size:14,className:"text-[var(--text-tertiary)]"}),e.title]})}),(0,a.jsx)("td",{children:e.document_count}),(0,a.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:new Date(e.created_at).toLocaleString()}),(0,a.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:new Date(e.updated_at).toLocaleString()}),(0,a.jsx)("td",{className:"text-right",children:(0,a.jsx)("button",{className:"btn-danger btn-xs",onClick:t=>{t.stopPropagation(),D(e.id)},disabled:y===e.id,children:y===e.id?(0,a.jsx)("span",{className:"w-3 h-3 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(c.Z,{size:14})})})]}),(null==p?void 0:p.id)===e.id&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:5,className:"p-0",children:(0,a.jsxs)("div",{className:"px-4 py-3 bg-[var(--surface-100)] border-t border-[var(--surface-200)]",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-sm font-medium text-[var(--text-secondary)]",children:[(0,a.jsx)(d.Z,{size:14}),"Session Details"]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"ID:"})," ",(0,a.jsx)("span",{className:"font-mono text-xs",children:e.id})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Title:"})," ",e.title]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Documents:"})," ",e.document_count]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Created:"})," ",new Date(e.created_at).toLocaleString()]}),(0,a.jsxs)("div",{className:"col-span-2",children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Updated:"})," ",new Date(e.updated_at).toLocaleString()]})]})]})})})]},e.id))})]})})}),k&&(0,a.jsx)("div",{className:"modal-overlay",onClick:()=>!C&&w(!1),children:(0,a.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Upload Document"}),(0,a.jsx)("button",{onClick:()=>!C&&w(!1),className:"btn-ghost btn-xs",children:(0,a.jsx)(u.Z,{size:14})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Document File (PDF, DOCX, TXT)"}),(0,a.jsx)("input",{ref:z,type:"file",className:"input",accept:".pdf,.docx,.txt,.md",onChange:e=>{var t;return T((null===(t=e.target.files)||void 0===t?void 0:t[0])||null)},disabled:C}),N&&(0,a.jsxs)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:["Selected: ",N.name," (",(N.size/1024).toFixed(1)," KB)"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Target Session (for ingest)"}),(0,a.jsxs)("select",{className:"select",value:S,onChange:e=>E(e.target.value),disabled:C,children:[(0,a.jsx)("option",{value:"",children:"Select a session"}),e.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.title," (",e.id,")"]},e.id))]})]}),A&&(0,a.jsx)("p",{className:"text-sm text-[var(--text-secondary)] bg-[var(--surface-100)] rounded p-2",children:A}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("button",{className:"btn-secondary flex-1 justify-center",onClick:L,disabled:!N||C,children:[(0,a.jsx)(h,{size:16})," ",C?"Parsing...":"Parse Only"]}),(0,a.jsxs)("button",{className:"btn-primary flex-1 justify-center",onClick:M,disabled:!N||!S||C,children:[(0,a.jsx)(i.Z,{size:16})," ",C?"Ingesting...":"Parse & Ingest"]})]}),(0,a.jsx)("button",{className:"btn-ghost w-full justify-center",onClick:()=>!C&&w(!1),disabled:C,children:"Cancel"})]})]})})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return r}});let a=n(257).env.NEXT_PUBLIC_API_BASE||"";function s(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function r(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!s()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=s(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=o.get(e);if(n)return n}let u=(async()=>{let s=await fetch("".concat(a).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw r(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let c=await s.json();return"GET"!==n||i||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===n&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=a.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),a},getMe:()=>d("/api/auth/me"),logout:()=>{r(),l.clear(),window.location.href="/login"}},h=async e=>{let t=s(),n=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let r=await n.blob(),i=URL.createObjectURL(r),c=document.createElement("a");c.href=i,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=269)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/rag/page-eec000fc6e3e5220.js b/static/_next/static/chunks/app/rag/page-eec000fc6e3e5220.js deleted file mode 100644 index 73e2cf0b29c466764d1a5519cc2b14a23c7b25b6..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/rag/page-eec000fc6e3e5220.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7240],{269:function(e,t,n){Promise.resolve().then(n.bind(n,9420))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var a=n(2265);let s=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,a.forwardRef)((e,t)=>{let{color:n="currentColor",size:s=24,strokeWidth:l=2,absoluteStrokeWidth:c,className:o="",children:d,iconNode:u,...h}=e;return(0,a.createElement)("svg",{ref:t,...i,width:s,height:s,stroke:n,strokeWidth:c?24*Number(l)/Number(s):l,className:r("lucide",o),...h},[...u.map(e=>{let[t,n]=e;return(0,a.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let n=(0,a.forwardRef)((n,i)=>{let{className:c,...o}=n;return(0,a.createElement)(l,{ref:i,iconNode:t,className:r("lucide-".concat(s(e)),c),...o})});return n.displayName="".concat(e),n}},91:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},2208:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},8736:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},7689:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},2489:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let a=(0,n(9205).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},257:function(e,t,n){"use strict";var a,s;e.exports=(null==(a=n.g.process)?void 0:a.env)&&"object"==typeof(null==(s=n.g.process)?void 0:s.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,a,s=e.exports={};function r(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function l(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var c=[],o=!1,d=-1;function u(){o&&a&&(o=!1,a.length?c=a.concat(c):d=-1,c.length&&h())}function h(){if(!o){var e=l(u);o=!0;for(var t=c.length;t;){for(a=c,c=[];++d1)for(var n=1;n{x(!0),f(null),r.hi.get("/api/rag/sessions").then(t).catch(e=>f(e instanceof Error?e.message:"Failed to load sessions")).finally(()=>x(!1))};(0,s.useEffect)(()=>{P()},[]);let D=async e=>{if(confirm("Delete this session?")){g(e);try{await r.hi.delete("/api/rag/sessions/".concat(e)),t(t=>t.filter(t=>t.id!==e)),(null==p?void 0:p.id)===e&&v(null)}catch(e){f(e instanceof Error?e.message:"Failed to delete")}finally{g(null)}}},L=async()=>{if(confirm("Delete all RAG sessions?")){b(!0);try{await r.hi.delete("/api/rag/all"),t([]),v(null)}catch(e){f(e instanceof Error?e.message:"Failed to clear")}finally{b(!1)}}},M=async()=>{if(N){A(!0),_("");try{let e=new FormData;e.append("file",N);let t=localStorage.getItem("nexus_token"),n=await fetch("/v1/documents/parse",{method:"POST",headers:t?{Authorization:"Bearer ".concat(t)}:{},body:e});if(!n.ok){let e=await n.json().catch(()=>({detail:n.statusText}));throw Error(e.detail||"HTTP ".concat(n.status))}let a=await n.json();_("Parsed ".concat(a.filename,": ").concat(a.total_chunks," chunks (showing first 3)"))}catch(e){_("Parse failed: ".concat(e instanceof Error?e.message:"Unknown error"))}finally{A(!1)}}},R=async()=>{if(N&&S){A(!0),_("");try{let e=new FormData;e.append("file",N);let t=localStorage.getItem("nexus_token"),n=new URLSearchParams({session_id:S}),a=await fetch("/v1/documents/parse-and-ingest?".concat(n),{method:"POST",headers:t?{Authorization:"Bearer ".concat(t)}:{},body:e});if(!a.ok){let e=await a.json().catch(()=>({detail:a.statusText}));throw Error(e.detail||"HTTP ".concat(a.status))}let s=await a.json();_("Ingested ".concat(s.filename,": ").concat(s.chunks_stored," chunks into session ").concat(s.session_id)),k(!1),P()}catch(e){_("Ingest failed: ".concat(e instanceof Error?e.message:"Unknown error"))}finally{A(!1)}}};return n?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"page-header",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"RAG Sessions"}),(0,a.jsx)("p",{className:"page-sub",children:"Retrieval-Augmented Generation session management"})]})}),(0,a.jsx)("div",{className:"card",children:(0,a.jsx)("div",{className:"skeleton h-32 w-full"})})]}):m?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"page-header",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"RAG Sessions"}),(0,a.jsx)("p",{className:"page-sub",children:"Retrieval-Augmented Generation session management"})]})}),(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)("p",{className:"text-red-400 mb-4",children:m}),(0,a.jsx)("button",{className:"btn-primary",onClick:P,children:"Retry"})]})]}):(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"page-header",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"page-title",children:"RAG Sessions"}),(0,a.jsx)("p",{className:"page-sub",children:"Retrieval-Augmented Generation session management"})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("button",{className:"btn-secondary",onClick:()=>{var t;if(0===e.length){f("Create a RAG session first (via /v1/chat/completions with RAG enabled)");return}E((null===(t=e[0])||void 0===t?void 0:t.id)||""),T(null),_(""),k(!0)},children:[(0,a.jsx)(i.Z,{size:16})," Upload Document"]}),e.length>0&&(0,a.jsxs)("button",{className:"btn-danger",onClick:L,disabled:j,children:[(0,a.jsx)(l.Z,{size:16}),j?"Clearing...":"Clear All"]})]})]}),0===e.length?(0,a.jsxs)("div",{className:"card text-center py-12",children:[(0,a.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,a.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No RAG sessions"})]}):(0,a.jsx)("div",{className:"card p-0",children:(0,a.jsx)("div",{className:"table-wrap",children:(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Title"}),(0,a.jsx)("th",{children:"Documents"}),(0,a.jsx)("th",{children:"Created"}),(0,a.jsx)("th",{children:"Updated"}),(0,a.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,a.jsx)("tbody",{children:e.map(e=>(0,a.jsxs)(s.Fragment,{children:[(0,a.jsxs)("tr",{className:"cursor-pointer ".concat((null==p?void 0:p.id)===e.id?"bg-[var(--surface-200)]":"hover:bg-[var(--surface-100)]"),onClick:()=>v((null==p?void 0:p.id)===e.id?null:e),children:[(0,a.jsx)("td",{className:"font-medium",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(o.Z,{size:14,className:"text-[var(--text-tertiary)]"}),e.title]})}),(0,a.jsx)("td",{children:e.document_count}),(0,a.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:new Date(e.created_at).toLocaleString()}),(0,a.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:new Date(e.updated_at).toLocaleString()}),(0,a.jsx)("td",{className:"text-right",children:(0,a.jsx)("button",{className:"btn-danger btn-xs",onClick:t=>{t.stopPropagation(),D(e.id)},disabled:y===e.id,children:y===e.id?(0,a.jsx)("span",{className:"w-3 h-3 border-2 border-white border-t-transparent rounded-full animate-spin"}):(0,a.jsx)(l.Z,{size:14})})})]}),(null==p?void 0:p.id)===e.id&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:5,className:"p-0",children:(0,a.jsxs)("div",{className:"px-4 py-3 bg-[var(--surface-100)] border-t border-[var(--surface-200)]",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-sm font-medium text-[var(--text-secondary)]",children:[(0,a.jsx)(d.Z,{size:14}),"Session Details"]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"ID:"})," ",(0,a.jsx)("span",{className:"font-mono text-xs",children:e.id})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Title:"})," ",e.title]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Documents:"})," ",e.document_count]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Created:"})," ",new Date(e.created_at).toLocaleString()]}),(0,a.jsxs)("div",{className:"col-span-2",children:[(0,a.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Updated:"})," ",new Date(e.updated_at).toLocaleString()]})]})]})})})]},e.id))})]})})}),w&&(0,a.jsx)("div",{className:"modal-overlay",onClick:()=>!C&&k(!1),children:(0,a.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Upload Document"}),(0,a.jsx)("button",{onClick:()=>!C&&k(!1),className:"btn-ghost btn-xs",children:(0,a.jsx)(u.Z,{size:14})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Document File (PDF, DOCX, TXT)"}),(0,a.jsx)("input",{ref:z,type:"file",className:"input",accept:".pdf,.docx,.txt,.md",onChange:e=>{var t;return T((null===(t=e.target.files)||void 0===t?void 0:t[0])||null)},disabled:C}),N&&(0,a.jsxs)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:["Selected: ",N.name," (",(N.size/1024).toFixed(1)," KB)"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"label",children:"Target Session (for ingest)"}),(0,a.jsxs)("select",{className:"select",value:S,onChange:e=>E(e.target.value),disabled:C,children:[(0,a.jsx)("option",{value:"",children:"Select a session"}),e.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.title," (",e.id,")"]},e.id))]})]}),Z&&(0,a.jsx)("p",{className:"text-sm text-[var(--text-secondary)] bg-[var(--surface-100)] rounded p-2",children:Z}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("button",{className:"btn-secondary flex-1 justify-center",onClick:M,disabled:!N||C,children:[(0,a.jsx)(h,{size:16})," ",C?"Parsing...":"Parse Only"]}),(0,a.jsxs)("button",{className:"btn-primary flex-1 justify-center",onClick:R,disabled:!N||!S||C,children:[(0,a.jsx)(i.Z,{size:16})," ",C?"Ingesting...":"Parse & Ingest"]})]}),(0,a.jsx)("button",{className:"btn-ghost w-full justify-center",onClick:()=>!C&&k(!1),disabled:C,children:"Cancel"})]})]})})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return i},qz:function(){return r}});let a=n(257).env.NEXT_PUBLIC_API_BASE||"";function s(){return localStorage.getItem("nexus_token")}function r(){localStorage.removeItem("nexus_token")}function i(){return!!s()}let l={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=s(),d={"Content-Type":"application/json",...t.headers};if(i&&(d.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in l)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return l[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=o.get(e);if(n)return n}let u=(async()=>{let s=await fetch("".concat(a).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return s;if(401===s.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw r(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!s.ok)throw Error((await s.json().catch(()=>({detail:s.statusText}))).detail||"HTTP ".concat(s.status));if(204===s.status)return;let l=await s.json();return"GET"!==n||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,l),l})();if("GET"===n&&!i){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let a=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=a.access_token,localStorage.setItem("nexus_token",n),a},getMe:()=>d("/api/auth/me"),logout:()=>{r(),c.clear(),window.location.href="/login"}},h=async e=>{let t=s(),n=await fetch("".concat(a).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let r=await n.blob(),i=URL.createObjectURL(r),l=document.createElement("a");l.href=i,l.download=e.split("/").pop()||"export.csv",l.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=269)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/realtime/page-610428f08bd51fdc.js b/static/_next/static/chunks/app/realtime/page-610428f08bd51fdc.js deleted file mode 100644 index add8d3dea98b8ddc21f6d656887a13eff80d7824..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/realtime/page-610428f08bd51fdc.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[655],{5441:function(e,t,r){Promise.resolve().then(r.bind(r,5354))},5354:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return A}});var s=r(7437),a=r(2265),n=r(1723),l=r(4401),c=r(1706),i=r(3417),o=r(5252),u=r(8728),d=r(2489),x=r(5621),m=r(2135),h=r(875),p=r(8930),f=r(7168),g=r(9322),v=r(2926),b=r(3041),j=r(7133),y=r(8662),N=r(730),w=r(5395),k=r(4743),C=r(1837);let S=(0,a.memo)(function(e){let{status:t,connected:r,connecting:a}=e;return(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--text-secondary)]",children:[(0,s.jsx)("span",{className:"inline-block w-2 h-2 rounded-full transition-all duration-200 ".concat(r?"bg-emerald-400 shadow-[0_0_10px_rgba(52,211,153,0.7)]":a?"bg-yellow-400 animate-pulse":"bg-gray-500")}),(0,s.jsx)("span",{children:t})]})}),_=(0,a.memo)(function(e){let{stats:t,isPlaying:r}=e,a=t.startedAt>0?Math.max(0,(Date.now()-t.startedAt)/1e3):0,u=a>0?"".concat(a.toFixed(0),"s"):"—";return(0,s.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 text-xs",children:[(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)]",children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(n.Z,{className:"w-3 h-3"})," Duration"]}),(0,s.jsx)("div",{className:"font-mono text-sm",children:u})]}),(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)]",children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(l.Z,{className:"w-3 h-3"})," Frames"]}),(0,s.jsxs)("div",{className:"font-mono text-sm",children:[(0,s.jsxs)("span",{className:"text-emerald-400",children:["↑",t.framesIn]})," ",(0,s.jsxs)("span",{className:"text-sky-400",children:["↓",t.framesOut]})]})]}),(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)]",children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(c.Z,{className:"w-3 h-3"})," Audio"]}),(0,s.jsxs)("div",{className:"font-mono text-sm",children:[(t.audioInMs/1e3).toFixed(1),"s",(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" in"}),(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" \xb7 "}),(t.audioOutMs/1e3).toFixed(1),"s",(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" out"})]})]}),(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)]",children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(i.Z,{className:"w-3 h-3"})," Tokens"]}),(0,s.jsxs)("div",{className:"font-mono text-sm",children:[t.audioInTokens+t.textInTokens,(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" in"}),(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" \xb7 "}),t.audioOutTokens+t.textOutTokens,(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" out"})]})]}),(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)] flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(o.Z,{className:"w-3 h-3"})," Cost"]}),(0,s.jsxs)("div",{className:"font-mono text-sm",children:["$",t.cost.toFixed(5)]})]}),r&&(0,s.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-nexus-400 animate-pulse shadow-[0_0_8px_rgba(99,102,241,0.7)]"})]})]})}),T=(0,a.memo)(function(e){let{micOn:t,levelRef:r,isPlaying:n}=e,l=(0,a.useRef)(null),c=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=l.current;if(!e)return;let s=e.getContext("2d");if(!s)return;let a=()=>{let l=e.width,i=e.height;s.clearRect(0,0,l,i);let o=t?Math.min(1,3*r.current):0,u=l/24,d=Date.now()/200;for(let e=0;e<24;e++){let r=Math.max(2,Math.max(0,(t?o:0)*(.6+.4*Math.sin(d+.35*e))+(n?.05+.04*Math.sin(1.5*d+.5*e):0))*i*.95),a=e*u+.15*u,l=(i-r)/2,c=s.createLinearGradient(0,l,0,l+r);t?(c.addColorStop(0,"#10b981"),c.addColorStop(1,"#34d399")):n?(c.addColorStop(0,"#6366f1"),c.addColorStop(1,"#818cf8")):(c.addColorStop(0,"#374151"),c.addColorStop(1,"#4b5563")),s.fillStyle=c,s.fillRect(a,l,.7*u,r)}c.current=requestAnimationFrame(a)};return c.current=requestAnimationFrame(a),()=>{null!=c.current&&cancelAnimationFrame(c.current)}},[t,n,r]),(0,s.jsx)("canvas",{ref:l,width:400,height:56,className:"w-full h-14 rounded-lg bg-[var(--surface-100)] border border-[var(--border)]"})}),I=(0,a.memo)(function(e){let{models:t,model:r,setModel:a,disabled:n}=e;return(0,s.jsxs)("div",{className:"flex-1 min-w-[200px]",children:[(0,s.jsx)("label",{className:"label",children:"Model"}),(0,s.jsx)("input",{className:"input",list:"rt-models",value:r,onChange:e=>a(e.target.value),placeholder:t.length?"pick a realtime model":"loading models…",disabled:n}),(0,s.jsx)("datalist",{id:"rt-models",children:t.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})]})}),O=(0,a.memo)(function(e){let{voicesForModel:t,voice:r,setVoice:a,disabled:n}=e;return 0===t.length?(0,s.jsxs)("div",{className:"w-40",children:[(0,s.jsx)("label",{className:"label",children:"Voice"}),(0,s.jsx)("input",{className:"input",value:r,onChange:e=>a(e.target.value),placeholder:"voice id",disabled:n})]}):(0,s.jsxs)("div",{className:"w-40",children:[(0,s.jsx)("label",{className:"label",children:"Voice"}),(0,s.jsx)("select",{className:"input",value:r,onChange:e=>a(e.target.value),disabled:n,children:t.map(e=>(0,s.jsx)("option",{value:e,children:e},e))})]})}),M=(0,a.memo)(function(e){let{systemInstructions:t,setSystemInstructions:r,temperature:a,setTemperature:n,vadMode:l,setVadMode:c,autoScroll:i,setAutoScroll:o,open:x,onClose:m}=e;return x?(0,s.jsxs)("div",{className:"card border border-[var(--border)] space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"text-sm font-semibold flex items-center gap-2",children:[(0,s.jsx)(u.Z,{className:"w-4 h-4"})," Session settings"]}),(0,s.jsx)("button",{className:"btn-ghost !p-1",onClick:m,title:"Close settings",children:(0,s.jsx)(d.Z,{className:"w-4 h-4"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"System instructions"}),(0,s.jsx)("textarea",{className:"input min-h-[72px] resize-y",value:t,onChange:e=>r(e.target.value),placeholder:"You are a helpful, concise voice assistant. Keep replies brief."})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"label",children:["Temperature ",(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:a.toFixed(2)})]}),(0,s.jsx)("input",{type:"range",min:0,max:1.5,step:.05,value:a,onChange:e=>n(parseFloat(e.target.value)),className:"w-full accent-nexus-500"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"VAD mode"}),(0,s.jsxs)("select",{className:"input",value:l,onChange:e=>c(e.target.value),children:[(0,s.jsx)("option",{value:"server_vad",children:"server_vad (default)"}),(0,s.jsx)("option",{value:"semantic_vad",children:"semantic_vad (Gemini)"}),(0,s.jsx)("option",{value:"none",children:"none (push-to-talk)"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Auto-scroll"}),(0,s.jsx)("button",{className:"input text-left ".concat(i?"border-nexus-500/50":""),onClick:()=>o(!i),type:"button",children:i?"On — follow latest":"Off — manual scroll"})]})]})]}):null}),R=(0,a.memo)(function(e){let{text:t,autoScroll:r,hasStarted:n}=e,l=(0,a.useRef)(null);return(0,a.useEffect)(()=>{r&&l.current&&(l.current.scrollTop=l.current.scrollHeight)},[t,r]),(0,s.jsx)("div",{ref:l,className:"flex-1 bg-[var(--surface-100)] rounded-lg p-4 overflow-y-auto text-sm whitespace-pre-wrap min-h-[160px] max-h-[40vh] leading-relaxed",children:t||(0,s.jsx)("span",{className:"text-[var(--text-tertiary)] italic",children:n?"…listening. Speak or send a text message to begin.":"No session yet. Pick a model and voice, then click Connect."})})}),E=(0,a.memo)(function(e){let{turns:t,onClear:r}=e,[n,l]=(0,a.useState)(!1);return 0===t.length?null:(0,s.jsxs)("div",{className:"card flex-shrink-0",children:[(0,s.jsxs)("button",{className:"w-full flex items-center justify-between text-sm",onClick:()=>l(e=>!e),type:"button",children:[(0,s.jsxs)("span",{className:"flex items-center gap-2 font-semibold",children:[(0,s.jsx)(x.Z,{className:"w-4 h-4"})," Conversation history",(0,s.jsxs)("span",{className:"text-[var(--text-tertiary)] font-normal",children:["(",t.length,")"]})]}),n?(0,s.jsx)(m.Z,{className:"w-4 h-4 text-[var(--text-tertiary)]"}):(0,s.jsx)(h.Z,{className:"w-4 h-4 text-[var(--text-tertiary)]"})]}),n&&(0,s.jsxs)("div",{className:"mt-3 space-y-2 max-h-40 overflow-y-auto",children:[t.slice(-50).map(e=>(0,s.jsxs)("div",{className:"text-xs flex gap-2",children:[(0,s.jsx)("span",{className:"flex-shrink-0 font-semibold ".concat("user"===e.role?"text-sky-400":"assistant"===e.role?"text-emerald-400":"text-[var(--text-tertiary)]"),children:e.role}),(0,s.jsx)("span",{className:"flex-1 text-[var(--text-secondary)] break-words",children:e.text||(0,s.jsx)("em",{className:"text-[var(--text-tertiary)]",children:"…"})})]},e.id)),(0,s.jsxs)("button",{className:"btn-ghost text-xs flex items-center gap-1",onClick:r,type:"button",children:[(0,s.jsx)(p.Z,{className:"w-3 h-3"})," Clear history"]})]})]})});function A(){let[e,t]=(0,a.useState)([]),[r,n]=(0,a.useState)({}),[l,i]=(0,a.useState)(""),[o,x]=(0,a.useState)(""),[m,h]=(0,a.useState)(!1),[p,A]=(0,a.useState)(!1),[D,Z]=(0,a.useState)(!1),[P,F]=(0,a.useState)("Disconnected"),[L,U]=(0,a.useState)(""),[B,G]=(0,a.useState)(""),[V,W]=(0,a.useState)(""),[J,z]=(0,a.useState)([]),[q,H]=(0,a.useState)(0),[K,X]=(0,a.useState)(!1),[Y,$]=(0,a.useState)(!1),[Q,ee]=(0,a.useState)(""),[et,er]=(0,a.useState)(.8),[es,ea]=(0,a.useState)("server_vad"),[en,el]=(0,a.useState)(!0),[ec,ei]=(0,a.useState)({framesIn:0,framesOut:0,audioInMs:0,audioOutMs:0,textInTokens:0,textOutTokens:0,audioInTokens:0,audioOutTokens:0,cost:0,startedAt:0}),eo=(0,a.useRef)(null),eu=(0,a.useRef)(null),ed=(0,a.useRef)(null),ex=(0,a.useRef)(null),em=(0,a.useRef)(null),eh=(0,a.useRef)(null),ep=(0,a.useRef)(0),ef=(0,a.useRef)(null),eg=(0,a.useRef)(null),ev=(0,a.useRef)(0),eb=(0,a.useRef)({framesIn:0,framesOut:0,audioInMs:0,audioOutMs:0,textInTokens:0,textOutTokens:0,audioInTokens:0,audioOutTokens:0,cost:0,startedAt:0}),ej=(0,a.useRef)(""),ey=(0,a.useRef)({systemInstructions:Q,temperature:et,vadMode:es});(0,a.useEffect)(()=>{ey.current={systemInstructions:Q,temperature:et,vadMode:es}},[Q,et,es]),(0,a.useEffect)(()=>{let e=!1;return C.hi.get("/api/realtime/models").then(r=>{if(e)return;let s=(r.models||[]).slice();s.sort((e,t)=>e.id.localeCompare(t.id)),t(s),s.length>0&&i(e=>e||s[0].id)}).catch(()=>{e||C.hi.get("/v1/models").then(r=>{if(e)return;let s=(r.data||[]).slice();s.sort((e,t)=>e.id.localeCompare(t.id)),t(s),s.length>0&&i(e=>e||s[0].id)}).catch(()=>{})}),C.hi.get("/api/realtime/voices").then(t=>{e||(n(t||{}),x(e=>{if(e)return e;for(let e of Object.keys(t||{}))if((t[e]||[]).length>0)return t[e][0];return""}))}).catch(()=>n({})),()=>{e=!0}},[]),(0,a.useEffect)(()=>{if(!m){null!=eg.current&&(window.clearInterval(eg.current),eg.current=null);return}return eg.current=window.setInterval(()=>{ei({...eb.current})},500),()=>{null!=eg.current&&(window.clearInterval(eg.current),eg.current=null)}},[m]);let eN=(0,a.useMemo)(()=>l.split("/")[0]||"",[l]),ew=(0,a.useMemo)(()=>r[eN]||[],[r,eN]),ek=e.length>0,eC=(0,a.useCallback)(()=>localStorage.getItem("nexus_token"),[]),eS=(0,a.useCallback)(()=>{if(!ed.current){let e=window.AudioContext||window.webkitAudioContext;ed.current=new e({sampleRate:24e3}),ep.current=0}return ed.current},[]),e_=(0,a.useCallback)(e=>{if(!e)return;let t=eS(),r=new Float32Array(e.length/2),s=function(e,t){if(!e)return 0;let r=atob(e),s=r.length;if(s<2)return 0;let a=new Uint8Array(s);for(let e=0;eX(!1),Math.ceil(1e3*n.duration)+50)},[eS]),eT=(0,a.useCallback)(e=>{let t=e.length/2*1e3/24e3;eb.current.audioOutMs+=t},[]),eI=(0,a.useCallback)((e,t)=>{z(r=>{let s=r.slice(),a=s[s.length-1];return a&&a.role===e?s[s.length-1]={...a,text:a.text+t,ts:Date.now()}:s.push({id:q,role:e,text:t,ts:Date.now()}),s.slice(-50)}),H(e=>e+1)},[q]),eO=(0,a.useCallback)(()=>{U(""),ej.current="",G(""),z([])},[]),eM=(0,a.useCallback)(async()=>{if(!l)return;if(A(!0),G(""),F("Connecting…"),U(""),ej.current="",z([]),eb.current={framesIn:0,framesOut:0,audioInMs:0,audioOutMs:0,textInTokens:0,textOutTokens:0,audioInTokens:0,audioOutTokens:0,cost:0,startedAt:Date.now()},ei({...eb.current}),!eC()){G("Not authenticated — please log in"),A(!1);return}let e="https:"===location.protocol?"wss":"ws",t=new WebSocket("".concat(e,"://").concat(location.host,"/v1/realtime?model=").concat(encodeURIComponent(l),"&voice=").concat(encodeURIComponent(o)));t.binaryType="arraybuffer",eo.current=t,t.onopen=()=>{h(!0),A(!1),F("Connected"),eb.current.startedAt=Date.now();try{let e=ey.current,r="none"===e.vadMode?{type:"disabled"}:{type:e.vadMode};t.send(JSON.stringify({type:"session.update",event_id:"evt_".concat(Date.now()),session:{type:"realtime",model:l.split("/").pop(),output_modalities:["audio"],instructions:e.systemInstructions||void 0,temperature:e.temperature,audio:{input:{format:{type:"audio/pcm",rate:24e3},turn_detection:r},output:{format:{type:"audio/pcm"},voice:o}}}}))}catch(e){G("session.update failed: ".concat(e instanceof Error?e.message:String(e)))}},t.onmessage=async e=>{let t=null;try{t=JSON.parse("string"==typeof e.data?e.data:new TextDecoder().decode(e.data))}catch(e){return}if(!t||"object"!=typeof t)return;eb.current.framesOut+=1;let r=t.type;if("response.output_audio.delta"===r&&"string"==typeof t.delta){eT(t.delta);try{e_(t.delta)}catch(e){}}else if("response.output_audio_transcript.delta"===r&&"string"==typeof t.delta){ej.current=(ej.current||"")+t.delta;let e=ej.current.length>8e3?ej.current.slice(-8e3):ej.current;ej.current=e,U(e)}else if("response.output_text.delta"===r&&"string"==typeof t.delta){ej.current=(ej.current||"")+t.delta;let e=ej.current.length>8e3?ej.current.slice(-8e3):ej.current;ej.current=e,U(e)}else if("response.output_audio_transcript.done"===r&&"string"==typeof t.transcript)eI("assistant",t.transcript);else if("response.done"===r||"response.completed"===r){let e=t.response,r=(null==e?void 0:e.usage)||{},s=r.input_token_details||{},a=r.output_token_details||{};eb.current.textInTokens=Number(s.text_tokens||0),eb.current.textOutTokens=Number(a.text_tokens||0),eb.current.audioInTokens=Number(s.audio_tokens||0),eb.current.audioOutTokens=Number(a.audio_tokens||0)}else"error"===r&&G("".concat(t.code||"error",": ").concat(t.message||"unknown"))},t.onerror=()=>{G("WebSocket error — see console"),F("Error")},t.onclose=e=>{var t;if(h(!1),A(!1),F("Disconnected (".concat(e.code,")")),null===(t=eE.current)||void 0===t||t.call(eE),ed.current){try{ed.current.close()}catch(e){}ed.current=null}null!=ef.current&&(window.clearTimeout(ef.current),ef.current=null),X(!1)}},[l,o,eC,e_,eT,eI]),eR=(0,a.useCallback)(()=>{var e;if(eo.current){try{eo.current.close(1e3,"user disconnect")}catch(e){}eo.current=null}null===(e=eE.current)||void 0===e||e.call(eE)},[]),eE=(0,a.useRef)(null),eA=(0,a.useRef)(null),eD=(0,a.useCallback)(async()=>{if(eo.current&&eo.current.readyState===WebSocket.OPEN)try{let e=await navigator.mediaDevices.getUserMedia({audio:{sampleRate:24e3,channelCount:1,echoCancellation:!0,noiseSuppression:!0}});if(ex.current=e,!eu.current){let e=window.AudioContext||window.webkitAudioContext;eu.current=new e({sampleRate:24e3})}let t=eu.current,r=t.createMediaStreamSource(e);eh.current=r;let s=t.createScriptProcessor(4096,1,1);em.current=s;let a=new Int16Array(0),n=new Int16Array(4096);s.onaudioprocess=e=>{if(!eo.current||eo.current.readyState!==WebSocket.OPEN)return;let t=e.inputBuffer.getChannelData(0),r=function(e,t,r){let s=Math.min(r,e.length,t.length);for(let r=0;r1?s=1:s<-1&&(s=-1),t[r]=s<0?32768*s:32767*s}return s}(t,n,t.length);ev.current=function(e,t){let r=Math.min(t,e.length);if(r<=0)return 0;let s=0;for(let t=0;t=2400;){let e=a.slice(0,2400);a=a.slice(2400);let t=function(e){if(!e.length)return"";let t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r="";for(let e=0;e{if(em.current){try{em.current.disconnect()}catch(e){}em.current=null}if(eh.current){try{eh.current.disconnect()}catch(e){}eh.current=null}ex.current&&(ex.current.getTracks().forEach(e=>e.stop()),ex.current=null),ev.current=0,Z(!1),m&&F("Connected")},[m]);(0,a.useEffect)(()=>{eA.current=eD,eE.current=eZ},[eD,eZ]);let eP=(0,a.useCallback)(()=>{let e=V.trim();if(e&&eo.current&&eo.current.readyState===WebSocket.OPEN)try{eI("user",e),eo.current.send(JSON.stringify({type:"conversation.item.create",event_id:"txt_".concat(Date.now()),item:{type:"message",role:"user",content:[{type:"input_text",text:e}]}})),eo.current.send(JSON.stringify({type:"response.create",event_id:"rc_".concat(Date.now())})),W("")}catch(e){G("send failed: ".concat(e instanceof Error?e.message:String(e)))}},[V,eI]);(0,a.useEffect)(()=>()=>{if(eR(),eu.current)try{eu.current.close()}catch(e){}if(ed.current)try{ed.current.close()}catch(e){}null!=eg.current&&window.clearInterval(eg.current),null!=ef.current&&window.clearTimeout(ef.current)},[eR]);let eF=m||p;return(0,s.jsxs)("div",{className:"flex flex-col h-[calc(100vh-6rem)]",children:[(0,s.jsxs)("div",{className:"page-header flex-shrink-0",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"page-title",children:"Realtime Voice"}),(0,s.jsx)("p",{className:"page-sub",children:"Low-latency audio sessions via OpenAI Realtime and Gemini Live"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("button",{className:"btn-secondary ".concat(Y?"border-nexus-500/50":""),onClick:()=>$(e=>!e),type:"button",title:"Session settings",children:[(0,s.jsx)(u.Z,{className:"w-4 h-4"})," Settings"]}),(0,s.jsx)("button",{className:"btn-ghost",onClick:eO,title:"Reset transcript and history",children:(0,s.jsx)(f.Z,{className:"w-4 h-4"})})]})]}),B&&(0,s.jsxs)("div",{className:"mb-3 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2 flex items-start gap-2 text-sm text-red-300 flex-shrink-0",children:[(0,s.jsx)(g.Z,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),(0,s.jsx)("span",{className:"flex-1",children:B}),(0,s.jsx)("button",{onClick:()=>G(""),className:"text-red-300/70 hover:text-red-200",title:"Dismiss",children:(0,s.jsx)(d.Z,{className:"w-4 h-4"})})]}),Y&&(0,s.jsx)("div",{className:"mb-3 flex-shrink-0",children:(0,s.jsx)(M,{systemInstructions:Q,setSystemInstructions:ee,temperature:et,setTemperature:er,vadMode:es,setVadMode:ea,autoScroll:en,setAutoScroll:el,open:Y,onClose:()=>$(!1)})}),(0,s.jsx)("div",{className:"mb-3 flex-shrink-0",children:(0,s.jsx)(_,{stats:ec,isPlaying:K})}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-3 flex-shrink-0",children:[(0,s.jsxs)("div",{className:"card md:col-span-2",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,s.jsx)(I,{models:e,model:l,setModel:i,disabled:m}),(0,s.jsx)(O,{voicesForModel:ew,voice:o,setVoice:x,disabled:m}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:m?(0,s.jsxs)("button",{className:"btn-secondary",onClick:eR,children:[(0,s.jsx)(j.Z,{className:"w-4 h-4"}),"Disconnect"]}):(0,s.jsxs)("button",{className:"btn-primary",onClick:eM,disabled:p||!l,children:[p?(0,s.jsx)(v.Z,{className:"w-4 h-4 animate-pulse"}):(0,s.jsx)(b.Z,{className:"w-4 h-4"}),p?"Connecting…":"Connect"]})})]}),(0,s.jsxs)("div",{className:"mt-3 flex items-center gap-3",children:[(0,s.jsx)(S,{status:P,connected:m,connecting:p}),!ek&&!p&&(0,s.jsx)("span",{className:"text-xs text-[var(--text-tertiary)]",children:"No realtime models discovered yet — you can still type any model id above."})]})]}),(0,s.jsxs)("div",{className:"card flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-around",children:[(0,s.jsx)("button",{className:"btn-secondary !p-3 transition-all ".concat(D?"border-emerald-500/50 bg-emerald-500/10 shadow-[0_0_20px_rgba(16,185,129,0.2)]":""),onClick:D?eZ:eD,disabled:!m,title:D?"Stop microphone":"Start microphone",type:"button",children:D?(0,s.jsx)(y.Z,{className:"w-5 h-5"}):(0,s.jsx)(N.Z,{className:"w-5 h-5"})}),(0,s.jsxs)("div",{className:"text-xs text-[var(--text-tertiary)] text-center",children:[K?(0,s.jsx)(c.Z,{className:"w-5 h-5 mx-auto mb-1 text-nexus-400 animate-pulse"}):(0,s.jsx)(w.Z,{className:"w-5 h-5 mx-auto mb-1"}),K?"Audio out":"Idle"]}),(0,s.jsx)("button",{className:"btn-ghost",onClick:()=>{U(""),ej.current=""},title:"Clear transcript",type:"button",children:(0,s.jsx)(f.Z,{className:"w-4 h-4"})})]}),(0,s.jsx)(T,{micOn:D,levelRef:ev,isPlaying:K})]})]}),(0,s.jsxs)("div",{className:"card flex-1 flex flex-col min-h-0 mb-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("label",{className:"label !mb-0",children:"Live transcript"}),(0,s.jsx)("span",{className:"text-[10px] text-[var(--text-tertiary)] uppercase tracking-wider",children:en?"auto-scroll on":"auto-scroll off"})]}),(0,s.jsx)(R,{text:L,autoScroll:en,hasStarted:eF})]}),(0,s.jsx)(E,{turns:J,onClear:()=>z([])}),(0,s.jsxs)("div",{className:"card flex-shrink-0 mt-3",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{className:"input flex-1",value:V,onChange:e=>W(e.target.value),onKeyDown:e=>{"Enter"===e.key&&eP()},placeholder:"Inject a text message (push-to-text)…",disabled:!m}),(0,s.jsx)("button",{className:"btn-primary",onClick:eP,disabled:!m||!V.trim(),type:"button",children:(0,s.jsx)(k.Z,{className:"w-4 h-4"})})]}),(0,s.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mt-2",children:"Realtime audio is forwarded as-is to the upstream provider. Per-frame work is <10\xb5s on the gateway."})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return x},hi:function(){return d},jl:function(){return l},qz:function(){return n}});let s=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function n(){localStorage.removeItem("nexus_token")}function l(){return!!a()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},i=new Map,o=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",l=a(),u={"Content-Type":"application/json",...t.headers};if(l&&(u.Authorization="Bearer ".concat(l)),"GET"===r&&!l){let t=function(e){let t=i.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){i.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(s).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&l&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw n(),i.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let c=await a.json();return"GET"!==r||l||function(e,t){if(i.size>=200){let e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===r&&!l){o.set(e,d);try{return await d}finally{o.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let s=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=s.access_token,localStorage.setItem("nexus_token",r),s},getMe:()=>u("/api/auth/me"),logout:()=>{n(),i.clear(),window.location.href="/login"}},x=async e=>{let t=a(),r=await fetch("".concat(s).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let n=await r.blob(),l=URL.createObjectURL(n),c=document.createElement("a");c.href=l,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(l)}}},function(e){e.O(0,[5029,2971,2117,1744],function(){return e(e.s=5441)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/realtime/page-31118a081ad27c14.js b/static/_next/static/chunks/app/realtime/page-81ac2a49bbe724a6.js similarity index 60% rename from static/_next/static/chunks/app/realtime/page-31118a081ad27c14.js rename to static/_next/static/chunks/app/realtime/page-81ac2a49bbe724a6.js index add8d3dea98b8ddc21f6d656887a13eff80d7824..88cc08146310b42557366f06e7318129a4ec94cd 100644 --- a/static/_next/static/chunks/app/realtime/page-31118a081ad27c14.js +++ b/static/_next/static/chunks/app/realtime/page-81ac2a49bbe724a6.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[655],{5441:function(e,t,r){Promise.resolve().then(r.bind(r,5354))},5354:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return A}});var s=r(7437),a=r(2265),n=r(1723),l=r(4401),c=r(1706),i=r(3417),o=r(5252),u=r(8728),d=r(2489),x=r(5621),m=r(2135),h=r(875),p=r(8930),f=r(7168),g=r(9322),v=r(2926),b=r(3041),j=r(7133),y=r(8662),N=r(730),w=r(5395),k=r(4743),C=r(1837);let S=(0,a.memo)(function(e){let{status:t,connected:r,connecting:a}=e;return(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--text-secondary)]",children:[(0,s.jsx)("span",{className:"inline-block w-2 h-2 rounded-full transition-all duration-200 ".concat(r?"bg-emerald-400 shadow-[0_0_10px_rgba(52,211,153,0.7)]":a?"bg-yellow-400 animate-pulse":"bg-gray-500")}),(0,s.jsx)("span",{children:t})]})}),_=(0,a.memo)(function(e){let{stats:t,isPlaying:r}=e,a=t.startedAt>0?Math.max(0,(Date.now()-t.startedAt)/1e3):0,u=a>0?"".concat(a.toFixed(0),"s"):"—";return(0,s.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 text-xs",children:[(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)]",children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(n.Z,{className:"w-3 h-3"})," Duration"]}),(0,s.jsx)("div",{className:"font-mono text-sm",children:u})]}),(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)]",children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(l.Z,{className:"w-3 h-3"})," Frames"]}),(0,s.jsxs)("div",{className:"font-mono text-sm",children:[(0,s.jsxs)("span",{className:"text-emerald-400",children:["↑",t.framesIn]})," ",(0,s.jsxs)("span",{className:"text-sky-400",children:["↓",t.framesOut]})]})]}),(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)]",children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(c.Z,{className:"w-3 h-3"})," Audio"]}),(0,s.jsxs)("div",{className:"font-mono text-sm",children:[(t.audioInMs/1e3).toFixed(1),"s",(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" in"}),(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" \xb7 "}),(t.audioOutMs/1e3).toFixed(1),"s",(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" out"})]})]}),(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)]",children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(i.Z,{className:"w-3 h-3"})," Tokens"]}),(0,s.jsxs)("div",{className:"font-mono text-sm",children:[t.audioInTokens+t.textInTokens,(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" in"}),(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" \xb7 "}),t.audioOutTokens+t.textOutTokens,(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" out"})]})]}),(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)] flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(o.Z,{className:"w-3 h-3"})," Cost"]}),(0,s.jsxs)("div",{className:"font-mono text-sm",children:["$",t.cost.toFixed(5)]})]}),r&&(0,s.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-nexus-400 animate-pulse shadow-[0_0_8px_rgba(99,102,241,0.7)]"})]})]})}),T=(0,a.memo)(function(e){let{micOn:t,levelRef:r,isPlaying:n}=e,l=(0,a.useRef)(null),c=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=l.current;if(!e)return;let s=e.getContext("2d");if(!s)return;let a=()=>{let l=e.width,i=e.height;s.clearRect(0,0,l,i);let o=t?Math.min(1,3*r.current):0,u=l/24,d=Date.now()/200;for(let e=0;e<24;e++){let r=Math.max(2,Math.max(0,(t?o:0)*(.6+.4*Math.sin(d+.35*e))+(n?.05+.04*Math.sin(1.5*d+.5*e):0))*i*.95),a=e*u+.15*u,l=(i-r)/2,c=s.createLinearGradient(0,l,0,l+r);t?(c.addColorStop(0,"#10b981"),c.addColorStop(1,"#34d399")):n?(c.addColorStop(0,"#6366f1"),c.addColorStop(1,"#818cf8")):(c.addColorStop(0,"#374151"),c.addColorStop(1,"#4b5563")),s.fillStyle=c,s.fillRect(a,l,.7*u,r)}c.current=requestAnimationFrame(a)};return c.current=requestAnimationFrame(a),()=>{null!=c.current&&cancelAnimationFrame(c.current)}},[t,n,r]),(0,s.jsx)("canvas",{ref:l,width:400,height:56,className:"w-full h-14 rounded-lg bg-[var(--surface-100)] border border-[var(--border)]"})}),I=(0,a.memo)(function(e){let{models:t,model:r,setModel:a,disabled:n}=e;return(0,s.jsxs)("div",{className:"flex-1 min-w-[200px]",children:[(0,s.jsx)("label",{className:"label",children:"Model"}),(0,s.jsx)("input",{className:"input",list:"rt-models",value:r,onChange:e=>a(e.target.value),placeholder:t.length?"pick a realtime model":"loading models…",disabled:n}),(0,s.jsx)("datalist",{id:"rt-models",children:t.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})]})}),O=(0,a.memo)(function(e){let{voicesForModel:t,voice:r,setVoice:a,disabled:n}=e;return 0===t.length?(0,s.jsxs)("div",{className:"w-40",children:[(0,s.jsx)("label",{className:"label",children:"Voice"}),(0,s.jsx)("input",{className:"input",value:r,onChange:e=>a(e.target.value),placeholder:"voice id",disabled:n})]}):(0,s.jsxs)("div",{className:"w-40",children:[(0,s.jsx)("label",{className:"label",children:"Voice"}),(0,s.jsx)("select",{className:"input",value:r,onChange:e=>a(e.target.value),disabled:n,children:t.map(e=>(0,s.jsx)("option",{value:e,children:e},e))})]})}),M=(0,a.memo)(function(e){let{systemInstructions:t,setSystemInstructions:r,temperature:a,setTemperature:n,vadMode:l,setVadMode:c,autoScroll:i,setAutoScroll:o,open:x,onClose:m}=e;return x?(0,s.jsxs)("div",{className:"card border border-[var(--border)] space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"text-sm font-semibold flex items-center gap-2",children:[(0,s.jsx)(u.Z,{className:"w-4 h-4"})," Session settings"]}),(0,s.jsx)("button",{className:"btn-ghost !p-1",onClick:m,title:"Close settings",children:(0,s.jsx)(d.Z,{className:"w-4 h-4"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"System instructions"}),(0,s.jsx)("textarea",{className:"input min-h-[72px] resize-y",value:t,onChange:e=>r(e.target.value),placeholder:"You are a helpful, concise voice assistant. Keep replies brief."})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"label",children:["Temperature ",(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:a.toFixed(2)})]}),(0,s.jsx)("input",{type:"range",min:0,max:1.5,step:.05,value:a,onChange:e=>n(parseFloat(e.target.value)),className:"w-full accent-nexus-500"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"VAD mode"}),(0,s.jsxs)("select",{className:"input",value:l,onChange:e=>c(e.target.value),children:[(0,s.jsx)("option",{value:"server_vad",children:"server_vad (default)"}),(0,s.jsx)("option",{value:"semantic_vad",children:"semantic_vad (Gemini)"}),(0,s.jsx)("option",{value:"none",children:"none (push-to-talk)"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Auto-scroll"}),(0,s.jsx)("button",{className:"input text-left ".concat(i?"border-nexus-500/50":""),onClick:()=>o(!i),type:"button",children:i?"On — follow latest":"Off — manual scroll"})]})]})]}):null}),R=(0,a.memo)(function(e){let{text:t,autoScroll:r,hasStarted:n}=e,l=(0,a.useRef)(null);return(0,a.useEffect)(()=>{r&&l.current&&(l.current.scrollTop=l.current.scrollHeight)},[t,r]),(0,s.jsx)("div",{ref:l,className:"flex-1 bg-[var(--surface-100)] rounded-lg p-4 overflow-y-auto text-sm whitespace-pre-wrap min-h-[160px] max-h-[40vh] leading-relaxed",children:t||(0,s.jsx)("span",{className:"text-[var(--text-tertiary)] italic",children:n?"…listening. Speak or send a text message to begin.":"No session yet. Pick a model and voice, then click Connect."})})}),E=(0,a.memo)(function(e){let{turns:t,onClear:r}=e,[n,l]=(0,a.useState)(!1);return 0===t.length?null:(0,s.jsxs)("div",{className:"card flex-shrink-0",children:[(0,s.jsxs)("button",{className:"w-full flex items-center justify-between text-sm",onClick:()=>l(e=>!e),type:"button",children:[(0,s.jsxs)("span",{className:"flex items-center gap-2 font-semibold",children:[(0,s.jsx)(x.Z,{className:"w-4 h-4"})," Conversation history",(0,s.jsxs)("span",{className:"text-[var(--text-tertiary)] font-normal",children:["(",t.length,")"]})]}),n?(0,s.jsx)(m.Z,{className:"w-4 h-4 text-[var(--text-tertiary)]"}):(0,s.jsx)(h.Z,{className:"w-4 h-4 text-[var(--text-tertiary)]"})]}),n&&(0,s.jsxs)("div",{className:"mt-3 space-y-2 max-h-40 overflow-y-auto",children:[t.slice(-50).map(e=>(0,s.jsxs)("div",{className:"text-xs flex gap-2",children:[(0,s.jsx)("span",{className:"flex-shrink-0 font-semibold ".concat("user"===e.role?"text-sky-400":"assistant"===e.role?"text-emerald-400":"text-[var(--text-tertiary)]"),children:e.role}),(0,s.jsx)("span",{className:"flex-1 text-[var(--text-secondary)] break-words",children:e.text||(0,s.jsx)("em",{className:"text-[var(--text-tertiary)]",children:"…"})})]},e.id)),(0,s.jsxs)("button",{className:"btn-ghost text-xs flex items-center gap-1",onClick:r,type:"button",children:[(0,s.jsx)(p.Z,{className:"w-3 h-3"})," Clear history"]})]})]})});function A(){let[e,t]=(0,a.useState)([]),[r,n]=(0,a.useState)({}),[l,i]=(0,a.useState)(""),[o,x]=(0,a.useState)(""),[m,h]=(0,a.useState)(!1),[p,A]=(0,a.useState)(!1),[D,Z]=(0,a.useState)(!1),[P,F]=(0,a.useState)("Disconnected"),[L,U]=(0,a.useState)(""),[B,G]=(0,a.useState)(""),[V,W]=(0,a.useState)(""),[J,z]=(0,a.useState)([]),[q,H]=(0,a.useState)(0),[K,X]=(0,a.useState)(!1),[Y,$]=(0,a.useState)(!1),[Q,ee]=(0,a.useState)(""),[et,er]=(0,a.useState)(.8),[es,ea]=(0,a.useState)("server_vad"),[en,el]=(0,a.useState)(!0),[ec,ei]=(0,a.useState)({framesIn:0,framesOut:0,audioInMs:0,audioOutMs:0,textInTokens:0,textOutTokens:0,audioInTokens:0,audioOutTokens:0,cost:0,startedAt:0}),eo=(0,a.useRef)(null),eu=(0,a.useRef)(null),ed=(0,a.useRef)(null),ex=(0,a.useRef)(null),em=(0,a.useRef)(null),eh=(0,a.useRef)(null),ep=(0,a.useRef)(0),ef=(0,a.useRef)(null),eg=(0,a.useRef)(null),ev=(0,a.useRef)(0),eb=(0,a.useRef)({framesIn:0,framesOut:0,audioInMs:0,audioOutMs:0,textInTokens:0,textOutTokens:0,audioInTokens:0,audioOutTokens:0,cost:0,startedAt:0}),ej=(0,a.useRef)(""),ey=(0,a.useRef)({systemInstructions:Q,temperature:et,vadMode:es});(0,a.useEffect)(()=>{ey.current={systemInstructions:Q,temperature:et,vadMode:es}},[Q,et,es]),(0,a.useEffect)(()=>{let e=!1;return C.hi.get("/api/realtime/models").then(r=>{if(e)return;let s=(r.models||[]).slice();s.sort((e,t)=>e.id.localeCompare(t.id)),t(s),s.length>0&&i(e=>e||s[0].id)}).catch(()=>{e||C.hi.get("/v1/models").then(r=>{if(e)return;let s=(r.data||[]).slice();s.sort((e,t)=>e.id.localeCompare(t.id)),t(s),s.length>0&&i(e=>e||s[0].id)}).catch(()=>{})}),C.hi.get("/api/realtime/voices").then(t=>{e||(n(t||{}),x(e=>{if(e)return e;for(let e of Object.keys(t||{}))if((t[e]||[]).length>0)return t[e][0];return""}))}).catch(()=>n({})),()=>{e=!0}},[]),(0,a.useEffect)(()=>{if(!m){null!=eg.current&&(window.clearInterval(eg.current),eg.current=null);return}return eg.current=window.setInterval(()=>{ei({...eb.current})},500),()=>{null!=eg.current&&(window.clearInterval(eg.current),eg.current=null)}},[m]);let eN=(0,a.useMemo)(()=>l.split("/")[0]||"",[l]),ew=(0,a.useMemo)(()=>r[eN]||[],[r,eN]),ek=e.length>0,eC=(0,a.useCallback)(()=>localStorage.getItem("nexus_token"),[]),eS=(0,a.useCallback)(()=>{if(!ed.current){let e=window.AudioContext||window.webkitAudioContext;ed.current=new e({sampleRate:24e3}),ep.current=0}return ed.current},[]),e_=(0,a.useCallback)(e=>{if(!e)return;let t=eS(),r=new Float32Array(e.length/2),s=function(e,t){if(!e)return 0;let r=atob(e),s=r.length;if(s<2)return 0;let a=new Uint8Array(s);for(let e=0;eX(!1),Math.ceil(1e3*n.duration)+50)},[eS]),eT=(0,a.useCallback)(e=>{let t=e.length/2*1e3/24e3;eb.current.audioOutMs+=t},[]),eI=(0,a.useCallback)((e,t)=>{z(r=>{let s=r.slice(),a=s[s.length-1];return a&&a.role===e?s[s.length-1]={...a,text:a.text+t,ts:Date.now()}:s.push({id:q,role:e,text:t,ts:Date.now()}),s.slice(-50)}),H(e=>e+1)},[q]),eO=(0,a.useCallback)(()=>{U(""),ej.current="",G(""),z([])},[]),eM=(0,a.useCallback)(async()=>{if(!l)return;if(A(!0),G(""),F("Connecting…"),U(""),ej.current="",z([]),eb.current={framesIn:0,framesOut:0,audioInMs:0,audioOutMs:0,textInTokens:0,textOutTokens:0,audioInTokens:0,audioOutTokens:0,cost:0,startedAt:Date.now()},ei({...eb.current}),!eC()){G("Not authenticated — please log in"),A(!1);return}let e="https:"===location.protocol?"wss":"ws",t=new WebSocket("".concat(e,"://").concat(location.host,"/v1/realtime?model=").concat(encodeURIComponent(l),"&voice=").concat(encodeURIComponent(o)));t.binaryType="arraybuffer",eo.current=t,t.onopen=()=>{h(!0),A(!1),F("Connected"),eb.current.startedAt=Date.now();try{let e=ey.current,r="none"===e.vadMode?{type:"disabled"}:{type:e.vadMode};t.send(JSON.stringify({type:"session.update",event_id:"evt_".concat(Date.now()),session:{type:"realtime",model:l.split("/").pop(),output_modalities:["audio"],instructions:e.systemInstructions||void 0,temperature:e.temperature,audio:{input:{format:{type:"audio/pcm",rate:24e3},turn_detection:r},output:{format:{type:"audio/pcm"},voice:o}}}}))}catch(e){G("session.update failed: ".concat(e instanceof Error?e.message:String(e)))}},t.onmessage=async e=>{let t=null;try{t=JSON.parse("string"==typeof e.data?e.data:new TextDecoder().decode(e.data))}catch(e){return}if(!t||"object"!=typeof t)return;eb.current.framesOut+=1;let r=t.type;if("response.output_audio.delta"===r&&"string"==typeof t.delta){eT(t.delta);try{e_(t.delta)}catch(e){}}else if("response.output_audio_transcript.delta"===r&&"string"==typeof t.delta){ej.current=(ej.current||"")+t.delta;let e=ej.current.length>8e3?ej.current.slice(-8e3):ej.current;ej.current=e,U(e)}else if("response.output_text.delta"===r&&"string"==typeof t.delta){ej.current=(ej.current||"")+t.delta;let e=ej.current.length>8e3?ej.current.slice(-8e3):ej.current;ej.current=e,U(e)}else if("response.output_audio_transcript.done"===r&&"string"==typeof t.transcript)eI("assistant",t.transcript);else if("response.done"===r||"response.completed"===r){let e=t.response,r=(null==e?void 0:e.usage)||{},s=r.input_token_details||{},a=r.output_token_details||{};eb.current.textInTokens=Number(s.text_tokens||0),eb.current.textOutTokens=Number(a.text_tokens||0),eb.current.audioInTokens=Number(s.audio_tokens||0),eb.current.audioOutTokens=Number(a.audio_tokens||0)}else"error"===r&&G("".concat(t.code||"error",": ").concat(t.message||"unknown"))},t.onerror=()=>{G("WebSocket error — see console"),F("Error")},t.onclose=e=>{var t;if(h(!1),A(!1),F("Disconnected (".concat(e.code,")")),null===(t=eE.current)||void 0===t||t.call(eE),ed.current){try{ed.current.close()}catch(e){}ed.current=null}null!=ef.current&&(window.clearTimeout(ef.current),ef.current=null),X(!1)}},[l,o,eC,e_,eT,eI]),eR=(0,a.useCallback)(()=>{var e;if(eo.current){try{eo.current.close(1e3,"user disconnect")}catch(e){}eo.current=null}null===(e=eE.current)||void 0===e||e.call(eE)},[]),eE=(0,a.useRef)(null),eA=(0,a.useRef)(null),eD=(0,a.useCallback)(async()=>{if(eo.current&&eo.current.readyState===WebSocket.OPEN)try{let e=await navigator.mediaDevices.getUserMedia({audio:{sampleRate:24e3,channelCount:1,echoCancellation:!0,noiseSuppression:!0}});if(ex.current=e,!eu.current){let e=window.AudioContext||window.webkitAudioContext;eu.current=new e({sampleRate:24e3})}let t=eu.current,r=t.createMediaStreamSource(e);eh.current=r;let s=t.createScriptProcessor(4096,1,1);em.current=s;let a=new Int16Array(0),n=new Int16Array(4096);s.onaudioprocess=e=>{if(!eo.current||eo.current.readyState!==WebSocket.OPEN)return;let t=e.inputBuffer.getChannelData(0),r=function(e,t,r){let s=Math.min(r,e.length,t.length);for(let r=0;r1?s=1:s<-1&&(s=-1),t[r]=s<0?32768*s:32767*s}return s}(t,n,t.length);ev.current=function(e,t){let r=Math.min(t,e.length);if(r<=0)return 0;let s=0;for(let t=0;t=2400;){let e=a.slice(0,2400);a=a.slice(2400);let t=function(e){if(!e.length)return"";let t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r="";for(let e=0;e{if(em.current){try{em.current.disconnect()}catch(e){}em.current=null}if(eh.current){try{eh.current.disconnect()}catch(e){}eh.current=null}ex.current&&(ex.current.getTracks().forEach(e=>e.stop()),ex.current=null),ev.current=0,Z(!1),m&&F("Connected")},[m]);(0,a.useEffect)(()=>{eA.current=eD,eE.current=eZ},[eD,eZ]);let eP=(0,a.useCallback)(()=>{let e=V.trim();if(e&&eo.current&&eo.current.readyState===WebSocket.OPEN)try{eI("user",e),eo.current.send(JSON.stringify({type:"conversation.item.create",event_id:"txt_".concat(Date.now()),item:{type:"message",role:"user",content:[{type:"input_text",text:e}]}})),eo.current.send(JSON.stringify({type:"response.create",event_id:"rc_".concat(Date.now())})),W("")}catch(e){G("send failed: ".concat(e instanceof Error?e.message:String(e)))}},[V,eI]);(0,a.useEffect)(()=>()=>{if(eR(),eu.current)try{eu.current.close()}catch(e){}if(ed.current)try{ed.current.close()}catch(e){}null!=eg.current&&window.clearInterval(eg.current),null!=ef.current&&window.clearTimeout(ef.current)},[eR]);let eF=m||p;return(0,s.jsxs)("div",{className:"flex flex-col h-[calc(100vh-6rem)]",children:[(0,s.jsxs)("div",{className:"page-header flex-shrink-0",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"page-title",children:"Realtime Voice"}),(0,s.jsx)("p",{className:"page-sub",children:"Low-latency audio sessions via OpenAI Realtime and Gemini Live"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("button",{className:"btn-secondary ".concat(Y?"border-nexus-500/50":""),onClick:()=>$(e=>!e),type:"button",title:"Session settings",children:[(0,s.jsx)(u.Z,{className:"w-4 h-4"})," Settings"]}),(0,s.jsx)("button",{className:"btn-ghost",onClick:eO,title:"Reset transcript and history",children:(0,s.jsx)(f.Z,{className:"w-4 h-4"})})]})]}),B&&(0,s.jsxs)("div",{className:"mb-3 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2 flex items-start gap-2 text-sm text-red-300 flex-shrink-0",children:[(0,s.jsx)(g.Z,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),(0,s.jsx)("span",{className:"flex-1",children:B}),(0,s.jsx)("button",{onClick:()=>G(""),className:"text-red-300/70 hover:text-red-200",title:"Dismiss",children:(0,s.jsx)(d.Z,{className:"w-4 h-4"})})]}),Y&&(0,s.jsx)("div",{className:"mb-3 flex-shrink-0",children:(0,s.jsx)(M,{systemInstructions:Q,setSystemInstructions:ee,temperature:et,setTemperature:er,vadMode:es,setVadMode:ea,autoScroll:en,setAutoScroll:el,open:Y,onClose:()=>$(!1)})}),(0,s.jsx)("div",{className:"mb-3 flex-shrink-0",children:(0,s.jsx)(_,{stats:ec,isPlaying:K})}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-3 flex-shrink-0",children:[(0,s.jsxs)("div",{className:"card md:col-span-2",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,s.jsx)(I,{models:e,model:l,setModel:i,disabled:m}),(0,s.jsx)(O,{voicesForModel:ew,voice:o,setVoice:x,disabled:m}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:m?(0,s.jsxs)("button",{className:"btn-secondary",onClick:eR,children:[(0,s.jsx)(j.Z,{className:"w-4 h-4"}),"Disconnect"]}):(0,s.jsxs)("button",{className:"btn-primary",onClick:eM,disabled:p||!l,children:[p?(0,s.jsx)(v.Z,{className:"w-4 h-4 animate-pulse"}):(0,s.jsx)(b.Z,{className:"w-4 h-4"}),p?"Connecting…":"Connect"]})})]}),(0,s.jsxs)("div",{className:"mt-3 flex items-center gap-3",children:[(0,s.jsx)(S,{status:P,connected:m,connecting:p}),!ek&&!p&&(0,s.jsx)("span",{className:"text-xs text-[var(--text-tertiary)]",children:"No realtime models discovered yet — you can still type any model id above."})]})]}),(0,s.jsxs)("div",{className:"card flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-around",children:[(0,s.jsx)("button",{className:"btn-secondary !p-3 transition-all ".concat(D?"border-emerald-500/50 bg-emerald-500/10 shadow-[0_0_20px_rgba(16,185,129,0.2)]":""),onClick:D?eZ:eD,disabled:!m,title:D?"Stop microphone":"Start microphone",type:"button",children:D?(0,s.jsx)(y.Z,{className:"w-5 h-5"}):(0,s.jsx)(N.Z,{className:"w-5 h-5"})}),(0,s.jsxs)("div",{className:"text-xs text-[var(--text-tertiary)] text-center",children:[K?(0,s.jsx)(c.Z,{className:"w-5 h-5 mx-auto mb-1 text-nexus-400 animate-pulse"}):(0,s.jsx)(w.Z,{className:"w-5 h-5 mx-auto mb-1"}),K?"Audio out":"Idle"]}),(0,s.jsx)("button",{className:"btn-ghost",onClick:()=>{U(""),ej.current=""},title:"Clear transcript",type:"button",children:(0,s.jsx)(f.Z,{className:"w-4 h-4"})})]}),(0,s.jsx)(T,{micOn:D,levelRef:ev,isPlaying:K})]})]}),(0,s.jsxs)("div",{className:"card flex-1 flex flex-col min-h-0 mb-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("label",{className:"label !mb-0",children:"Live transcript"}),(0,s.jsx)("span",{className:"text-[10px] text-[var(--text-tertiary)] uppercase tracking-wider",children:en?"auto-scroll on":"auto-scroll off"})]}),(0,s.jsx)(R,{text:L,autoScroll:en,hasStarted:eF})]}),(0,s.jsx)(E,{turns:J,onClear:()=>z([])}),(0,s.jsxs)("div",{className:"card flex-shrink-0 mt-3",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{className:"input flex-1",value:V,onChange:e=>W(e.target.value),onKeyDown:e=>{"Enter"===e.key&&eP()},placeholder:"Inject a text message (push-to-text)…",disabled:!m}),(0,s.jsx)("button",{className:"btn-primary",onClick:eP,disabled:!m||!V.trim(),type:"button",children:(0,s.jsx)(k.Z,{className:"w-4 h-4"})})]}),(0,s.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mt-2",children:"Realtime audio is forwarded as-is to the upstream provider. Per-frame work is <10\xb5s on the gateway."})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return x},hi:function(){return d},jl:function(){return l},qz:function(){return n}});let s=r(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function n(){localStorage.removeItem("nexus_token")}function l(){return!!a()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},i=new Map,o=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",l=a(),u={"Content-Type":"application/json",...t.headers};if(l&&(u.Authorization="Bearer ".concat(l)),"GET"===r&&!l){let t=function(e){let t=i.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){i.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let d=(async()=>{let a=await fetch("".concat(s).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&l&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw n(),i.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let c=await a.json();return"GET"!==r||l||function(e,t){if(i.size>=200){let e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===r&&!l){o.set(e,d);try{return await d}finally{o.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let s=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=s.access_token,localStorage.setItem("nexus_token",r),s},getMe:()=>u("/api/auth/me"),logout:()=>{n(),i.clear(),window.location.href="/login"}},x=async e=>{let t=a(),r=await fetch("".concat(s).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let n=await r.blob(),l=URL.createObjectURL(n),c=document.createElement("a");c.href=l,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(l)}}},function(e){e.O(0,[5029,2971,2117,1744],function(){return e(e.s=5441)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[655],{5441:function(e,t,r){Promise.resolve().then(r.bind(r,5354))},5354:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return A}});var s=r(7437),n=r(2265),a=r(1723),l=r(4401),c=r(1706),i=r(3417),o=r(5252),u=r(8728),d=r(2489),m=r(5621),x=r(2135),h=r(875),p=r(8930),f=r(7168),g=r(9322),v=r(2926),b=r(3041),j=r(7133),y=r(8662),N=r(730),w=r(5395),k=r(4743),S=r(1837);let C=(0,n.memo)(function(e){let{status:t,connected:r,connecting:n}=e;return(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[var(--text-secondary)]",children:[(0,s.jsx)("span",{className:"inline-block w-2 h-2 rounded-full transition-all duration-200 ".concat(r?"bg-emerald-400 shadow-[0_0_10px_rgba(52,211,153,0.7)]":n?"bg-yellow-400 animate-pulse":"bg-gray-500")}),(0,s.jsx)("span",{children:t})]})}),_=(0,n.memo)(function(e){let{stats:t,isPlaying:r}=e,n=t.startedAt>0?Math.max(0,(Date.now()-t.startedAt)/1e3):0,u=n>0?"".concat(n.toFixed(0),"s"):"—";return(0,s.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-2 text-xs",children:[(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)]",children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(a.Z,{className:"w-3 h-3"})," Duration"]}),(0,s.jsx)("div",{className:"font-mono text-sm",children:u})]}),(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)]",children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(l.Z,{className:"w-3 h-3"})," Frames"]}),(0,s.jsxs)("div",{className:"font-mono text-sm",children:[(0,s.jsxs)("span",{className:"text-emerald-400",children:["↑",t.framesIn]})," ",(0,s.jsxs)("span",{className:"text-sky-400",children:["↓",t.framesOut]})]})]}),(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)]",children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(c.Z,{className:"w-3 h-3"})," Audio"]}),(0,s.jsxs)("div",{className:"font-mono text-sm",children:[(t.audioInMs/1e3).toFixed(1),"s",(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" in"}),(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" \xb7 "}),(t.audioOutMs/1e3).toFixed(1),"s",(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" out"})]})]}),(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)]",children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(i.Z,{className:"w-3 h-3"})," Tokens"]}),(0,s.jsxs)("div",{className:"font-mono text-sm",children:[t.audioInTokens+t.textInTokens,(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" in"}),(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" \xb7 "}),t.audioOutTokens+t.textOutTokens,(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:" out"})]})]}),(0,s.jsxs)("div",{className:"bg-[var(--surface-100)] rounded-lg px-3 py-2 border border-[var(--border)] flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--text-tertiary)] flex items-center gap-1",children:[(0,s.jsx)(o.Z,{className:"w-3 h-3"})," Cost"]}),(0,s.jsxs)("div",{className:"font-mono text-sm",children:["$",t.cost.toFixed(5)]})]}),r&&(0,s.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-nexus-400 animate-pulse shadow-[0_0_8px_rgba(99,102,241,0.7)]"})]})]})}),T=(0,n.memo)(function(e){let{micOn:t,levelRef:r,isPlaying:a}=e,l=(0,n.useRef)(null),c=(0,n.useRef)(null);return(0,n.useEffect)(()=>{let e=l.current;if(!e)return;let s=e.getContext("2d");if(!s)return;let n=()=>{let l=e.width,i=e.height;s.clearRect(0,0,l,i);let o=t?Math.min(1,3*r.current):0,u=l/24,d=Date.now()/200;for(let e=0;e<24;e++){let r=Math.max(2,Math.max(0,(t?o:0)*(.6+.4*Math.sin(d+.35*e))+(a?.05+.04*Math.sin(1.5*d+.5*e):0))*i*.95),n=e*u+.15*u,l=(i-r)/2,c=s.createLinearGradient(0,l,0,l+r);t?(c.addColorStop(0,"#10b981"),c.addColorStop(1,"#34d399")):a?(c.addColorStop(0,"#6366f1"),c.addColorStop(1,"#818cf8")):(c.addColorStop(0,"#374151"),c.addColorStop(1,"#4b5563")),s.fillStyle=c,s.fillRect(n,l,.7*u,r)}c.current=requestAnimationFrame(n)};return c.current=requestAnimationFrame(n),()=>{null!=c.current&&cancelAnimationFrame(c.current)}},[t,a,r]),(0,s.jsx)("canvas",{ref:l,width:400,height:56,className:"w-full h-14 rounded-lg bg-[var(--surface-100)] border border-[var(--border)]"})}),I=(0,n.memo)(function(e){let{models:t,model:r,setModel:n,disabled:a}=e;return(0,s.jsxs)("div",{className:"flex-1 min-w-[200px]",children:[(0,s.jsx)("label",{className:"label",children:"Model"}),(0,s.jsx)("input",{className:"input",list:"rt-models",value:r,onChange:e=>n(e.target.value),placeholder:t.length?"pick a realtime model":"loading models…",disabled:a}),(0,s.jsx)("datalist",{id:"rt-models",children:t.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))})]})}),O=(0,n.memo)(function(e){let{voicesForModel:t,voice:r,setVoice:n,disabled:a}=e;return 0===t.length?(0,s.jsxs)("div",{className:"w-40",children:[(0,s.jsx)("label",{className:"label",children:"Voice"}),(0,s.jsx)("input",{className:"input",value:r,onChange:e=>n(e.target.value),placeholder:"voice id",disabled:a})]}):(0,s.jsxs)("div",{className:"w-40",children:[(0,s.jsx)("label",{className:"label",children:"Voice"}),(0,s.jsx)("select",{className:"input",value:r,onChange:e=>n(e.target.value),disabled:a,children:t.map(e=>(0,s.jsx)("option",{value:e,children:e},e))})]})}),M=(0,n.memo)(function(e){let{systemInstructions:t,setSystemInstructions:r,temperature:n,setTemperature:a,vadMode:l,setVadMode:c,autoScroll:i,setAutoScroll:o,open:m,onClose:x}=e;return m?(0,s.jsxs)("div",{className:"card border border-[var(--border)] space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"text-sm font-semibold flex items-center gap-2",children:[(0,s.jsx)(u.Z,{className:"w-4 h-4"})," Session settings"]}),(0,s.jsx)("button",{className:"btn-ghost !p-1",onClick:x,title:"Close settings",children:(0,s.jsx)(d.Z,{className:"w-4 h-4"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"System instructions"}),(0,s.jsx)("textarea",{className:"input min-h-[72px] resize-y",value:t,onChange:e=>r(e.target.value),placeholder:"You are a helpful, concise voice assistant. Keep replies brief."})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"label",children:["Temperature ",(0,s.jsx)("span",{className:"text-[var(--text-tertiary)]",children:n.toFixed(2)})]}),(0,s.jsx)("input",{type:"range",min:0,max:1.5,step:.05,value:n,onChange:e=>a(parseFloat(e.target.value)),className:"w-full accent-nexus-500"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"VAD mode"}),(0,s.jsxs)("select",{className:"input",value:l,onChange:e=>c(e.target.value),children:[(0,s.jsx)("option",{value:"server_vad",children:"server_vad (default)"}),(0,s.jsx)("option",{value:"semantic_vad",children:"semantic_vad (Gemini)"}),(0,s.jsx)("option",{value:"none",children:"none (push-to-talk)"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"label",children:"Auto-scroll"}),(0,s.jsx)("button",{className:"input text-left ".concat(i?"border-nexus-500/50":""),onClick:()=>o(!i),type:"button",children:i?"On — follow latest":"Off — manual scroll"})]})]})]}):null}),R=(0,n.memo)(function(e){let{text:t,autoScroll:r,hasStarted:a}=e,l=(0,n.useRef)(null);return(0,n.useEffect)(()=>{r&&l.current&&(l.current.scrollTop=l.current.scrollHeight)},[t,r]),(0,s.jsx)("div",{ref:l,className:"flex-1 bg-[var(--surface-100)] rounded-lg p-4 overflow-y-auto text-sm whitespace-pre-wrap min-h-[160px] max-h-[40vh] leading-relaxed",children:t||(0,s.jsx)("span",{className:"text-[var(--text-tertiary)] italic",children:a?"…listening. Speak or send a text message to begin.":"No session yet. Pick a model and voice, then click Connect."})})}),E=(0,n.memo)(function(e){let{turns:t,onClear:r}=e,[a,l]=(0,n.useState)(!1);return 0===t.length?null:(0,s.jsxs)("div",{className:"card flex-shrink-0",children:[(0,s.jsxs)("button",{className:"w-full flex items-center justify-between text-sm",onClick:()=>l(e=>!e),type:"button",children:[(0,s.jsxs)("span",{className:"flex items-center gap-2 font-semibold",children:[(0,s.jsx)(m.Z,{className:"w-4 h-4"})," Conversation history",(0,s.jsxs)("span",{className:"text-[var(--text-tertiary)] font-normal",children:["(",t.length,")"]})]}),a?(0,s.jsx)(x.Z,{className:"w-4 h-4 text-[var(--text-tertiary)]"}):(0,s.jsx)(h.Z,{className:"w-4 h-4 text-[var(--text-tertiary)]"})]}),a&&(0,s.jsxs)("div",{className:"mt-3 space-y-2 max-h-40 overflow-y-auto",children:[t.slice(-50).map(e=>(0,s.jsxs)("div",{className:"text-xs flex gap-2",children:[(0,s.jsx)("span",{className:"flex-shrink-0 font-semibold ".concat("user"===e.role?"text-sky-400":"assistant"===e.role?"text-emerald-400":"text-[var(--text-tertiary)]"),children:e.role}),(0,s.jsx)("span",{className:"flex-1 text-[var(--text-secondary)] break-words",children:e.text||(0,s.jsx)("em",{className:"text-[var(--text-tertiary)]",children:"…"})})]},e.id)),(0,s.jsxs)("button",{className:"btn-ghost text-xs flex items-center gap-1",onClick:r,type:"button",children:[(0,s.jsx)(p.Z,{className:"w-3 h-3"})," Clear history"]})]})]})});function A(){let[e,t]=(0,n.useState)([]),[r,a]=(0,n.useState)({}),[l,i]=(0,n.useState)(""),[o,m]=(0,n.useState)(""),[x,h]=(0,n.useState)(!1),[p,A]=(0,n.useState)(!1),[D,Z]=(0,n.useState)(!1),[P,F]=(0,n.useState)("Disconnected"),[U,L]=(0,n.useState)(""),[B,G]=(0,n.useState)(""),[V,W]=(0,n.useState)(""),[J,z]=(0,n.useState)([]),[q,H]=(0,n.useState)(0),[K,X]=(0,n.useState)(!1),[Y,$]=(0,n.useState)(!1),[Q,ee]=(0,n.useState)(""),[et,er]=(0,n.useState)(.8),[es,en]=(0,n.useState)("server_vad"),[ea,el]=(0,n.useState)(!0),[ec,ei]=(0,n.useState)({framesIn:0,framesOut:0,audioInMs:0,audioOutMs:0,textInTokens:0,textOutTokens:0,audioInTokens:0,audioOutTokens:0,cost:0,startedAt:0}),eo=(0,n.useRef)(null),eu=(0,n.useRef)(null),ed=(0,n.useRef)(null),em=(0,n.useRef)(null),ex=(0,n.useRef)(null),eh=(0,n.useRef)(null),ep=(0,n.useRef)(0),ef=(0,n.useRef)(null),eg=(0,n.useRef)(null),ev=(0,n.useRef)(0),eb=(0,n.useRef)({framesIn:0,framesOut:0,audioInMs:0,audioOutMs:0,textInTokens:0,textOutTokens:0,audioInTokens:0,audioOutTokens:0,cost:0,startedAt:0}),ej=(0,n.useRef)(""),ey=(0,n.useRef)({systemInstructions:Q,temperature:et,vadMode:es});(0,n.useEffect)(()=>{ey.current={systemInstructions:Q,temperature:et,vadMode:es}},[Q,et,es]),(0,n.useEffect)(()=>{let e=!1;return S.hi.get("/api/realtime/models").then(r=>{if(e)return;let s=(r.models||[]).slice();s.sort((e,t)=>e.id.localeCompare(t.id)),t(s),s.length>0&&i(e=>e||s[0].id)}).catch(()=>{e||S.hi.get("/v1/models").then(r=>{if(e)return;let s=(r.data||[]).slice();s.sort((e,t)=>e.id.localeCompare(t.id)),t(s),s.length>0&&i(e=>e||s[0].id)}).catch(()=>{})}),S.hi.get("/api/realtime/voices").then(t=>{e||(a(t||{}),m(e=>{if(e)return e;for(let e of Object.keys(t||{}))if((t[e]||[]).length>0)return t[e][0];return""}))}).catch(()=>a({})),()=>{e=!0}},[]),(0,n.useEffect)(()=>{if(!x){null!=eg.current&&(window.clearInterval(eg.current),eg.current=null);return}return eg.current=window.setInterval(()=>{ei({...eb.current})},500),()=>{null!=eg.current&&(window.clearInterval(eg.current),eg.current=null)}},[x]);let eN=(0,n.useMemo)(()=>l.split("/")[0]||"",[l]),ew=(0,n.useMemo)(()=>r[eN]||[],[r,eN]),ek=e.length>0,eS=(0,n.useCallback)(()=>localStorage.getItem("nexus_token"),[]),eC=(0,n.useCallback)(()=>{if(!ed.current){let e=window.AudioContext||window.webkitAudioContext;ed.current=new e({sampleRate:24e3}),ep.current=0}return ed.current},[]),e_=(0,n.useCallback)(e=>{if(!e)return;let t=eC(),r=new Float32Array(e.length/2),s=function(e,t){if(!e)return 0;let r=atob(e),s=r.length;if(s<2)return 0;let n=new Uint8Array(s);for(let e=0;eX(!1),Math.ceil(1e3*a.duration)+50)},[eC]),eT=(0,n.useCallback)(e=>{let t=e.length/2*1e3/24e3;eb.current.audioOutMs+=t},[]),eI=(0,n.useCallback)((e,t)=>{z(r=>{let s=r.slice(),n=s[s.length-1];return n&&n.role===e?s[s.length-1]={...n,text:n.text+t,ts:Date.now()}:s.push({id:q,role:e,text:t,ts:Date.now()}),s.slice(-50)}),H(e=>e+1)},[q]),eO=(0,n.useCallback)(()=>{L(""),ej.current="",G(""),z([])},[]),eM=(0,n.useCallback)(async()=>{if(!l)return;if(A(!0),G(""),F("Connecting…"),L(""),ej.current="",z([]),eb.current={framesIn:0,framesOut:0,audioInMs:0,audioOutMs:0,textInTokens:0,textOutTokens:0,audioInTokens:0,audioOutTokens:0,cost:0,startedAt:Date.now()},ei({...eb.current}),!eS()){G("Not authenticated — please log in"),A(!1);return}let e="https:"===location.protocol?"wss":"ws",t=new WebSocket("".concat(e,"://").concat(location.host,"/v1/realtime?model=").concat(encodeURIComponent(l),"&voice=").concat(encodeURIComponent(o)));t.binaryType="arraybuffer",eo.current=t,t.onopen=()=>{h(!0),A(!1),F("Connected"),eb.current.startedAt=Date.now();try{let e=ey.current,r="none"===e.vadMode?{type:"disabled"}:{type:e.vadMode};t.send(JSON.stringify({type:"session.update",event_id:"evt_".concat(Date.now()),session:{type:"realtime",model:l.split("/").pop(),output_modalities:["audio"],instructions:e.systemInstructions||void 0,temperature:e.temperature,audio:{input:{format:{type:"audio/pcm",rate:24e3},turn_detection:r},output:{format:{type:"audio/pcm"},voice:o}}}}))}catch(e){G("session.update failed: ".concat(e instanceof Error?e.message:String(e)))}},t.onmessage=async e=>{let t=null;try{t=JSON.parse("string"==typeof e.data?e.data:new TextDecoder().decode(e.data))}catch(e){return}if(!t||"object"!=typeof t)return;eb.current.framesOut+=1;let r=t.type;if("response.output_audio.delta"===r&&"string"==typeof t.delta){eT(t.delta);try{e_(t.delta)}catch(e){}}else if("response.output_audio_transcript.delta"===r&&"string"==typeof t.delta){ej.current=(ej.current||"")+t.delta;let e=ej.current.length>8e3?ej.current.slice(-8e3):ej.current;ej.current=e,L(e)}else if("response.output_text.delta"===r&&"string"==typeof t.delta){ej.current=(ej.current||"")+t.delta;let e=ej.current.length>8e3?ej.current.slice(-8e3):ej.current;ej.current=e,L(e)}else if("response.output_audio_transcript.done"===r&&"string"==typeof t.transcript)eI("assistant",t.transcript);else if("response.done"===r||"response.completed"===r){let e=t.response,r=(null==e?void 0:e.usage)||{},s=r.input_token_details||{},n=r.output_token_details||{};eb.current.textInTokens=Number(s.text_tokens||0),eb.current.textOutTokens=Number(n.text_tokens||0),eb.current.audioInTokens=Number(s.audio_tokens||0),eb.current.audioOutTokens=Number(n.audio_tokens||0)}else"error"===r&&G("".concat(t.code||"error",": ").concat(t.message||"unknown"))},t.onerror=()=>{G("WebSocket error — see console"),F("Error")},t.onclose=e=>{var t;if(h(!1),A(!1),F("Disconnected (".concat(e.code,")")),null===(t=eE.current)||void 0===t||t.call(eE),ed.current){try{ed.current.close()}catch(e){}ed.current=null}null!=ef.current&&(window.clearTimeout(ef.current),ef.current=null),X(!1)}},[l,o,eS,e_,eT,eI]),eR=(0,n.useCallback)(()=>{var e;if(eo.current){try{eo.current.close(1e3,"user disconnect")}catch(e){}eo.current=null}null===(e=eE.current)||void 0===e||e.call(eE)},[]),eE=(0,n.useRef)(null),eA=(0,n.useRef)(null),eD=(0,n.useCallback)(async()=>{if(eo.current&&eo.current.readyState===WebSocket.OPEN)try{let e=await navigator.mediaDevices.getUserMedia({audio:{sampleRate:24e3,channelCount:1,echoCancellation:!0,noiseSuppression:!0}});if(em.current=e,!eu.current){let e=window.AudioContext||window.webkitAudioContext;eu.current=new e({sampleRate:24e3})}let t=eu.current,r=t.createMediaStreamSource(e);eh.current=r;let s=t.createScriptProcessor(4096,1,1);ex.current=s;let n=new Int16Array(0),a=new Int16Array(4096);s.onaudioprocess=e=>{if(!eo.current||eo.current.readyState!==WebSocket.OPEN)return;let t=e.inputBuffer.getChannelData(0),r=function(e,t,r){let s=Math.min(r,e.length,t.length);for(let r=0;r1?s=1:s<-1&&(s=-1),t[r]=s<0?32768*s:32767*s}return s}(t,a,t.length);ev.current=function(e,t){let r=Math.min(t,e.length);if(r<=0)return 0;let s=0;for(let t=0;t=2400;){let e=n.slice(0,2400);n=n.slice(2400);let t=function(e){if(!e.length)return"";let t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r="";for(let e=0;e{if(ex.current){try{ex.current.disconnect()}catch(e){}ex.current=null}if(eh.current){try{eh.current.disconnect()}catch(e){}eh.current=null}em.current&&(em.current.getTracks().forEach(e=>e.stop()),em.current=null),ev.current=0,Z(!1),x&&F("Connected")},[x]);(0,n.useEffect)(()=>{eA.current=eD,eE.current=eZ},[eD,eZ]);let eP=(0,n.useCallback)(()=>{let e=V.trim();if(e&&eo.current&&eo.current.readyState===WebSocket.OPEN)try{eI("user",e),eo.current.send(JSON.stringify({type:"conversation.item.create",event_id:"txt_".concat(Date.now()),item:{type:"message",role:"user",content:[{type:"input_text",text:e}]}})),eo.current.send(JSON.stringify({type:"response.create",event_id:"rc_".concat(Date.now())})),W("")}catch(e){G("send failed: ".concat(e instanceof Error?e.message:String(e)))}},[V,eI]);(0,n.useEffect)(()=>()=>{if(eR(),eu.current)try{eu.current.close()}catch(e){}if(ed.current)try{ed.current.close()}catch(e){}null!=eg.current&&window.clearInterval(eg.current),null!=ef.current&&window.clearTimeout(ef.current)},[eR]);let eF=x||p;return(0,s.jsxs)("div",{className:"flex flex-col h-[calc(100vh-6rem)]",children:[(0,s.jsxs)("div",{className:"page-header flex-shrink-0",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"page-title",children:"Realtime Voice"}),(0,s.jsx)("p",{className:"page-sub",children:"Low-latency audio sessions via OpenAI Realtime and Gemini Live"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("button",{className:"btn-secondary ".concat(Y?"border-nexus-500/50":""),onClick:()=>$(e=>!e),type:"button",title:"Session settings",children:[(0,s.jsx)(u.Z,{className:"w-4 h-4"})," Settings"]}),(0,s.jsx)("button",{className:"btn-ghost",onClick:eO,title:"Reset transcript and history",children:(0,s.jsx)(f.Z,{className:"w-4 h-4"})})]})]}),B&&(0,s.jsxs)("div",{className:"mb-3 rounded-lg border border-red-500/30 bg-red-500/5 px-3 py-2 flex items-start gap-2 text-sm text-red-300 flex-shrink-0",children:[(0,s.jsx)(g.Z,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),(0,s.jsx)("span",{className:"flex-1",children:B}),(0,s.jsx)("button",{onClick:()=>G(""),className:"text-red-300/70 hover:text-red-200",title:"Dismiss",children:(0,s.jsx)(d.Z,{className:"w-4 h-4"})})]}),Y&&(0,s.jsx)("div",{className:"mb-3 flex-shrink-0",children:(0,s.jsx)(M,{systemInstructions:Q,setSystemInstructions:ee,temperature:et,setTemperature:er,vadMode:es,setVadMode:en,autoScroll:ea,setAutoScroll:el,open:Y,onClose:()=>$(!1)})}),(0,s.jsx)("div",{className:"mb-3 flex-shrink-0",children:(0,s.jsx)(_,{stats:ec,isPlaying:K})}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-3 flex-shrink-0",children:[(0,s.jsxs)("div",{className:"card md:col-span-2",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,s.jsx)(I,{models:e,model:l,setModel:i,disabled:x}),(0,s.jsx)(O,{voicesForModel:ew,voice:o,setVoice:m,disabled:x}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:x?(0,s.jsxs)("button",{className:"btn-secondary",onClick:eR,children:[(0,s.jsx)(j.Z,{className:"w-4 h-4"}),"Disconnect"]}):(0,s.jsxs)("button",{className:"btn-primary",onClick:eM,disabled:p||!l,children:[p?(0,s.jsx)(v.Z,{className:"w-4 h-4 animate-pulse"}):(0,s.jsx)(b.Z,{className:"w-4 h-4"}),p?"Connecting…":"Connect"]})})]}),(0,s.jsxs)("div",{className:"mt-3 flex items-center gap-3",children:[(0,s.jsx)(C,{status:P,connected:x,connecting:p}),!ek&&!p&&(0,s.jsx)("span",{className:"text-xs text-[var(--text-tertiary)]",children:"No realtime models discovered yet — you can still type any model id above."})]})]}),(0,s.jsxs)("div",{className:"card flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-around",children:[(0,s.jsx)("button",{className:"btn-secondary !p-3 transition-all ".concat(D?"border-emerald-500/50 bg-emerald-500/10 shadow-[0_0_20px_rgba(16,185,129,0.2)]":""),onClick:D?eZ:eD,disabled:!x,title:D?"Stop microphone":"Start microphone",type:"button",children:D?(0,s.jsx)(y.Z,{className:"w-5 h-5"}):(0,s.jsx)(N.Z,{className:"w-5 h-5"})}),(0,s.jsxs)("div",{className:"text-xs text-[var(--text-tertiary)] text-center",children:[K?(0,s.jsx)(c.Z,{className:"w-5 h-5 mx-auto mb-1 text-nexus-400 animate-pulse"}):(0,s.jsx)(w.Z,{className:"w-5 h-5 mx-auto mb-1"}),K?"Audio out":"Idle"]}),(0,s.jsx)("button",{className:"btn-ghost",onClick:()=>{L(""),ej.current=""},title:"Clear transcript",type:"button",children:(0,s.jsx)(f.Z,{className:"w-4 h-4"})})]}),(0,s.jsx)(T,{micOn:D,levelRef:ev,isPlaying:K})]})]}),(0,s.jsxs)("div",{className:"card flex-1 flex flex-col min-h-0 mb-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("label",{className:"label !mb-0",children:"Live transcript"}),(0,s.jsx)("span",{className:"text-[10px] text-[var(--text-tertiary)] uppercase tracking-wider",children:ea?"auto-scroll on":"auto-scroll off"})]}),(0,s.jsx)(R,{text:U,autoScroll:ea,hasStarted:eF})]}),(0,s.jsx)(E,{turns:J,onClear:()=>z([])}),(0,s.jsxs)("div",{className:"card flex-shrink-0 mt-3",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{className:"input flex-1",value:V,onChange:e=>W(e.target.value),onKeyDown:e=>{"Enter"===e.key&&eP()},placeholder:"Inject a text message (push-to-text)…",disabled:!x}),(0,s.jsx)("button",{className:"btn-primary",onClick:eP,disabled:!x||!V.trim(),type:"button",children:(0,s.jsx)(k.Z,{className:"w-4 h-4"})})]}),(0,s.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mt-2",children:"Realtime audio is forwarded as-is to the upstream provider. Per-frame work is <10\xb5s on the gateway."})]})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return m},hi:function(){return d},jl:function(){return l},qz:function(){return a}});let s=r(257).env.NEXT_PUBLIC_API_BASE||"";function n(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function a(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function l(){return!!n()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},i=new Map,o=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",l=n(),u={"Content-Type":"application/json",...t.headers};if(l&&(u.Authorization="Bearer ".concat(l)),"GET"===r&&!l){let t=function(e){let t=i.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){i.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=o.get(e);if(r)return r}let d=(async()=>{let n=await fetch("".concat(s).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return n;if(401===n.status&&l&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),i.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!n.ok)throw Error((await n.json().catch(()=>({detail:n.statusText}))).detail||"HTTP ".concat(n.status));if(204===n.status)return;let c=await n.json();return"GET"!==r||l||function(e,t){if(i.size>=200){let e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===r&&!l){o.set(e,d);try{return await d}finally{o.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let s=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=s.access_token,localStorage.setItem("nexus_token",r),function(e,t,r){try{let r="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(r)}catch(e){}}("nexus_token",r,0),s},getMe:()=>u("/api/auth/me"),logout:()=>{a(),i.clear(),window.location.href="/login"}},m=async e=>{let t=n(),r=await fetch("".concat(s).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let a=await r.blob(),l=URL.createObjectURL(a),c=document.createElement("a");c.href=l,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(l)}}},function(e){e.O(0,[5029,2971,2117,1744],function(){return e(e.s=5441)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/response-filters/page-a17d9b3e46419030.js b/static/_next/static/chunks/app/response-filters/page-a17d9b3e46419030.js deleted file mode 100644 index c82b7939402643ecfc540de53babf793e277a1ba..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/response-filters/page-a17d9b3e46419030.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9542],{1240:function(e,t,n){Promise.resolve().then(n.bind(n,2110))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:o="",children:d,iconNode:u,...h}=e;return(0,r.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:n,strokeWidth:l?24*Number(c)/Number(a):c,className:i("lucide",o),...h},[...u.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let n=(0,r.forwardRef)((n,s)=>{let{className:l,...o}=n;return(0,r.createElement)(c,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),l),...o})});return n.displayName="".concat(e),n}},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8906:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var l=[],o=!1,d=-1;function u(){o&&r&&(o=!1,r.length?l=r.concat(l):d=-1,l.length&&h())}function h(){if(!o){var e=c(u);o=!0;for(var t=l.length;t;){for(r=l,l=[];++d1)for(var n=1;n{d(!0),h(""),i.hi.get("/api/response-filters").then(t).catch(e=>h(e instanceof Error?e.message:"Failed to load filters")).finally(()=>d(!1))};(0,a.useEffect)(()=>{b()},[]);let N=async e=>{try{await i.hi.patch("/api/response-filters/".concat(e,"/toggle")),b()}catch(e){x(e instanceof Error?e.message:"Failed to toggle")}},w=async e=>{if(confirm("Delete this response filter?"))try{await i.hi.delete("/api/response-filters/".concat(e)),b()}catch(e){x(e instanceof Error?e.message:"Failed to delete")}},k=e=>{if(!e)return y("Pattern is required"),!1;try{return new RegExp(e),y(""),!0}catch(e){return y(e instanceof Error?e.message:"Invalid pattern"),!1}},E=async()=>{if(g.name&&k(g.pattern))try{let e={name:g.name,pattern:g.pattern,action:g.action};g.description&&(e.description=g.description),"redact"===g.action&&g.replacement&&(e.replacement=g.replacement),await i.hi.post("/api/response-filters",e),m(!1),v({name:"",description:"",pattern:"",action:"redact",replacement:"[FILTERED]"}),y(""),b()}catch(e){x(e instanceof Error?e.message:"Failed to create")}};return a.useEffect(()=>{if(f){let e=setTimeout(()=>x(""),3e3);return()=>clearTimeout(e)}},[f]),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Response Filters"}),(0,r.jsx)("p",{className:"page-sub",children:"Block, redact, or flag patterns in model responses"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>m(!0),children:[(0,r.jsx)(s.Z,{size:16})," Add Filter"]})]}),p&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>m(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Response Filter"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name"}),(0,r.jsx)("input",{className:"input",value:g.name,onChange:e=>v(t=>({...t,name:e.target.value})),autoFocus:!0,placeholder:"e.g. Email Redactor"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Description"}),(0,r.jsx)("input",{className:"input",value:g.description,onChange:e=>v(t=>({...t,description:e.target.value})),placeholder:"Optional"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Pattern (regex)"}),(0,r.jsx)("input",{className:"input font-mono",value:g.pattern,onChange:e=>{v(t=>({...t,pattern:e.target.value})),g.pattern&&k(e.target.value)},onBlur:e=>k(e.target.value),placeholder:"\\\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Z|a-z]{2,}\\\\b"}),j&&(0,r.jsx)("p",{className:"text-xs text-red-400 mt-1",children:j}),(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:"Case-insensitive, multiline. Errors in the pattern are silently skipped."})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Action"}),(0,r.jsxs)("select",{className:"select",value:g.action,onChange:e=>v(t=>({...t,action:e.target.value})),children:[(0,r.jsx)("option",{value:"redact",children:"Redact — replace matches with replacement text"}),(0,r.jsx)("option",{value:"block",children:"Block — reject the entire response"}),(0,r.jsx)("option",{value:"flag",children:"Flag — log match, keep content"})]})]}),"redact"===g.action&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Replacement"}),(0,r.jsx)("input",{className:"input",value:g.replacement,onChange:e=>v(t=>({...t,replacement:e.target.value})),placeholder:"[FILTERED]"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:E,children:"Create"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>{m(!1),y("")},children:"Cancel"})]})]})]})}),u?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:u})]}):n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No response filters configured. Add one to scrub, block, or flag patterns in model outputs."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Pattern"}),(0,r.jsx)("th",{children:"Action"}),(0,r.jsx)("th",{children:"Replacement"}),(0,r.jsx)("th",{children:"Triggered"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsxs)("td",{className:"font-medium",children:[(0,r.jsx)("div",{children:e.name}),e.description&&(0,r.jsx)("div",{className:"text-xs text-[var(--text-tertiary)] mt-0.5",children:e.description})]}),(0,r.jsx)("td",{children:(0,r.jsx)("code",{className:"text-xs font-mono bg-surface-100 px-2 py-0.5 rounded break-all",children:e.pattern})}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:o[e.action]||"badge-gray",children:e.action})}),(0,r.jsx)("td",{className:"text-xs font-mono text-[var(--text-tertiary)]",children:"redact"===e.action?e.replacement||"[FILTERED]":"—"}),(0,r.jsx)("td",{className:"text-xs",children:(e.times_triggered||0).toLocaleString()}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>N(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsx)("button",{onClick:()=>w(e.id),className:"btn-danger btn-xs",children:"\xd7"})})]},e.id))})]})})}),f&&(0,r.jsx)("div",{className:"toast",children:f})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return s},qz:function(){return i}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function s(){return!!a()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",s=a(),d={"Content-Type":"application/json",...t.headers};if(s&&(d.Authorization="Bearer ".concat(s)),"GET"===n&&!s){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=o.get(e);if(n)return n}let u=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let c=await a.json();return"GET"!==n||s||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===n&&!s){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>d("/api/auth/me"),logout:()=>{i(),l.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let i=await n.blob(),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1240)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/response-filters/page-83edbfac0827cf2b.js b/static/_next/static/chunks/app/response-filters/page-a2dcc868f436b552.js similarity index 72% rename from static/_next/static/chunks/app/response-filters/page-83edbfac0827cf2b.js rename to static/_next/static/chunks/app/response-filters/page-a2dcc868f436b552.js index c82b7939402643ecfc540de53babf793e277a1ba..f28f6401290aff88e9a02cc400a30f36cad80c5d 100644 --- a/static/_next/static/chunks/app/response-filters/page-83edbfac0827cf2b.js +++ b/static/_next/static/chunks/app/response-filters/page-a2dcc868f436b552.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9542],{1240:function(e,t,n){Promise.resolve().then(n.bind(n,2110))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return l}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:l,className:o="",children:d,iconNode:u,...h}=e;return(0,r.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:n,strokeWidth:l?24*Number(c)/Number(a):c,className:i("lucide",o),...h},[...u.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let n=(0,r.forwardRef)((n,s)=>{let{className:l,...o}=n;return(0,r.createElement)(c,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),l),...o})});return n.displayName="".concat(e),n}},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8906:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var l=[],o=!1,d=-1;function u(){o&&r&&(o=!1,r.length?l=r.concat(l):d=-1,l.length&&h())}function h(){if(!o){var e=c(u);o=!0;for(var t=l.length;t;){for(r=l,l=[];++d1)for(var n=1;n{d(!0),h(""),i.hi.get("/api/response-filters").then(t).catch(e=>h(e instanceof Error?e.message:"Failed to load filters")).finally(()=>d(!1))};(0,a.useEffect)(()=>{b()},[]);let N=async e=>{try{await i.hi.patch("/api/response-filters/".concat(e,"/toggle")),b()}catch(e){x(e instanceof Error?e.message:"Failed to toggle")}},w=async e=>{if(confirm("Delete this response filter?"))try{await i.hi.delete("/api/response-filters/".concat(e)),b()}catch(e){x(e instanceof Error?e.message:"Failed to delete")}},k=e=>{if(!e)return y("Pattern is required"),!1;try{return new RegExp(e),y(""),!0}catch(e){return y(e instanceof Error?e.message:"Invalid pattern"),!1}},E=async()=>{if(g.name&&k(g.pattern))try{let e={name:g.name,pattern:g.pattern,action:g.action};g.description&&(e.description=g.description),"redact"===g.action&&g.replacement&&(e.replacement=g.replacement),await i.hi.post("/api/response-filters",e),m(!1),v({name:"",description:"",pattern:"",action:"redact",replacement:"[FILTERED]"}),y(""),b()}catch(e){x(e instanceof Error?e.message:"Failed to create")}};return a.useEffect(()=>{if(f){let e=setTimeout(()=>x(""),3e3);return()=>clearTimeout(e)}},[f]),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Response Filters"}),(0,r.jsx)("p",{className:"page-sub",children:"Block, redact, or flag patterns in model responses"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>m(!0),children:[(0,r.jsx)(s.Z,{size:16})," Add Filter"]})]}),p&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>m(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Response Filter"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name"}),(0,r.jsx)("input",{className:"input",value:g.name,onChange:e=>v(t=>({...t,name:e.target.value})),autoFocus:!0,placeholder:"e.g. Email Redactor"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Description"}),(0,r.jsx)("input",{className:"input",value:g.description,onChange:e=>v(t=>({...t,description:e.target.value})),placeholder:"Optional"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Pattern (regex)"}),(0,r.jsx)("input",{className:"input font-mono",value:g.pattern,onChange:e=>{v(t=>({...t,pattern:e.target.value})),g.pattern&&k(e.target.value)},onBlur:e=>k(e.target.value),placeholder:"\\\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Z|a-z]{2,}\\\\b"}),j&&(0,r.jsx)("p",{className:"text-xs text-red-400 mt-1",children:j}),(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:"Case-insensitive, multiline. Errors in the pattern are silently skipped."})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Action"}),(0,r.jsxs)("select",{className:"select",value:g.action,onChange:e=>v(t=>({...t,action:e.target.value})),children:[(0,r.jsx)("option",{value:"redact",children:"Redact — replace matches with replacement text"}),(0,r.jsx)("option",{value:"block",children:"Block — reject the entire response"}),(0,r.jsx)("option",{value:"flag",children:"Flag — log match, keep content"})]})]}),"redact"===g.action&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Replacement"}),(0,r.jsx)("input",{className:"input",value:g.replacement,onChange:e=>v(t=>({...t,replacement:e.target.value})),placeholder:"[FILTERED]"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:E,children:"Create"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>{m(!1),y("")},children:"Cancel"})]})]})]})}),u?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:u})]}):n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(l.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No response filters configured. Add one to scrub, block, or flag patterns in model outputs."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Pattern"}),(0,r.jsx)("th",{children:"Action"}),(0,r.jsx)("th",{children:"Replacement"}),(0,r.jsx)("th",{children:"Triggered"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsxs)("td",{className:"font-medium",children:[(0,r.jsx)("div",{children:e.name}),e.description&&(0,r.jsx)("div",{className:"text-xs text-[var(--text-tertiary)] mt-0.5",children:e.description})]}),(0,r.jsx)("td",{children:(0,r.jsx)("code",{className:"text-xs font-mono bg-surface-100 px-2 py-0.5 rounded break-all",children:e.pattern})}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:o[e.action]||"badge-gray",children:e.action})}),(0,r.jsx)("td",{className:"text-xs font-mono text-[var(--text-tertiary)]",children:"redact"===e.action?e.replacement||"[FILTERED]":"—"}),(0,r.jsx)("td",{className:"text-xs",children:(e.times_triggered||0).toLocaleString()}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>N(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsx)("button",{onClick:()=>w(e.id),className:"btn-danger btn-xs",children:"\xd7"})})]},e.id))})]})})}),f&&(0,r.jsx)("div",{className:"toast",children:f})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return s},qz:function(){return i}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function i(){localStorage.removeItem("nexus_token")}function s(){return!!a()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,o=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",s=a(),d={"Content-Type":"application/json",...t.headers};if(s&&(d.Authorization="Bearer ".concat(s)),"GET"===n&&!s){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=o.get(e);if(n)return n}let u=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let c=await a.json();return"GET"!==n||s||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===n&&!s){o.set(e,u);try{return await u}finally{o.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>d("/api/auth/me"),logout:()=>{i(),l.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let i=await n.blob(),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1240)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9542],{1240:function(e,t,n){Promise.resolve().then(n.bind(n,2110))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:l="",children:d,iconNode:u,...h}=e;return(0,r.createElement)("svg",{ref:t,...s,width:a,height:a,stroke:n,strokeWidth:o?24*Number(c)/Number(a):c,className:i("lucide",l),...h},[...u.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),o=(e,t)=>{let n=(0,r.forwardRef)((n,s)=>{let{className:o,...l}=n;return(0,r.createElement)(c,{ref:s,iconNode:t,className:i("lucide-".concat(a(e)),o),...l})});return n.displayName="".concat(e),n}},9322:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},8906:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var o=[],l=!1,d=-1;function u(){l&&r&&(l=!1,r.length?o=r.concat(o):d=-1,o.length&&h())}function h(){if(!l){var e=c(u);l=!0;for(var t=o.length;t;){for(r=o,o=[];++d1)for(var n=1;n{d(!0),h(""),i.hi.get("/api/response-filters").then(t).catch(e=>h(e instanceof Error?e.message:"Failed to load filters")).finally(()=>d(!1))};(0,a.useEffect)(()=>{b()},[]);let N=async e=>{try{await i.hi.patch("/api/response-filters/".concat(e,"/toggle")),b()}catch(e){x(e instanceof Error?e.message:"Failed to toggle")}},w=async e=>{if(confirm("Delete this response filter?"))try{await i.hi.delete("/api/response-filters/".concat(e)),b()}catch(e){x(e instanceof Error?e.message:"Failed to delete")}},k=e=>{if(!e)return y("Pattern is required"),!1;try{return new RegExp(e),y(""),!0}catch(e){return y(e instanceof Error?e.message:"Invalid pattern"),!1}},E=async()=>{if(g.name&&k(g.pattern))try{let e={name:g.name,pattern:g.pattern,action:g.action};g.description&&(e.description=g.description),"redact"===g.action&&g.replacement&&(e.replacement=g.replacement),await i.hi.post("/api/response-filters",e),m(!1),v({name:"",description:"",pattern:"",action:"redact",replacement:"[FILTERED]"}),y(""),b()}catch(e){x(e instanceof Error?e.message:"Failed to create")}};return a.useEffect(()=>{if(f){let e=setTimeout(()=>x(""),3e3);return()=>clearTimeout(e)}},[f]),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Response Filters"}),(0,r.jsx)("p",{className:"page-sub",children:"Block, redact, or flag patterns in model responses"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>m(!0),children:[(0,r.jsx)(s.Z,{size:16})," Add Filter"]})]}),p&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>m(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Response Filter"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name"}),(0,r.jsx)("input",{className:"input",value:g.name,onChange:e=>v(t=>({...t,name:e.target.value})),autoFocus:!0,placeholder:"e.g. Email Redactor"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Description"}),(0,r.jsx)("input",{className:"input",value:g.description,onChange:e=>v(t=>({...t,description:e.target.value})),placeholder:"Optional"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Pattern (regex)"}),(0,r.jsx)("input",{className:"input font-mono",value:g.pattern,onChange:e=>{v(t=>({...t,pattern:e.target.value})),g.pattern&&k(e.target.value)},onBlur:e=>k(e.target.value),placeholder:"\\\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Z|a-z]{2,}\\\\b"}),j&&(0,r.jsx)("p",{className:"text-xs text-red-400 mt-1",children:j}),(0,r.jsx)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:"Case-insensitive, multiline. Errors in the pattern are silently skipped."})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Action"}),(0,r.jsxs)("select",{className:"select",value:g.action,onChange:e=>v(t=>({...t,action:e.target.value})),children:[(0,r.jsx)("option",{value:"redact",children:"Redact — replace matches with replacement text"}),(0,r.jsx)("option",{value:"block",children:"Block — reject the entire response"}),(0,r.jsx)("option",{value:"flag",children:"Flag — log match, keep content"})]})]}),"redact"===g.action&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Replacement"}),(0,r.jsx)("input",{className:"input",value:g.replacement,onChange:e=>v(t=>({...t,replacement:e.target.value})),placeholder:"[FILTERED]"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:E,children:"Create"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>{m(!1),y("")},children:"Cancel"})]})]})]})}),u?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-red-400"}),(0,r.jsx)("p",{className:"text-red-400",children:u})]}):n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No response filters configured. Add one to scrub, block, or flag patterns in model outputs."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Pattern"}),(0,r.jsx)("th",{children:"Action"}),(0,r.jsx)("th",{children:"Replacement"}),(0,r.jsx)("th",{children:"Triggered"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsxs)("td",{className:"font-medium",children:[(0,r.jsx)("div",{children:e.name}),e.description&&(0,r.jsx)("div",{className:"text-xs text-[var(--text-tertiary)] mt-0.5",children:e.description})]}),(0,r.jsx)("td",{children:(0,r.jsx)("code",{className:"text-xs font-mono bg-surface-100 px-2 py-0.5 rounded break-all",children:e.pattern})}),(0,r.jsx)("td",{children:(0,r.jsx)("span",{className:l[e.action]||"badge-gray",children:e.action})}),(0,r.jsx)("td",{className:"text-xs font-mono text-[var(--text-tertiary)]",children:"redact"===e.action?e.replacement||"[FILTERED]":"—"}),(0,r.jsx)("td",{className:"text-xs",children:(e.times_triggered||0).toLocaleString()}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>N(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsx)("button",{onClick:()=>w(e.id),className:"btn-danger btn-xs",children:"\xd7"})})]},e.id))})]})})}),f&&(0,r.jsx)("div",{className:"toast",children:f})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return s},qz:function(){return i}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function i(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function s(){return!!a()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,l=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",s=a(),d={"Content-Type":"application/json",...t.headers};if(s&&(d.Authorization="Bearer ".concat(s)),"GET"===n&&!s){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let u=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw i(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let c=await a.json();return"GET"!==n||s||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===n&&!s){l.set(e,u);try{return await u}finally{l.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>d("/api/auth/me"),logout:()=>{i(),o.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let i=await n.blob(),s=URL.createObjectURL(i),c=document.createElement("a");c.href=s,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1240)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/routing/page-13f7943121037eac.js b/static/_next/static/chunks/app/routing/page-a1893f3089c33e49.js similarity index 65% rename from static/_next/static/chunks/app/routing/page-13f7943121037eac.js rename to static/_next/static/chunks/app/routing/page-a1893f3089c33e49.js index 465444fc44f1de9c4fee59d274a614783600224a..b38d2cf8ccf32a660aa9232600ad981a12e1f732 100644 --- a/static/_next/static/chunks/app/routing/page-13f7943121037eac.js +++ b/static/_next/static/chunks/app/routing/page-a1893f3089c33e49.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3063],{1017:function(e,t,r){Promise.resolve().then(r.bind(r,144))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:u,...h}=e;return(0,n.createElement)("svg",{ref:t,...o,width:i,height:i,stroke:r,strokeWidth:l?24*Number(s)/Number(i):s,className:a("lucide",c),...h},[...u.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let r=(0,n.forwardRef)((r,o)=>{let{className:l,...c}=r;return(0,n.createElement)(s,{ref:o,iconNode:t,className:a("lucide-".concat(i(e)),l),...c})});return r.displayName="".concat(e),r}},3781:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]])},257:function(e,t,r){"use strict";var n,i;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(i=r.g.process)?void 0:i.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,i=e.exports={};function a(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var l=[],c=!1,d=-1;function u(){c&&n&&(c=!1,n.length?l=n.concat(l):d=-1,l.length&&h())}function h(){if(!c){var e=s(u);c=!0;for(var t=l.length;t;){for(n=l,l=[];++d1)for(var r=1;r{s(!0),Promise.all([a.hi.get("/api/routing-rules").catch(()=>[]),a.hi.get("/api/providers").then(e=>p(Object.keys(e)))]).then(e=>{let[r]=e;return t(r)}).finally(()=>s(!1))};(0,i.useEffect)(()=>{x()},[]);let g=async()=>{if(d.model_pattern&&d.target_provider)try{let e={model_pattern:d.model_pattern,target_provider:d.target_provider,priority:d.priority};d.target_model&&(e.target_model=d.target_model),d.description&&(e.description=d.description),await a.hi.post("/api/routing-rules",e),c(!1),u({model_pattern:"",target_provider:"",target_model:"",description:"",priority:0}),x()}catch(e){f(e instanceof Error?e.message:"Failed")}},v=async e=>{confirm("Delete this rule?")&&(await a.hi.delete("/api/routing-rules/".concat(e)),x())},j=async e=>{await a.hi.patch("/api/routing-rules/".concat(e,"/toggle")),x()};return i.useEffect(()=>{if(m){let e=setTimeout(()=>f(""),3e3);return()=>clearTimeout(e)}},[m]),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Routing Rules"}),(0,n.jsx)("p",{className:"page-sub",children:"Control which provider handles which model"})]}),(0,n.jsx)("button",{className:"btn-primary",onClick:()=>c(!0),children:"+ Add Rule"})]}),l&&(0,n.jsx)("div",{className:"modal-overlay",onClick:()=>c(!1),children:(0,n.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Routing Rule"}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Model Pattern (e.g. gpt-4*)"}),(0,n.jsx)("input",{className:"input",value:d.model_pattern,onChange:e=>u(t=>({...t,model_pattern:e.target.value})),placeholder:"gpt-4*",autoFocus:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Target Provider"}),(0,n.jsxs)("select",{className:"select",value:d.target_provider,onChange:e=>u(t=>({...t,target_provider:e.target.value})),children:[(0,n.jsx)("option",{value:"",children:"Select provider"}),h.map(e=>(0,n.jsx)("option",{value:e,children:e},e))]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Target Model (optional, leave empty to use provider default)"}),(0,n.jsx)("input",{className:"input",value:d.target_model,onChange:e=>u(t=>({...t,target_model:e.target.value})),placeholder:"gpt-4o"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Description (optional)"}),(0,n.jsx)("input",{className:"input",value:d.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:"Route GPT-4 to OpenAI"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Priority (higher = checked first)"}),(0,n.jsx)("input",{className:"input",type:"number",value:d.priority,onChange:e=>u(t=>({...t,priority:Number(e.target.value)}))})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:g,children:"Create"}),(0,n.jsx)("button",{className:"btn-ghost",onClick:()=>c(!1),children:"Cancel"})]})]})]})}),r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-24 w-full"})}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No routing rules yet. Model will use default provider routing."})]}):(0,n.jsx)("div",{className:"card p-0",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Model Pattern"}),(0,n.jsx)("th",{children:"Target Provider"}),(0,n.jsx)("th",{children:"Target Model"}),(0,n.jsx)("th",{children:"Description"}),(0,n.jsx)("th",{children:"Priority"}),(0,n.jsx)("th",{children:"Status"}),(0,n.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,n.jsx)("tbody",{children:e.map(e=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{children:(0,n.jsx)("code",{className:"text-xs font-mono bg-surface-100 px-2 py-0.5 rounded",children:e.model_pattern})}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"capitalize",children:e.target_provider})}),(0,n.jsx)("td",{className:"text-xs text-[var(--text-secondary)]",children:e.target_model||"-"}),(0,n.jsx)("td",{className:"text-xs text-[var(--text-tertiary)] max-w-[160px] truncate",children:e.description||"-"}),(0,n.jsx)("td",{children:e.priority}),(0,n.jsx)("td",{children:(0,n.jsx)("button",{onClick:()=>j(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsx)("button",{onClick:()=>v(e.id),className:"btn-danger btn-xs",children:"\xd7"})})]},e.id))})]})})}),m&&(0,n.jsx)("div",{className:"toast",children:m})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return o},qz:function(){return a}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function i(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function o(){return!!i()}let s={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,c=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",o=i(),d={"Content-Type":"application/json",...t.headers};if(o&&(d.Authorization="Bearer ".concat(o)),"GET"===r&&!o){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in s)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return s[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=c.get(e);if(r)return r}let u=(async()=>{let i=await fetch("".concat(n).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&o&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let s=await i.json();return"GET"!==r||o||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,s),s})();if("GET"===r&&!o){c.set(e,u);try{return await u}finally{c.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>d("/api/auth/me"),logout:()=>{a(),l.clear(),window.location.href="/login"}},h=async e=>{let t=i(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let a=await r.blob(),o=URL.createObjectURL(a),s=document.createElement("a");s.href=o,s.download=e.split("/").pop()||"export.csv",s.click(),URL.revokeObjectURL(o)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1017)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3063],{1017:function(e,t,r){Promise.resolve().then(r.bind(r,144))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:c,className:l="",children:d,iconNode:u,...h}=e;return(0,n.createElement)("svg",{ref:t,...o,width:i,height:i,stroke:r,strokeWidth:c?24*Number(s)/Number(i):s,className:a("lucide",l),...h},[...u.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),c=(e,t)=>{let r=(0,n.forwardRef)((r,o)=>{let{className:c,...l}=r;return(0,n.createElement)(s,{ref:o,iconNode:t,className:a("lucide-".concat(i(e)),c),...l})});return r.displayName="".concat(e),r}},3781:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]])},257:function(e,t,r){"use strict";var n,i;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(i=r.g.process)?void 0:i.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,i=e.exports={};function a(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var c=[],l=!1,d=-1;function u(){l&&n&&(l=!1,n.length?c=n.concat(c):d=-1,c.length&&h())}function h(){if(!l){var e=s(u);l=!0;for(var t=c.length;t;){for(n=c,c=[];++d1)for(var r=1;r{s(!0),Promise.all([a.hi.get("/api/routing-rules").catch(()=>[]),a.hi.get("/api/providers").then(e=>p(Object.keys(e)))]).then(e=>{let[r]=e;return t(r)}).finally(()=>s(!1))};(0,i.useEffect)(()=>{x()},[]);let g=async()=>{if(d.model_pattern&&d.target_provider)try{let e={model_pattern:d.model_pattern,target_provider:d.target_provider,priority:d.priority};d.target_model&&(e.target_model=d.target_model),d.description&&(e.description=d.description),await a.hi.post("/api/routing-rules",e),l(!1),u({model_pattern:"",target_provider:"",target_model:"",description:"",priority:0}),x()}catch(e){f(e instanceof Error?e.message:"Failed")}},v=async e=>{confirm("Delete this rule?")&&(await a.hi.delete("/api/routing-rules/".concat(e)),x())},y=async e=>{await a.hi.patch("/api/routing-rules/".concat(e,"/toggle")),x()};return i.useEffect(()=>{if(m){let e=setTimeout(()=>f(""),3e3);return()=>clearTimeout(e)}},[m]),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Routing Rules"}),(0,n.jsx)("p",{className:"page-sub",children:"Control which provider handles which model"})]}),(0,n.jsx)("button",{className:"btn-primary",onClick:()=>l(!0),children:"+ Add Rule"})]}),c&&(0,n.jsx)("div",{className:"modal-overlay",onClick:()=>l(!1),children:(0,n.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Routing Rule"}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Model Pattern (e.g. gpt-4*)"}),(0,n.jsx)("input",{className:"input",value:d.model_pattern,onChange:e=>u(t=>({...t,model_pattern:e.target.value})),placeholder:"gpt-4*",autoFocus:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Target Provider"}),(0,n.jsxs)("select",{className:"select",value:d.target_provider,onChange:e=>u(t=>({...t,target_provider:e.target.value})),children:[(0,n.jsx)("option",{value:"",children:"Select provider"}),h.map(e=>(0,n.jsx)("option",{value:e,children:e},e))]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Target Model (optional, leave empty to use provider default)"}),(0,n.jsx)("input",{className:"input",value:d.target_model,onChange:e=>u(t=>({...t,target_model:e.target.value})),placeholder:"gpt-4o"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Description (optional)"}),(0,n.jsx)("input",{className:"input",value:d.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:"Route GPT-4 to OpenAI"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Priority (higher = checked first)"}),(0,n.jsx)("input",{className:"input",type:"number",value:d.priority,onChange:e=>u(t=>({...t,priority:Number(e.target.value)}))})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:g,children:"Create"}),(0,n.jsx)("button",{className:"btn-ghost",onClick:()=>l(!1),children:"Cancel"})]})]})]})}),r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-24 w-full"})}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No routing rules yet. Model will use default provider routing."})]}):(0,n.jsx)("div",{className:"card p-0",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Model Pattern"}),(0,n.jsx)("th",{children:"Target Provider"}),(0,n.jsx)("th",{children:"Target Model"}),(0,n.jsx)("th",{children:"Description"}),(0,n.jsx)("th",{children:"Priority"}),(0,n.jsx)("th",{children:"Status"}),(0,n.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,n.jsx)("tbody",{children:e.map(e=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{children:(0,n.jsx)("code",{className:"text-xs font-mono bg-surface-100 px-2 py-0.5 rounded",children:e.model_pattern})}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"capitalize",children:e.target_provider})}),(0,n.jsx)("td",{className:"text-xs text-[var(--text-secondary)]",children:e.target_model||"-"}),(0,n.jsx)("td",{className:"text-xs text-[var(--text-tertiary)] max-w-[160px] truncate",children:e.description||"-"}),(0,n.jsx)("td",{children:e.priority}),(0,n.jsx)("td",{children:(0,n.jsx)("button",{onClick:()=>y(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsx)("button",{onClick:()=>v(e.id),className:"btn-danger btn-xs",children:"\xd7"})})]},e.id))})]})})}),m&&(0,n.jsx)("div",{className:"toast",children:m})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return o},qz:function(){return a}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function i(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function a(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function o(){return!!i()}let s={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",o=i(),d={"Content-Type":"application/json",...t.headers};if(o&&(d.Authorization="Bearer ".concat(o)),"GET"===r&&!o){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in s)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return s[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=l.get(e);if(r)return r}let u=(async()=>{let i=await fetch("".concat(n).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&o&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let s=await i.json();return"GET"!==r||o||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,s),s})();if("GET"===r&&!o){l.set(e,u);try{return await u}finally{l.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),function(e,t,r){try{let r="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(r)}catch(e){}}("nexus_token",r,0),n},getMe:()=>d("/api/auth/me"),logout:()=>{a(),c.clear(),window.location.href="/login"}},h=async e=>{let t=i(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let a=await r.blob(),o=URL.createObjectURL(a),s=document.createElement("a");s.href=o,s.download=e.split("/").pop()||"export.csv",s.click(),URL.revokeObjectURL(o)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1017)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/routing/page-e3048c19ed27d4cd.js b/static/_next/static/chunks/app/routing/page-e3048c19ed27d4cd.js deleted file mode 100644 index 465444fc44f1de9c4fee59d274a614783600224a..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/routing/page-e3048c19ed27d4cd.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3063],{1017:function(e,t,r){Promise.resolve().then(r.bind(r,144))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:u,...h}=e;return(0,n.createElement)("svg",{ref:t,...o,width:i,height:i,stroke:r,strokeWidth:l?24*Number(s)/Number(i):s,className:a("lucide",c),...h},[...u.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(d)?d:[d]])}),l=(e,t)=>{let r=(0,n.forwardRef)((r,o)=>{let{className:l,...c}=r;return(0,n.createElement)(s,{ref:o,iconNode:t,className:a("lucide-".concat(i(e)),l),...c})});return r.displayName="".concat(e),r}},3781:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]])},257:function(e,t,r){"use strict";var n,i;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(i=r.g.process)?void 0:i.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,i=e.exports={};function a(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var l=[],c=!1,d=-1;function u(){c&&n&&(c=!1,n.length?l=n.concat(l):d=-1,l.length&&h())}function h(){if(!c){var e=s(u);c=!0;for(var t=l.length;t;){for(n=l,l=[];++d1)for(var r=1;r{s(!0),Promise.all([a.hi.get("/api/routing-rules").catch(()=>[]),a.hi.get("/api/providers").then(e=>p(Object.keys(e)))]).then(e=>{let[r]=e;return t(r)}).finally(()=>s(!1))};(0,i.useEffect)(()=>{x()},[]);let g=async()=>{if(d.model_pattern&&d.target_provider)try{let e={model_pattern:d.model_pattern,target_provider:d.target_provider,priority:d.priority};d.target_model&&(e.target_model=d.target_model),d.description&&(e.description=d.description),await a.hi.post("/api/routing-rules",e),c(!1),u({model_pattern:"",target_provider:"",target_model:"",description:"",priority:0}),x()}catch(e){f(e instanceof Error?e.message:"Failed")}},v=async e=>{confirm("Delete this rule?")&&(await a.hi.delete("/api/routing-rules/".concat(e)),x())},j=async e=>{await a.hi.patch("/api/routing-rules/".concat(e,"/toggle")),x()};return i.useEffect(()=>{if(m){let e=setTimeout(()=>f(""),3e3);return()=>clearTimeout(e)}},[m]),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"page-header",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Routing Rules"}),(0,n.jsx)("p",{className:"page-sub",children:"Control which provider handles which model"})]}),(0,n.jsx)("button",{className:"btn-primary",onClick:()=>c(!0),children:"+ Add Rule"})]}),l&&(0,n.jsx)("div",{className:"modal-overlay",onClick:()=>c(!1),children:(0,n.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Routing Rule"}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Model Pattern (e.g. gpt-4*)"}),(0,n.jsx)("input",{className:"input",value:d.model_pattern,onChange:e=>u(t=>({...t,model_pattern:e.target.value})),placeholder:"gpt-4*",autoFocus:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Target Provider"}),(0,n.jsxs)("select",{className:"select",value:d.target_provider,onChange:e=>u(t=>({...t,target_provider:e.target.value})),children:[(0,n.jsx)("option",{value:"",children:"Select provider"}),h.map(e=>(0,n.jsx)("option",{value:e,children:e},e))]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Target Model (optional, leave empty to use provider default)"}),(0,n.jsx)("input",{className:"input",value:d.target_model,onChange:e=>u(t=>({...t,target_model:e.target.value})),placeholder:"gpt-4o"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Description (optional)"}),(0,n.jsx)("input",{className:"input",value:d.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:"Route GPT-4 to OpenAI"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"label",children:"Priority (higher = checked first)"}),(0,n.jsx)("input",{className:"input",type:"number",value:d.priority,onChange:e=>u(t=>({...t,priority:Number(e.target.value)}))})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:g,children:"Create"}),(0,n.jsx)("button",{className:"btn-ghost",onClick:()=>c(!1),children:"Cancel"})]})]})]})}),r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-24 w-full"})}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No routing rules yet. Model will use default provider routing."})]}):(0,n.jsx)("div",{className:"card p-0",children:(0,n.jsx)("div",{className:"table-wrap",children:(0,n.jsxs)("table",{children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"Model Pattern"}),(0,n.jsx)("th",{children:"Target Provider"}),(0,n.jsx)("th",{children:"Target Model"}),(0,n.jsx)("th",{children:"Description"}),(0,n.jsx)("th",{children:"Priority"}),(0,n.jsx)("th",{children:"Status"}),(0,n.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,n.jsx)("tbody",{children:e.map(e=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{children:(0,n.jsx)("code",{className:"text-xs font-mono bg-surface-100 px-2 py-0.5 rounded",children:e.model_pattern})}),(0,n.jsx)("td",{children:(0,n.jsx)("span",{className:"capitalize",children:e.target_provider})}),(0,n.jsx)("td",{className:"text-xs text-[var(--text-secondary)]",children:e.target_model||"-"}),(0,n.jsx)("td",{className:"text-xs text-[var(--text-tertiary)] max-w-[160px] truncate",children:e.description||"-"}),(0,n.jsx)("td",{children:e.priority}),(0,n.jsx)("td",{children:(0,n.jsx)("button",{onClick:()=>j(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,n.jsx)("td",{className:"text-right",children:(0,n.jsx)("button",{onClick:()=>v(e.id),className:"btn-danger btn-xs",children:"\xd7"})})]},e.id))})]})})}),m&&(0,n.jsx)("div",{className:"toast",children:m})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return u},jl:function(){return o},qz:function(){return a}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function i(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function o(){return!!i()}let s={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},l=new Map,c=new Map;async function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",o=i(),d={"Content-Type":"application/json",...t.headers};if(o&&(d.Authorization="Bearer ".concat(o)),"GET"===r&&!o){let t=function(e){let t=l.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in s)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return s[t];return 5e3}(e)){l.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=c.get(e);if(r)return r}let u=(async()=>{let i=await fetch("".concat(n).concat(e),{method:r,headers:d,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&o&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),l.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let s=await i.json();return"GET"!==r||o||function(e,t){if(l.size>=200){let e=l.keys().next().value;void 0!==e&&l.delete(e)}l.set(e,{ts:Date.now(),data:t})}(e,s),s})();if("GET"===r&&!o){c.set(e,u);try{return await u}finally{c.delete(e)}}return u}let u={get:e=>d(e),post:(e,t)=>d(e,{method:"POST",body:t}),put:(e,t)=>d(e,{method:"PUT",body:t}),patch:(e,t)=>d(e,{method:"PATCH",body:t}),delete:e=>d(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await d("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>d("/api/auth/me"),logout:()=>{a(),l.clear(),window.location.href="/login"}},h=async e=>{let t=i(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let a=await r.blob(),o=URL.createObjectURL(a),s=document.createElement("a");s.href=o,s.download=e.split("/").pop()||"export.csv",s.click(),URL.revokeObjectURL(o)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=1017)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/status/page-0aab24a3e514ce40.js b/static/_next/static/chunks/app/status/page-0aab24a3e514ce40.js new file mode 100644 index 0000000000000000000000000000000000000000..9dc2f91e8620f75d83593075834838bd780027fa --- /dev/null +++ b/static/_next/static/chunks/app/status/page-0aab24a3e514ce40.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5357],{7404:function(e,t,n){Promise.resolve().then(n.bind(n,8730))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let s=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...c,width:i,height:i,stroke:n,strokeWidth:o?24*Number(s)/Number(i):s,className:a("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let n=(0,r.forwardRef)((n,c)=>{let{className:o,...l}=n;return(0,r.createElement)(s,{ref:c,iconNode:t,className:a("lucide-".concat(i(e)),o),...l})});return n.displayName="".concat(e),n}},4401:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},1671:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},9388:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},1723:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},257:function(e,t,n){"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,i=e.exports={};function a(){throw Error("setTimeout has not been defined")}function c(){throw Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{n="function"==typeof clearTimeout?clearTimeout:c}catch(e){n=c}}();var o=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?o=r.concat(o):u=-1,o.length&&h())}function h(){if(!l){var e=s(d);l=!0;for(var t=o.length;t;){for(r=o,o=[];++u1)for(var n=1;n{a.hi.get("/api/uptime").then(t).catch(()=>[]).finally(()=>u(!1))},[]),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"page-header",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Provider Status"}),(0,r.jsx)("p",{className:"page-sub",children:"Health check and uptime monitoring"})]})}),n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(c.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No uptime data yet. Health checks run automatically."})]}):(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:e.map(e=>(0,r.jsxs)("div",{className:"card",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:["healthy"===e.last_status?(0,r.jsx)(s.Z,{size:16,className:"text-green-400"}):"degraded"===e.last_status?(0,r.jsx)(o.Z,{size:16,className:"text-yellow-400"}):(0,r.jsx)(l.Z,{size:16,className:"text-red-400"}),(0,r.jsx)("span",{className:"font-semibold capitalize",children:e.provider})]}),(0,r.jsx)("span",{className:"text-sm font-medium ".concat(null!==e.uptime_pct&&e.uptime_pct>=99?"text-green-400":null!==e.uptime_pct&&e.uptime_pct>=95?"text-yellow-400":"text-red-400"),children:null!==e.uptime_pct?"".concat(e.uptime_pct.toFixed(1),"%"):"N/A"})]}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-4 text-xs",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Status"}),(0,r.jsx)("p",{className:"font-medium mt-0.5 capitalize",children:e.last_status})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Avg Latency"}),(0,r.jsxs)("p",{className:"font-medium mt-0.5",children:[e.avg_latency,"ms"]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Checks"}),(0,r.jsx)("p",{className:"font-medium mt-0.5",children:e.total_checks})]})]}),(0,r.jsxs)("div",{className:"flex gap-3 mt-2 text-xs text-[var(--text-tertiary)]",children:[null!==e.p50&&(0,r.jsxs)("span",{children:["p50: ",e.p50,"ms"]}),null!==e.p95&&(0,r.jsxs)("span",{children:["p95: ",e.p95,"ms"]})]}),e.last_checked&&(0,r.jsxs)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:["Last check: ",e.last_checked]})]},e.provider))})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return c},qz:function(){return a}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function i(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function a(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function c(){return!!i()}let s={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",c=i(),u={"Content-Type":"application/json",...t.headers};if(c&&(u.Authorization="Bearer ".concat(c)),"GET"===n&&!c){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in s)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return s[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let i=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&c&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let s=await i.json();return"GET"!==n||c||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,s),s})();if("GET"===n&&!c){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>u("/api/auth/me"),logout:()=>{a(),o.clear(),window.location.href="/login"}},h=async e=>{let t=i(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let a=await n.blob(),c=URL.createObjectURL(a),s=document.createElement("a");s.href=c,s.download=e.split("/").pop()||"export.csv",s.click(),URL.revokeObjectURL(c)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=7404)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/status/page-1c685d9e2718b0b1.js b/static/_next/static/chunks/app/status/page-1c685d9e2718b0b1.js deleted file mode 100644 index 90de0b0b720f826dc272efd7fb2ff63a668175ce..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/status/page-1c685d9e2718b0b1.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5357],{7404:function(e,t,r){Promise.resolve().then(r.bind(r,8730))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:i=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...s,width:i,height:i,stroke:r,strokeWidth:o?24*Number(c)/Number(i):c,className:a("lucide",l),...h},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:o,...l}=r;return(0,n.createElement)(c,{ref:s,iconNode:t,className:a("lucide-".concat(i(e)),o),...l})});return r.displayName="".concat(e),r}},4401:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},1671:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},9388:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},1723:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},257:function(e,t,r){"use strict";var n,i;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(i=r.g.process)?void 0:i.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,i=e.exports={};function a(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var o=[],l=!1,u=-1;function d(){l&&n&&(l=!1,n.length?o=n.concat(o):u=-1,o.length&&h())}function h(){if(!l){var e=c(d);l=!0;for(var t=o.length;t;){for(n=o,o=[];++u1)for(var r=1;r{a.hi.get("/api/uptime").then(t).catch(()=>[]).finally(()=>u(!1))},[]),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Provider Status"}),(0,n.jsx)("p",{className:"page-sub",children:"Health check and uptime monitoring"})]})}),r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(s.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No uptime data yet. Health checks run automatically."})]}):(0,n.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:e.map(e=>(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:["healthy"===e.last_status?(0,n.jsx)(c.Z,{size:16,className:"text-green-400"}):"degraded"===e.last_status?(0,n.jsx)(o.Z,{size:16,className:"text-yellow-400"}):(0,n.jsx)(l.Z,{size:16,className:"text-red-400"}),(0,n.jsx)("span",{className:"font-semibold capitalize",children:e.provider})]}),(0,n.jsx)("span",{className:"text-sm font-medium ".concat(null!==e.uptime_pct&&e.uptime_pct>=99?"text-green-400":null!==e.uptime_pct&&e.uptime_pct>=95?"text-yellow-400":"text-red-400"),children:null!==e.uptime_pct?"".concat(e.uptime_pct.toFixed(1),"%"):"N/A"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-4 text-xs",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Status"}),(0,n.jsx)("p",{className:"font-medium mt-0.5 capitalize",children:e.last_status})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Avg Latency"}),(0,n.jsxs)("p",{className:"font-medium mt-0.5",children:[e.avg_latency,"ms"]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Checks"}),(0,n.jsx)("p",{className:"font-medium mt-0.5",children:e.total_checks})]})]}),(0,n.jsxs)("div",{className:"flex gap-3 mt-2 text-xs text-[var(--text-tertiary)]",children:[null!==e.p50&&(0,n.jsxs)("span",{children:["p50: ",e.p50,"ms"]}),null!==e.p95&&(0,n.jsxs)("span",{children:["p95: ",e.p95,"ms"]})]}),e.last_checked&&(0,n.jsxs)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:["Last check: ",e.last_checked]})]},e.provider))})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return s},qz:function(){return a}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function i(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function s(){return!!i()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",s=i(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===r&&!s){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=l.get(e);if(r)return r}let d=(async()=>{let i=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let c=await i.json();return"GET"!==r||s||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===r&&!s){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{a(),o.clear(),window.location.href="/login"}},h=async e=>{let t=i(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let a=await r.blob(),s=URL.createObjectURL(a),c=document.createElement("a");c.href=s,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=7404)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/status/page-733f1881c490f8af.js b/static/_next/static/chunks/app/status/page-733f1881c490f8af.js deleted file mode 100644 index 90de0b0b720f826dc272efd7fb2ff63a668175ce..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/status/page-733f1881c490f8af.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5357],{7404:function(e,t,r){Promise.resolve().then(r.bind(r,8730))},9205:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&r.indexOf(e)===t).join(" ")};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:i=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:d,...h}=e;return(0,n.createElement)("svg",{ref:t,...s,width:i,height:i,stroke:r,strokeWidth:o?24*Number(c)/Number(i):c,className:a("lucide",l),...h},[...d.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),o=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:o,...l}=r;return(0,n.createElement)(c,{ref:s,iconNode:t,className:a("lucide-".concat(i(e)),o),...l})});return r.displayName="".concat(e),r}},4401:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},1671:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},9388:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},1723:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(9205).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},257:function(e,t,r){"use strict";var n,i;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(i=r.g.process)?void 0:i.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,i=e.exports={};function a(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===a||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:a}catch(e){t=a}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var o=[],l=!1,u=-1;function d(){l&&n&&(l=!1,n.length?o=n.concat(o):u=-1,o.length&&h())}function h(){if(!l){var e=c(d);l=!0;for(var t=o.length;t;){for(n=o,o=[];++u1)for(var r=1;r{a.hi.get("/api/uptime").then(t).catch(()=>[]).finally(()=>u(!1))},[]),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"page-header",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"page-title",children:"Provider Status"}),(0,n.jsx)("p",{className:"page-sub",children:"Health check and uptime monitoring"})]})}),r?(0,n.jsx)("div",{className:"card",children:(0,n.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,n.jsxs)("div",{className:"card text-center py-12",children:[(0,n.jsx)(s.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,n.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No uptime data yet. Health checks run automatically."})]}):(0,n.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:e.map(e=>(0,n.jsxs)("div",{className:"card",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:["healthy"===e.last_status?(0,n.jsx)(c.Z,{size:16,className:"text-green-400"}):"degraded"===e.last_status?(0,n.jsx)(o.Z,{size:16,className:"text-yellow-400"}):(0,n.jsx)(l.Z,{size:16,className:"text-red-400"}),(0,n.jsx)("span",{className:"font-semibold capitalize",children:e.provider})]}),(0,n.jsx)("span",{className:"text-sm font-medium ".concat(null!==e.uptime_pct&&e.uptime_pct>=99?"text-green-400":null!==e.uptime_pct&&e.uptime_pct>=95?"text-yellow-400":"text-red-400"),children:null!==e.uptime_pct?"".concat(e.uptime_pct.toFixed(1),"%"):"N/A"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-3 gap-4 text-xs",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Status"}),(0,n.jsx)("p",{className:"font-medium mt-0.5 capitalize",children:e.last_status})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Avg Latency"}),(0,n.jsxs)("p",{className:"font-medium mt-0.5",children:[e.avg_latency,"ms"]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[var(--text-tertiary)]",children:"Checks"}),(0,n.jsx)("p",{className:"font-medium mt-0.5",children:e.total_checks})]})]}),(0,n.jsxs)("div",{className:"flex gap-3 mt-2 text-xs text-[var(--text-tertiary)]",children:[null!==e.p50&&(0,n.jsxs)("span",{children:["p50: ",e.p50,"ms"]}),null!==e.p95&&(0,n.jsxs)("span",{children:["p95: ",e.p95,"ms"]})]}),e.last_checked&&(0,n.jsxs)("p",{className:"text-xs text-[var(--text-tertiary)] mt-1",children:["Last check: ",e.last_checked]})]},e.provider))})]})}},1837:function(e,t,r){"use strict";r.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return s},qz:function(){return a}});let n=r(257).env.NEXT_PUBLIC_API_BASE||"";function i(){return localStorage.getItem("nexus_token")}function a(){localStorage.removeItem("nexus_token")}function s(){return!!i()}let c={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},o=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.method||"GET",s=i(),u={"Content-Type":"application/json",...t.headers};if(s&&(u.Authorization="Bearer ".concat(s)),"GET"===r&&!s){let t=function(e){let t=o.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in c)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return c[t];return 5e3}(e)){o.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let r=l.get(e);if(r)return r}let d=(async()=>{let i=await fetch("".concat(n).concat(e),{method:r,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return i;if(401===i.status&&s&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw a(),o.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!i.ok)throw Error((await i.json().catch(()=>({detail:i.statusText}))).detail||"HTTP ".concat(i.status));if(204===i.status)return;let c=await i.json();return"GET"!==r||s||function(e,t){if(o.size>=200){let e=o.keys().next().value;void 0!==e&&o.delete(e)}o.set(e,{ts:Date.now(),data:t})}(e,c),c})();if("GET"===r&&!s){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var r;let n=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return r=n.access_token,localStorage.setItem("nexus_token",r),n},getMe:()=>u("/api/auth/me"),logout:()=>{a(),o.clear(),window.location.href="/login"}},h=async e=>{let t=i(),r=await fetch("".concat(n).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!r.ok)throw Error("Failed to download");let a=await r.blob(),s=URL.createObjectURL(a),c=document.createElement("a");c.href=s,c.download=e.split("/").pop()||"export.csv",c.click(),URL.revokeObjectURL(s)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=7404)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/webhooks/page-7263cc91bec82376.js b/static/_next/static/chunks/app/webhooks/page-7263cc91bec82376.js deleted file mode 100644 index e218b10794cfd4abcfce5f3a473766c03ee5d664..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/app/webhooks/page-7263cc91bec82376.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1297],{3191:function(e,t,n){Promise.resolve().then(n.bind(n,2397))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:n,strokeWidth:c?24*Number(o)/Number(a):o,className:s("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,i)=>{let{className:c,...l}=n;return(0,r.createElement)(o,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),c),...l})});return n.displayName="".concat(e),n}},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},4743:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},3628:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var c=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?c=r.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(r=c,c=[];++u1)for(var n=1;n{u(!0),s.hi.get("/api/webhooks").then(t).finally(()=>u(!1))};(0,a.useEffect)(()=>{v()},[]),a.useEffect(()=>{if(p){let e=setTimeout(()=>x(""),3e3);return()=>clearTimeout(e)}},[p]);let g=async()=>{if(f.name.trim()&&f.url.trim())try{let e={name:f.name,url:f.url};f.events&&(e.events=f.events),f.secret&&(e.secret=f.secret),await s.hi.post("/api/webhooks",e),h(!1),m({name:"",url:"",events:"",secret:""}),v(),x("Webhook created")}catch(e){x(e instanceof Error?e.message:"Failed to create")}},j=async e=>{await s.hi.patch("/api/webhooks/".concat(e,"/toggle")),v()},y=async e=>{confirm("Delete this webhook?")&&(await s.hi.delete("/api/webhooks/".concat(e)),v(),x("Webhook deleted"))},b=async e=>{try{let t=await s.hi.post("/api/webhooks/".concat(e,"/test"));x(t.message)}catch(e){x(e instanceof Error?e.message:"Test failed")}};return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Webhooks"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage outgoing webhook notifications"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>h(!0),children:[(0,r.jsx)(i.Z,{size:16})," Create Webhook"]})]}),d&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>h(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Webhook"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name"}),(0,r.jsx)("input",{className:"input",value:f.name,onChange:e=>m(t=>({...t,name:e.target.value})),placeholder:"My Webhook",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"URL"}),(0,r.jsx)("input",{className:"input",value:f.url,onChange:e=>m(t=>({...t,url:e.target.value})),placeholder:"https://..."})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Events (comma-separated)"}),(0,r.jsx)("input",{className:"input",value:f.events,onChange:e=>m(t=>({...t,events:e.target.value})),placeholder:"request.completed, error"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Secret (optional)"}),(0,r.jsx)("input",{className:"input",value:f.secret,onChange:e=>m(t=>({...t,secret:e.target.value})),placeholder:"shared-secret"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:g,children:"Create"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>h(!1),children:"Cancel"})]})]})]})}),n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No webhooks configured. Create one to get started."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"URL"}),(0,r.jsx)("th",{children:"Events"}),(0,r.jsx)("th",{children:"Fired"}),(0,r.jsx)("th",{children:"Last Triggered"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium",children:e.name}),(0,r.jsx)("td",{className:"text-xs max-w-[200px] truncate font-mono",title:e.url,children:e.url}),(0,r.jsx)("td",{className:"text-xs max-w-[120px] truncate",title:e.events,children:e.events||"-"}),(0,r.jsx)("td",{className:"text-xs",children:e.total_fired}),(0,r.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:e.last_triggered||"Never"}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>j(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsxs)("div",{className:"flex gap-1 justify-end",children:[(0,r.jsx)("button",{onClick:()=>b(e.id),className:"btn-ghost btn-xs",title:"Send test",children:(0,r.jsx)(c.Z,{size:14})}),(0,r.jsx)("button",{onClick:()=>y(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(l.Z,{size:14})})]})})]},e.id))})]})})}),p&&(0,r.jsx)("div",{className:"toast",children:p})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=a(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==n||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===n&&!i){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>u("/api/auth/me"),logout:()=>{s(),c.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let s=await n.blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3191)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/app/webhooks/page-65e3822bce75043c.js b/static/_next/static/chunks/app/webhooks/page-861afa5d4827bc08.js similarity index 75% rename from static/_next/static/chunks/app/webhooks/page-65e3822bce75043c.js rename to static/_next/static/chunks/app/webhooks/page-861afa5d4827bc08.js index e218b10794cfd4abcfce5f3a473766c03ee5d664..cf843588e7d1218d67d6812265f0f5f2686c5793 100644 --- a/static/_next/static/chunks/app/webhooks/page-65e3822bce75043c.js +++ b/static/_next/static/chunks/app/webhooks/page-861afa5d4827bc08.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1297],{3191:function(e,t,n){Promise.resolve().then(n.bind(n,2397))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:n,strokeWidth:c?24*Number(o)/Number(a):o,className:s("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,i)=>{let{className:c,...l}=n;return(0,r.createElement)(o,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),c),...l})});return n.displayName="".concat(e),n}},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},4743:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},3628:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var c=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?c=r.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(r=c,c=[];++u1)for(var n=1;n{u(!0),s.hi.get("/api/webhooks").then(t).finally(()=>u(!1))};(0,a.useEffect)(()=>{v()},[]),a.useEffect(()=>{if(p){let e=setTimeout(()=>x(""),3e3);return()=>clearTimeout(e)}},[p]);let g=async()=>{if(f.name.trim()&&f.url.trim())try{let e={name:f.name,url:f.url};f.events&&(e.events=f.events),f.secret&&(e.secret=f.secret),await s.hi.post("/api/webhooks",e),h(!1),m({name:"",url:"",events:"",secret:""}),v(),x("Webhook created")}catch(e){x(e instanceof Error?e.message:"Failed to create")}},j=async e=>{await s.hi.patch("/api/webhooks/".concat(e,"/toggle")),v()},y=async e=>{confirm("Delete this webhook?")&&(await s.hi.delete("/api/webhooks/".concat(e)),v(),x("Webhook deleted"))},b=async e=>{try{let t=await s.hi.post("/api/webhooks/".concat(e,"/test"));x(t.message)}catch(e){x(e instanceof Error?e.message:"Test failed")}};return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Webhooks"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage outgoing webhook notifications"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>h(!0),children:[(0,r.jsx)(i.Z,{size:16})," Create Webhook"]})]}),d&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>h(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Webhook"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name"}),(0,r.jsx)("input",{className:"input",value:f.name,onChange:e=>m(t=>({...t,name:e.target.value})),placeholder:"My Webhook",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"URL"}),(0,r.jsx)("input",{className:"input",value:f.url,onChange:e=>m(t=>({...t,url:e.target.value})),placeholder:"https://..."})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Events (comma-separated)"}),(0,r.jsx)("input",{className:"input",value:f.events,onChange:e=>m(t=>({...t,events:e.target.value})),placeholder:"request.completed, error"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Secret (optional)"}),(0,r.jsx)("input",{className:"input",value:f.secret,onChange:e=>m(t=>({...t,secret:e.target.value})),placeholder:"shared-secret"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:g,children:"Create"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>h(!1),children:"Cancel"})]})]})]})}),n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No webhooks configured. Create one to get started."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"URL"}),(0,r.jsx)("th",{children:"Events"}),(0,r.jsx)("th",{children:"Fired"}),(0,r.jsx)("th",{children:"Last Triggered"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium",children:e.name}),(0,r.jsx)("td",{className:"text-xs max-w-[200px] truncate font-mono",title:e.url,children:e.url}),(0,r.jsx)("td",{className:"text-xs max-w-[120px] truncate",title:e.events,children:e.events||"-"}),(0,r.jsx)("td",{className:"text-xs",children:e.total_fired}),(0,r.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:e.last_triggered||"Never"}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>j(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsxs)("div",{className:"flex gap-1 justify-end",children:[(0,r.jsx)("button",{onClick:()=>b(e.id),className:"btn-ghost btn-xs",title:"Send test",children:(0,r.jsx)(c.Z,{size:14})}),(0,r.jsx)("button",{onClick:()=>y(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(l.Z,{size:14})})]})})]},e.id))})]})})}),p&&(0,r.jsx)("div",{className:"toast",children:p})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){return localStorage.getItem("nexus_token")}function s(){localStorage.removeItem("nexus_token")}function i(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=a(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==n||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===n&&!i){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),r},getMe:()=>u("/api/auth/me"),logout:()=>{s(),c.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let s=await n.blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3191)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1297],{3191:function(e,t,n){Promise.resolve().then(n.bind(n,2397))},9205:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(2265);let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=function(){for(var e=arguments.length,t=Array(e),n=0;n!!e&&n.indexOf(e)===t).join(" ")};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:a=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:l="",children:u,iconNode:d,...h}=e;return(0,r.createElement)("svg",{ref:t,...i,width:a,height:a,stroke:n,strokeWidth:c?24*Number(o)/Number(a):o,className:s("lucide",l),...h},[...d.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(u)?u:[u]])}),c=(e,t)=>{let n=(0,r.forwardRef)((n,i)=>{let{className:c,...l}=n;return(0,r.createElement)(o,{ref:i,iconNode:t,className:s("lucide-".concat(a(e)),c),...l})});return n.displayName="".concat(e),n}},9397:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},4743:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},8930:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},3628:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(9205).Z)("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]])},257:function(e,t,n){"use strict";var r,a;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(a=n.g.process)?void 0:a.env)?n.g.process:n(4227)},4227:function(e){!function(){var t={229:function(e){var t,n,r,a=e.exports={};function s(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var c=[],l=!1,u=-1;function d(){l&&r&&(l=!1,r.length?c=r.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(r=c,c=[];++u1)for(var n=1;n{u(!0),s.hi.get("/api/webhooks").then(t).finally(()=>u(!1))};(0,a.useEffect)(()=>{v()},[]),a.useEffect(()=>{if(p){let e=setTimeout(()=>x(""),3e3);return()=>clearTimeout(e)}},[p]);let g=async()=>{if(f.name.trim()&&f.url.trim())try{let e={name:f.name,url:f.url};f.events&&(e.events=f.events),f.secret&&(e.secret=f.secret),await s.hi.post("/api/webhooks",e),h(!1),m({name:"",url:"",events:"",secret:""}),v(),x("Webhook created")}catch(e){x(e instanceof Error?e.message:"Failed to create")}},y=async e=>{await s.hi.patch("/api/webhooks/".concat(e,"/toggle")),v()},j=async e=>{confirm("Delete this webhook?")&&(await s.hi.delete("/api/webhooks/".concat(e)),v(),x("Webhook deleted"))},b=async e=>{try{let t=await s.hi.post("/api/webhooks/".concat(e,"/test"));x(t.message)}catch(e){x(e instanceof Error?e.message:"Test failed")}};return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"page-header",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"page-title",children:"Webhooks"}),(0,r.jsx)("p",{className:"page-sub",children:"Manage outgoing webhook notifications"})]}),(0,r.jsxs)("button",{className:"btn-primary",onClick:()=>h(!0),children:[(0,r.jsx)(i.Z,{size:16})," Create Webhook"]})]}),d&&(0,r.jsx)("div",{className:"modal-overlay",onClick:()=>h(!1),children:(0,r.jsxs)("div",{className:"modal",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("h2",{className:"text-lg font-semibold mb-4",children:"New Webhook"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Name"}),(0,r.jsx)("input",{className:"input",value:f.name,onChange:e=>m(t=>({...t,name:e.target.value})),placeholder:"My Webhook",autoFocus:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"URL"}),(0,r.jsx)("input",{className:"input",value:f.url,onChange:e=>m(t=>({...t,url:e.target.value})),placeholder:"https://..."})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Events (comma-separated)"}),(0,r.jsx)("input",{className:"input",value:f.events,onChange:e=>m(t=>({...t,events:e.target.value})),placeholder:"request.completed, error"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"label",children:"Secret (optional)"}),(0,r.jsx)("input",{className:"input",value:f.secret,onChange:e=>m(t=>({...t,secret:e.target.value})),placeholder:"shared-secret"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"btn-primary flex-1 justify-center",onClick:g,children:"Create"}),(0,r.jsx)("button",{className:"btn-ghost",onClick:()=>h(!1),children:"Cancel"})]})]})]})}),n?(0,r.jsx)("div",{className:"card",children:(0,r.jsx)("div",{className:"skeleton h-32 w-full"})}):0===e.length?(0,r.jsxs)("div",{className:"card text-center py-12",children:[(0,r.jsx)(o.Z,{size:32,className:"mx-auto mb-3 text-[var(--text-tertiary)]"}),(0,r.jsx)("p",{className:"text-[var(--text-secondary)]",children:"No webhooks configured. Create one to get started."})]}):(0,r.jsx)("div",{className:"card p-0",children:(0,r.jsx)("div",{className:"table-wrap",children:(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"URL"}),(0,r.jsx)("th",{children:"Events"}),(0,r.jsx)("th",{children:"Fired"}),(0,r.jsx)("th",{children:"Last Triggered"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{className:"text-right",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{className:"font-medium",children:e.name}),(0,r.jsx)("td",{className:"text-xs max-w-[200px] truncate font-mono",title:e.url,children:e.url}),(0,r.jsx)("td",{className:"text-xs max-w-[120px] truncate",title:e.events,children:e.events||"-"}),(0,r.jsx)("td",{className:"text-xs",children:e.total_fired}),(0,r.jsx)("td",{className:"text-xs text-[var(--text-tertiary)]",children:e.last_triggered||"Never"}),(0,r.jsx)("td",{children:(0,r.jsx)("button",{onClick:()=>y(e.id),className:e.is_active?"badge-green cursor-pointer":"badge-red cursor-pointer",children:e.is_active?"Active":"Disabled"})}),(0,r.jsx)("td",{className:"text-right",children:(0,r.jsxs)("div",{className:"flex gap-1 justify-end",children:[(0,r.jsx)("button",{onClick:()=>b(e.id),className:"btn-ghost btn-xs",title:"Send test",children:(0,r.jsx)(c.Z,{size:14})}),(0,r.jsx)("button",{onClick:()=>j(e.id),className:"btn-danger btn-xs",children:(0,r.jsx)(l.Z,{size:14})})]})})]},e.id))})]})})}),p&&(0,r.jsx)("div",{className:"toast",children:p})]})}},1837:function(e,t,n){"use strict";n.d(t,{KF:function(){return h},hi:function(){return d},jl:function(){return i},qz:function(){return s}});let r=n(257).env.NEXT_PUBLIC_API_BASE||"";function a(){let e=localStorage.getItem("nexus_token");if(e)return e;try{let e=document.cookie.match(/(?:^|;\s*)nexus_token=([^;]*)/);if(e)return decodeURIComponent(e[1])}catch(e){}return null}function s(){localStorage.removeItem("nexus_token"),function(e){try{document.cookie="".concat(e,"=;path=/;max-age=0")}catch(e){}}("nexus_token")}function i(){return!!a()}let o={"/api/stats":5e3,"/api/catalog":3e4,"/api/pricing":6e4},c=new Map,l=new Map;async function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.method||"GET",i=a(),u={"Content-Type":"application/json",...t.headers};if(i&&(u.Authorization="Bearer ".concat(i)),"GET"===n&&!i){let t=function(e){let t=c.get(e);if(t){if(Date.now()-t.ts>function(e){for(let t in o)if(e===t||e.startsWith(t+"/")||e.startsWith(t+"?"))return o[t];return 5e3}(e)){c.delete(e);return}return t.data}}(e);if(void 0!==t)return t;let n=l.get(e);if(n)return n}let d=(async()=>{let a=await fetch("".concat(r).concat(e),{method:n,headers:u,body:t.body?JSON.stringify(t.body):void 0});if(t.raw)return a;if(401===a.status&&i&&"/api/auth/login"!==e&&"/api/auth/me"!==e)throw s(),c.clear(),"/login"!==window.location.pathname&&(window.location.href="/login?expired=1"),Error("Session expired. Please sign in again.");if(!a.ok)throw Error((await a.json().catch(()=>({detail:a.statusText}))).detail||"HTTP ".concat(a.status));if(204===a.status)return;let o=await a.json();return"GET"!==n||i||function(e,t){if(c.size>=200){let e=c.keys().next().value;void 0!==e&&c.delete(e)}c.set(e,{ts:Date.now(),data:t})}(e,o),o})();if("GET"===n&&!i){l.set(e,d);try{return await d}finally{l.delete(e)}}return d}let d={get:e=>u(e),post:(e,t)=>u(e,{method:"POST",body:t}),put:(e,t)=>u(e,{method:"PUT",body:t}),patch:(e,t)=>u(e,{method:"PATCH",body:t}),delete:e=>u(e,{method:"DELETE"}),login:async(e,t)=>{var n;let r=await u("/api/auth/login",{method:"POST",body:{username:e,password:t}});return n=r.access_token,localStorage.setItem("nexus_token",n),function(e,t,n){try{let n="https:"===window.location.protocol?";Secure":"";document.cookie="".concat(e,"=").concat(encodeURIComponent(t),";path=/;max-age=").concat(604800,";SameSite=Lax").concat(n)}catch(e){}}("nexus_token",n,0),r},getMe:()=>u("/api/auth/me"),logout:()=>{s(),c.clear(),window.location.href="/login"}},h=async e=>{let t=a(),n=await fetch("".concat(r).concat(e),{headers:t?{Authorization:"Bearer ".concat(t)}:{}});if(!n.ok)throw Error("Failed to download");let s=await n.blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=e.split("/").pop()||"export.csv",o.click(),URL.revokeObjectURL(i)}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=3191)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/static/_next/static/chunks/fd9d1056-be0ef5eef73f67a4.js b/static/_next/static/chunks/fd9d1056-be0ef5eef73f67a4.js deleted file mode 100644 index 2db7923ae112080c3d3a73efb3115d8340217e51..0000000000000000000000000000000000000000 --- a/static/_next/static/chunks/fd9d1056-be0ef5eef73f67a4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2971],{4417:function(e,t,n){var r,l=n(2265),a=n(1767),o={usingClientEntryPoint:!1,Events:null,Dispatcher:{current:null}};function i(e){var t="https://react.dev/errors/"+e;if(1p||(e.current=d[p],d[p]=null,p--)}function g(e,t){d[++p]=e.current,e.current=t}var y=Symbol.for("react.element"),v=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),S=Symbol.for("react.provider"),C=Symbol.for("react.consumer"),E=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),L=Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var T=Symbol.for("react.offscreen"),F=Symbol.for("react.legacy_hidden"),M=Symbol.for("react.cache");Symbol.for("react.tracing_marker");var O=Symbol.iterator;function R(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=O&&e[O]||e["@@iterator"])?e:null}var D=m(null),A=m(null),I=m(null),U=m(null),B={$$typeof:E,_currentValue:null,_currentValue2:null,_threadCount:0,Provider:null,Consumer:null};function V(e,t){switch(g(I,t),g(A,e),g(D,null),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)&&(t=t.namespaceURI)?s2(t):0;break;default:if(t=(e=8===e?t.parentNode:t).tagName,e=e.namespaceURI)t=s3(e=s2(e),t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}h(D),g(D,t)}function Q(){h(D),h(A),h(I)}function $(e){null!==e.memoizedState&&g(U,e);var t=D.current,n=s3(t,e.type);t!==n&&(g(A,e),g(D,n))}function j(e){A.current===e&&(h(D),h(A)),U.current===e&&(h(U),B._currentValue=null)}var W=a.unstable_scheduleCallback,H=a.unstable_cancelCallback,q=a.unstable_shouldYield,K=a.unstable_requestPaint,Y=a.unstable_now,X=a.unstable_getCurrentPriorityLevel,G=a.unstable_ImmediatePriority,Z=a.unstable_UserBlockingPriority,J=a.unstable_NormalPriority,ee=a.unstable_LowPriority,et=a.unstable_IdlePriority,en=a.log,er=a.unstable_setDisableYieldValue,el=null,ea=null;function eo(e){if("function"==typeof en&&er(e),ea&&"function"==typeof ea.setStrictMode)try{ea.setStrictMode(el,e)}catch(e){}}var ei=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(eu(e)/es|0)|0},eu=Math.log,es=Math.LN2,ec=128,ef=4194304;function ed(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194176&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ep(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,l=e.suspendedLanes;e=e.pingedLanes;var a=134217727&n;return 0!==a?0!=(n=a&~l)?r=ed(n):0!=(e&=a)&&(r=ed(e)):0!=(n&=~l)?r=ed(n):0!==e&&(r=ed(e)),0===r?0:0!==t&&t!==r&&0==(t&l)&&((l=r&-r)>=(e=t&-t)||32===l&&0!=(4194176&e))?t:r}function em(e,t){return e.errorRecoveryDisabledLanes&t?0:0!=(e=-536870913&e.pendingLanes)?e:536870912&e?536870912:0}function eh(){var e=ec;return 0==(4194176&(ec<<=1))&&(ec=128),e}function eg(){var e=ef;return 0==(62914560&(ef<<=1))&&(ef=4194304),e}function ey(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ev(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-ei(t);e.entangledLanes|=t,e.entanglements[r]=1073741824|e.entanglements[r]|4194218&n}function eb(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ei(n),l=1<l||u[r]!==s[l]){var c="\n"+u[r].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=r&&0<=l);break}}}finally{eG=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?eX(n):""}function eJ(e){try{var t="";do t+=function(e){switch(e.tag){case 26:case 27:case 5:return eX(e.type);case 16:return eX("Lazy");case 13:return eX("Suspense");case 19:return eX("SuspenseList");case 0:case 2:case 15:return e=eZ(e.type,!1);case 11:return e=eZ(e.type.render,!1);case 1:return e=eZ(e.type,!0);default:return""}}(e),e=e.return;while(e);return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}var e0=Symbol.for("react.client.reference");function e1(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function e2(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function e3(e){e._valueTracker||(e._valueTracker=function(e){var t=e2(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var l=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(e){r=""+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function e4(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=e2(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function e6(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}var e8=/[\n"\\]/g;function e5(e){return e.replace(e8,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function e7(e,t,n,r,l,a,o,i){e.name="",null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o?e.type=o:e.removeAttribute("type"),null!=t?"number"===o?(0===t&&""===e.value||e.value!=t)&&(e.value=""+e1(t)):e.value!==""+e1(t)&&(e.value=""+e1(t)):"submit"!==o&&"reset"!==o||e.removeAttribute("value"),null!=t?te(e,o,e1(t)):null!=n?te(e,o,e1(n)):null!=r&&e.removeAttribute("value"),null==l&&null!=a&&(e.defaultChecked=!!a),null!=l&&(e.checked=l&&"function"!=typeof l&&"symbol"!=typeof l),null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i?e.name=""+e1(i):e.removeAttribute("name")}function e9(e,t,n,r,l,a,o,i){if(null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a&&(e.type=a),null!=t||null!=n){if(!("submit"!==a&&"reset"!==a||null!=t))return;n=null!=n?""+e1(n):"",t=null!=t?""+e1(t):n,i||t===e.value||(e.value=t),e.defaultValue=t}r="function"!=typeof(r=null!=r?r:l)&&"symbol"!=typeof r&&!!r,e.checked=i?e.checked:!!r,e.defaultChecked=!!r,null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o&&(e.name=o)}function te(e,t,n){"number"===t&&e6(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}var tt=Array.isArray;function tn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=iX.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}}var to=ta;"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(to=function(e,t){return MSApp.execUnsafeLocalFunction(function(){return ta(e,t)})});var ti=to;function tu(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType){n.nodeValue=t;return}}e.textContent=t}var ts=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function tc(e,t,n){var r=0===t.indexOf("--");null==n||"boolean"==typeof n||""===n?r?e.setProperty(t,""):"float"===t?e.cssFloat="":e[t]="":r?e.setProperty(t,n):"number"!=typeof n||0===n||ts.has(t)?"float"===t?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function tf(e,t,n){if(null!=t&&"object"!=typeof t)throw Error(i(62));if(e=e.style,null!=n){for(var r in n)!n.hasOwnProperty(r)||null!=t&&t.hasOwnProperty(r)||(0===r.indexOf("--")?e.setProperty(r,""):"float"===r?e.cssFloat="":e[r]="");for(var l in t)r=t[l],t.hasOwnProperty(l)&&n[l]!==r&&tc(e,l,r)}else for(var a in t)t.hasOwnProperty(a)&&tc(e,a,t[a])}function td(e){if(-1===e.indexOf("-"))return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var tp=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),tm=null;function th(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var tg=null,ty=null;function tv(e){var t=eO(e);if(t&&(e=t.stateNode)){var n=eD(e);switch(e=t.stateNode,t.type){case"input":if(e7(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+e5(""+t)+'"][type="radio"]'),t=0;t>=o,l-=o,tj=1<<32-ei(t)+l|n<h?(g=f,f=null):g=f.sibling;var y=p(l,f,i[h],u);if(null===y){null===f&&(f=g);break}e&&f&&null===y.alternate&&t(l,f),o=a(y,o,h),null===c?s=y:c.sibling=y,c=y,f=g}if(h===i.length)return n(l,f),tZ&&tH(l,h),s;if(null===f){for(;hg?(y=h,h=null):y=h.sibling;var b=p(l,h,v.value,s);if(null===b){null===h&&(h=y);break}e&&h&&null===b.alternate&&t(l,h),o=a(b,o,g),null===f?c=b:f.sibling=b,f=b,h=y}if(v.done)return n(l,h),tZ&&tH(l,g),c;if(null===h){for(;!v.done;g++,v=u.next())null!==(v=d(l,v.value,s))&&(o=a(v,o,g),null===f?c=v:f.sibling=v,f=v);return tZ&&tH(l,g),c}for(h=r(l,h);!v.done;g++,v=u.next())null!==(v=m(h,l,g,v.value,s))&&(e&&null!==v.alternate&&h.delete(null===v.key?g:v.key),o=a(v,o,g),null===f?c=v:f.sibling=v,f=v);return e&&h.forEach(function(e){return t(l,e)}),tZ&&tH(l,g),c}(s,c,f,h);if("function"==typeof f.then)return u(s,c,nJ(f),h);if(f.$$typeof===E)return u(s,c,ai(s,f,h),h);n1(s,f)}return"string"==typeof f&&""!==f||"number"==typeof f?(f=""+f,null!==c&&6===c.tag?(n(s,c.sibling),(c=l(c,f)).return=s):(n(s,c),(c=i_(f,s.mode,h)).return=s),o(s=c)):n(s,c)}(u,s,c,f),nG=null,u}}var n4=n3(!0),n6=n3(!1),n8=m(null),n5=m(0);function n7(e,t){g(n5,e=oz),g(n8,t),oz=e|t.baseLanes}function n9(){g(n5,oz),g(n8,n8.current)}function re(){oz=n5.current,h(n8),h(n5)}var rt=m(null),rn=null;function rr(e){var t=e.alternate;g(ri,1&ri.current),g(rt,e),null===rn&&(null===t||null!==n8.current?rn=e:null!==t.memoizedState&&(rn=e))}function rl(e){if(22===e.tag){if(g(ri,ri.current),g(rt,e),null===rn){var t=e.alternate;null!==t&&null!==t.memoizedState&&(rn=e)}}else ra(e)}function ra(){g(ri,ri.current),g(rt,rt.current)}function ro(e){h(rt),rn===e&&(rn=null),h(ri)}var ri=m(0);function ru(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var rs=s.ReactCurrentDispatcher,rc=s.ReactCurrentBatchConfig,rf=0,rd=null,rp=null,rm=null,rh=!1,rg=!1,ry=!1,rv=0,rb=0,rk=null,rw=0;function rS(){throw Error(i(321))}function rC(e,t){if(null===t)return!1;for(var n=0;na?a:8;var o=rc.transition,i={_callbacks:new Set};rc.transition=i,lf(e,!1,t,n);try{var u=l();if(null!==u&&"object"==typeof u&&"function"==typeof u.then){av(i,u);var s,c,f=(s=[],c={status:"pending",value:null,reason:null,then:function(e){s.push(e)}},u.then(function(){c.status="fulfilled",c.value=r;for(var e=0;e title"))),sG(l,n,r),l[eE]=e,eI(l),n=l;break e;case"link":var a=cE("link","href",t).get(n+(r.href||""));if(a){for(var o=0;o",e=e.removeChild(e.firstChild);break;case"select":e="string"==typeof r.is?l.createElement("select",{is:r.is}):l.createElement("select"),r.multiple?e.multiple=!0:r.size&&(e.size=r.size);break;default:e="string"==typeof r.is?l.createElement(n,{is:r.is}):l.createElement(n)}}e[eE]=t,e[ex]=r;e:for(l=t.child;null!==l;){if(5===l.tag||6===l.tag)e.appendChild(l.stateNode);else if(4!==l.tag&&27!==l.tag&&null!==l.child){l.child.return=l,l=l.child;continue}if(l===t)break;for(;null===l.sibling;){if(null===l.return||l.return===t)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}switch(t.stateNode=e,sG(e,n,r),n){case"button":case"input":case"select":case"textarea":e=!!r.autoFocus;break;case"img":e=!0;break;default:e=!1}e&&aC(t)}}return aP(t),t.flags&=-16777217,null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==r&&aC(t);else{if("string"!=typeof r&&null===t.stateNode)throw Error(i(166));if(e=I.current,t9(t)){e:{if(e=t.stateNode,n=t.memoizedProps,e[eE]=t,(r=e.nodeValue!==n)&&null!==(l=tX))switch(l.tag){case 3:if(l=0!=(1&l.mode),sq(e.nodeValue,n,l),l){e=!1;break e}break;case 27:case 5:var a=0!=(1&l.mode);if(!0!==l.memoizedProps.suppressHydrationWarning&&sq(e.nodeValue,n,a),a){e=!1;break e}}e=r}e&&aC(t)}else(e=s1(e).createTextNode(r))[eE]=t,t.stateNode=e}return aP(t),null;case 13:if(ro(t),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(tZ&&null!==tG&&0!=(1&t.mode)&&0==(128&t.flags))ne(),nt(),t.flags|=384,l=!1;else if(l=t9(t),null!==r&&null!==r.dehydrated){if(null===e){if(!l)throw Error(i(318));if(!(l=null!==(l=t.memoizedState)?l.dehydrated:null))throw Error(i(317));l[eE]=t}else nt(),0==(128&t.flags)&&(t.memoizedState=null),t.flags|=4;aP(t),l=!1}else null!==tJ&&(o0(tJ),tJ=null),l=!0;if(!l)return 256&t.flags?t:null}if(0!=(128&t.flags))return t.lanes=n,t;return n=null!==r,e=null!==e&&null!==e.memoizedState,n&&(r=t.child,l=null,null!==r.alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(l=r.alternate.memoizedState.cachePool.pool),a=null,null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(a=r.memoizedState.cachePool.pool),a!==l&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),ax(t,t.updateQueue),aP(t),null;case 4:return Q(),null===e&&sA(t.stateNode.containerInfo),aP(t),null;case 10:return an(t.type._context),aP(t),null;case 19:if(h(ri),null===(l=t.memoizedState))return aP(t),null;if(r=0!=(128&t.flags),null===(a=l.rendering)){if(r)az(l,!1);else{if(0!==oP||null!==e&&0!=(128&e.flags))for(e=t.child;null!==e;){if(null!==(a=ru(e))){for(t.flags|=128,az(l,!1),e=a.updateQueue,t.updateQueue=e,ax(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)ix(n,e),n=n.sibling;return g(ri,1&ri.current|2),t.child}e=e.sibling}null!==l.tail&&Y()>oI&&(t.flags|=128,r=!0,az(l,!1),t.lanes=4194304)}}else{if(!r){if(null!==(e=ru(a))){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,ax(t,e),az(l,!0),null===l.tail&&"hidden"===l.tailMode&&!a.alternate&&!tZ)return aP(t),null}else 2*Y()-l.renderingStartTime>oI&&536870912!==n&&(t.flags|=128,r=!0,az(l,!1),t.lanes=4194304)}l.isBackwards?(a.sibling=t.child,t.child=a):(null!==(e=l.last)?e.sibling=a:t.child=a,l.last=a)}if(null!==l.tail)return t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=Y(),t.sibling=null,e=ri.current,g(ri,r?1&e|2:1&e),t;return aP(t),null;case 22:case 23:return ro(t),re(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r&&0!=(1&t.mode)?0!=(536870912&n)&&0==(128&t.flags)&&(aP(t),6&t.subtreeFlags&&(t.flags|=8192)):aP(t),null!==(n=t.updateQueue)&&ax(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&h(ab),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),an(ad),aP(t),null;case 25:return null}throw Error(i(156,t.tag))}(t.alternate,t,oz);if(null!==n){ow=n;return}if(null!==(t=t.sibling)){ow=t;return}ow=t=e}while(null!==t);0===oP&&(oP=5)}function is(e,t,n,r,l){var a=ek,o=ov.transition;try{ov.transition=null,ek=2,function(e,t,n,r,l,a){do id();while(null!==oj);if(0!=(6&ob))throw Error(i(327));var o,u=e.finishedWork,s=e.finishedLanes;if(null!==u){if(e.finishedWork=null,e.finishedLanes=0,u===e.current)throw Error(i(177));e.callbackNode=null,e.callbackPriority=0,e.cancelPendingCommit=null;var c=u.lanes|u.childLanes;if(function(e,t,n){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.entangledLanes&=t,e.errorRecoveryDisabledLanes&=t,e.shellSuspendCounter=0,t=e.entanglements;for(var l=e.expirationTimes,a=e.hiddenUpdates;0r&&(l=r,r=a,a=l),l=si(n,a);var o=si(n,r);l&&o&&(1!==e.rangeCount||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&((t=t.createRange()).setStart(l.node,l.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;nn?32:n;n=ov.transition;var l=ek;try{if(ov.transition=null,ek=r,null===oj)var a=!1;else{r=oq,oq=null;var o=oj,u=oW;if(oj=null,oW=0,0!=(6&ob))throw Error(i(331));var s=ob;if(ob|=4,of(o.current),ol(o,o.current,u,r),ob=s,nb(!1),ea&&"function"==typeof ea.onPostCommitFiberRoot)try{ea.onPostCommitFiberRoot(el,o)}catch(e){}a=!0}return a}finally{ek=l,ov.transition=n,ic(e,t)}}return!1}function ip(e,t,n){t=lL(e,t=lP(n,t),2),null!==(e=nO(e,t,2))&&(o2(e,2),nv(e))}function im(e,t,n){if(3===e.tag)ip(e,e,n);else for(;null!==t;){if(3===t.tag){ip(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===oQ||!oQ.has(r))){e=lT(t,e=lP(n,e),2),null!==(t=nO(t,e,2))&&(o2(t,2),nv(t));break}}t=t.return}}function ih(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new om;var l=new Set;r.set(t,l)}else void 0===(l=r.get(t))&&(l=new Set,r.set(t,l));l.has(n)||(ox=!0,l.add(n),e=ig.bind(null,e,t,n),t.then(e,e))}function ig(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,2&ob?oR=!0:4&ob&&(oD=!0),ik(),ok===e&&(oS&n)===n&&(4===oP||3===oP&&(62914560&oS)===oS&&300>Y()-oA?0==(2&ob)&&o5(e,0):oT|=n),nv(e)}function iy(e,t){0===t&&(t=0==(1&e.mode)?2:eg()),null!==(e=ns(e,t))&&(o2(e,t),nv(e))}function iv(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),iy(e,n)}function ib(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;null!==l&&(n=l.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}null!==r&&r.delete(t),iy(e,n)}function ik(){if(50=uH),uY=!1;function uX(e,t){switch(e){case"keyup":return -1!==uj.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function uG(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var uZ=!1,uJ={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function u0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!uJ[e.type]:"textarea"===t}function u1(e,t,n,r){tb(r),0<(t=sV(t,"onChange")).length&&(n=new i3("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var u2=null,u3=null;function u4(e){sM(e,0)}function u6(e){if(e4(eR(e)))return e}function u8(e,t){if("change"===e)return t}var u5=!1;if(e$){if(e$){var u7="oninput"in document;if(!u7){var u9=document.createElement("div");u9.setAttribute("oninput","return;"),u7="function"==typeof u9.oninput}r=u7}else r=!1;u5=r&&(!document.documentMode||9=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=so(r)}}function su(){for(var e=window,t=e6();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(n)e=t.contentWindow;else break;t=e6(e.document)}return t}function ss(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var sc=e$&&"documentMode"in document&&11>=document.documentMode,sf=null,sd=null,sp=null,sm=!1;function sh(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;sm||null==sf||sf!==e6(r)||(r="selectionStart"in(r=sf)&&ss(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},sp&&nQ(sp,r)||(sp=r,0<(r=sV(sd,"onSelect")).length&&(t=new i3("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=sf)))}function sg(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var sy={animationend:sg("Animation","AnimationEnd"),animationiteration:sg("Animation","AnimationIteration"),animationstart:sg("Animation","AnimationStart"),transitionend:sg("Transition","TransitionEnd")},sv={},sb={};function sk(e){if(sv[e])return sv[e];if(!sy[e])return e;var t,n=sy[e];for(t in n)if(n.hasOwnProperty(t)&&t in sb)return sv[e]=n[t];return e}e$&&(sb=document.createElement("div").style,"AnimationEvent"in window||(delete sy.animationend.animation,delete sy.animationiteration.animation,delete sy.animationstart.animation),"TransitionEvent"in window||delete sy.transitionend.transition);var sw=sk("animationend"),sS=sk("animationiteration"),sC=sk("animationstart"),sE=sk("transitionend"),sx=new Map,sz="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll scrollEnd toggle touchMove waiting wheel".split(" ");function sP(e,t){sx.set(e,t),eV(t,[e])}for(var sN=0;sN title"):null)}var cz=null;function cP(){}function cN(){if(this.count--,0===this.count){if(this.stylesheets)cL(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var c_=null;function cL(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,c_=new Map,t.forEach(cT,e),c_=null,cN.call(e))}function cT(e,t){if(!(4&t.state.loading)){var n=c_.get(e);if(n)var r=n.get(null);else{n=new Map,c_.set(e,n);for(var l=e.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;aNexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/ab-tests.txt b/static/ab-tests.txt index 797387895f313f5840c6937a3f7dbaa58baaa6f2..5d704ae9e55356b8b26ecffdda8572444c9f0b6e 100644 --- a/static/ab-tests.txt +++ b/static/ab-tests.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[8580,["4502","static/chunks/app/ab-tests/page-48b03e034dff445e.js"],"default",1] +3:I[8580,["4502","static/chunks/app/ab-tests/page-2b8d2c50e2a70e90.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["ab-tests",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["ab-tests",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","ab-tests","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["ab-tests",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["ab-tests",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","ab-tests","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/activity.html b/static/activity.html index b0d922b371cf61db72b46486ce5440bed17cf949..271114fc0c31c69d76cd3ecaa4066b241571fa69 100644 --- a/static/activity.html +++ b/static/activity.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/activity.txt b/static/activity.txt index 6a21e21383faecbfa965cef2f9fc1ce56f14f9fb..484dd852d5469fc5b0ce35c0d08667d52d76868c 100644 --- a/static/activity.txt +++ b/static/activity.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[6105,["6263","static/chunks/app/activity/page-5a4807967b5002cd.js"],"default",1] +3:I[6105,["6263","static/chunks/app/activity/page-03c92e6695ec079a.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["activity",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["activity",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","activity","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["activity",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["activity",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","activity","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/admin.html b/static/admin.html index 06f11243ae18afc3957d7f283be5597e27027dc4..fe88dc308524ad9f9364cf34b38760adbb67117a 100644 --- a/static/admin.html +++ b/static/admin.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/admin.txt b/static/admin.txt index 78b8d29a8242a9bd3b89f84163004343d19cd61e..d517ec2fa6587ebc723897c2ce559c106cfa476a 100644 --- a/static/admin.txt +++ b/static/admin.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[6683,["4953","static/chunks/4953-b4a1dd503f6f8692.js","3","static/chunks/app/admin/page-048442296e23ef4d.js"],"default",1] +3:I[6683,["4953","static/chunks/4953-b4a1dd503f6f8692.js","3","static/chunks/app/admin/page-cc1da0c8bc82e2cd.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["admin",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["admin",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","admin","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["admin",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["admin",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","admin","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/agent.html b/static/agent.html index a0ae0db39bff23a9efefabf96b6b1406c528d2d4..361386a535fb4054dc9f735876157b1b8fb900a6 100644 --- a/static/agent.html +++ b/static/agent.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/agent.txt b/static/agent.txt index de09e7a24eb01906f33d357068449422b71cac6c..80bf105db574074b302f4a1f8a2e7261c5459e33 100644 --- a/static/agent.txt +++ b/static/agent.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[5126,["2060","static/chunks/app/agent/page-3e623457abaac9ba.js"],"default",1] +3:I[5126,["2060","static/chunks/app/agent/page-a263a79fd957da1d.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["agent",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["agent",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","agent","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["agent",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["agent",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","agent","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/aliases.html b/static/aliases.html index 24113e5e9b828eedc608756cc6557565312708ad..fab593fc8ca1c1589ab6ee50fab3df6630bd4bf6 100644 --- a/static/aliases.html +++ b/static/aliases.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/aliases.txt b/static/aliases.txt index e30679fa0e7e1c5cfb401bb1b377e8ca9dbd9629..148178083ea132c27e8554d85db04d3766795f95 100644 --- a/static/aliases.txt +++ b/static/aliases.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[947,["5781","static/chunks/app/aliases/page-4c00397d46a1ecfd.js"],"default",1] +3:I[947,["5781","static/chunks/app/aliases/page-41cd8bb4b05195fc.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["aliases",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["aliases",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","aliases","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["aliases",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["aliases",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","aliases","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/analytics.html b/static/analytics.html index 84a94b901afcb149dd0decd98277348df776f214..34010aaa880e5a193d904a9ad988c698a360b8bc 100644 --- a/static/analytics.html +++ b/static/analytics.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/analytics.txt b/static/analytics.txt index 016aa2222d01254f9ffb445942745eb53471a70d..5161116774360f158d4d8df1c395639ee69b9d98 100644 --- a/static/analytics.txt +++ b/static/analytics.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[6351,["4109","static/chunks/app/analytics/page-d99b46621eeb72d0.js"],"default",1] +3:I[6351,["4109","static/chunks/app/analytics/page-06a4c26379b4ee7e.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["analytics",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["analytics",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","analytics","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["analytics",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["analytics",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","analytics","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/batch-api.html b/static/batch-api.html index b241d0386254c69068d62900a424446384ea85a6..bd6893c54479975bfef368a6e5aaf6f6ebb0c603 100644 --- a/static/batch-api.html +++ b/static/batch-api.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/batch-api.txt b/static/batch-api.txt index 6230cd7552e1afde5563455c2c6d1ffb95ea9393..7a1f6ee417d0d67222198300b7e16839ad1152d4 100644 --- a/static/batch-api.txt +++ b/static/batch-api.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[8273,["5668","static/chunks/app/batch-api/page-77c5fb2136ff3a1a.js"],"default",1] +3:I[8273,["5668","static/chunks/app/batch-api/page-efde9eb1301afc84.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["batch-api",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["batch-api",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","batch-api","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["batch-api",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["batch-api",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","batch-api","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/benchmarks.html b/static/benchmarks.html index 44c7ae6e49e9708099fb8628b0958220105b233c..7d9799478532db766b9dd7eed0602714b69785f7 100644 --- a/static/benchmarks.html +++ b/static/benchmarks.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/benchmarks.txt b/static/benchmarks.txt index 702abc0acdab5b65dcd3225c5d24596c75d8c8cb..e7577d281fec99daad3f1eabeb6fe94971dd11f8 100644 --- a/static/benchmarks.txt +++ b/static/benchmarks.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[4202,["1821","static/chunks/app/benchmarks/page-d6e2b98299937e6a.js"],"default",1] +3:I[4202,["1821","static/chunks/app/benchmarks/page-2971e504ea962b1e.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["benchmarks",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["benchmarks",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","benchmarks","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["benchmarks",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["benchmarks",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","benchmarks","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/cache.html b/static/cache.html index abab4cbc039568518fab4a5b5fe74918db04e5e5..a2deefa952604d06ea93a054e1d721c22e17c128 100644 --- a/static/cache.html +++ b/static/cache.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/cache.txt b/static/cache.txt index 5c83eb7da1f86a4a4314fa2de44d21ddc354eb8a..8cc83c4a657d610ddd39deda921d3225ff52616f 100644 --- a/static/cache.txt +++ b/static/cache.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[6593,["4231","static/chunks/app/cache/page-1dceb2a7e680cdb2.js"],"default",1] +3:I[6593,["4231","static/chunks/app/cache/page-16bf5ae5f751e0ae.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["cache",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["cache",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","cache","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["cache",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["cache",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","cache","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/chat.html b/static/chat.html index e1ebfbde3a6c139b95848e9616ee1da71cda0f61..5b500de5b0af92e6a021edce8067a82ff36844e3 100644 --- a/static/chat.html +++ b/static/chat.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/chat.txt b/static/chat.txt index a544606f8f8cf4c833eae28d919edab304c43d1c..4d19264cb254457900b06d2c13e9a239130cf7c9 100644 --- a/static/chat.txt +++ b/static/chat.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[628,["1929","static/chunks/app/chat/page-ba53668baba0967f.js"],"default",1] +3:I[628,["1929","static/chunks/app/chat/page-fd7d09a808f0f08f.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["chat",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["chat",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","chat","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["chat",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["chat",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","chat","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/code-interpreter.html b/static/code-interpreter.html index f01eef04ceac4596fe69911682073120cfe2435f..8ecd9e35c93d274b0daa4fdc95a181d864334d7c 100644 --- a/static/code-interpreter.html +++ b/static/code-interpreter.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/code-interpreter.txt b/static/code-interpreter.txt index e1a25ed27d51b060bc2282ceb13da64de557cbf9..70e9a338066598d774f54a76af373d0ed634f38e 100644 --- a/static/code-interpreter.txt +++ b/static/code-interpreter.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[2763,["5866","static/chunks/app/code-interpreter/page-616c2499443c23ee.js"],"default",1] +3:I[2763,["5866","static/chunks/app/code-interpreter/page-6263999561ce9799.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["code-interpreter",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["code-interpreter",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","code-interpreter","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["code-interpreter",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["code-interpreter",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","code-interpreter","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/config-backup.html b/static/config-backup.html index 9f4ebf5a546a586c908b585ac9353c6606ba609a..732f6d8ab8ef7dfb932f22db05a0abafd5b8d964 100644 --- a/static/config-backup.html +++ b/static/config-backup.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/config-backup.txt b/static/config-backup.txt index 2ccb9c12a7d567c1acd988de7408c743bcbf9f0e..ce7981cd1eaabff8188c2ec5ea4fbba2301d2b0f 100644 --- a/static/config-backup.txt +++ b/static/config-backup.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[9928,["2378","static/chunks/app/config-backup/page-f8aede07552f28f7.js"],"default",1] +3:I[9928,["2378","static/chunks/app/config-backup/page-3da24ba3742904fe.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["config-backup",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["config-backup",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","config-backup","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["config-backup",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["config-backup",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","config-backup","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/conversations.html b/static/conversations.html index dcadb3f7e0843d90df04444a519863f511a7ea94..81bbd1cbe2912072b29118006eff33222126f3f7 100644 --- a/static/conversations.html +++ b/static/conversations.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/conversations.txt b/static/conversations.txt index e9ccdfe029a489091ca3f207ca306b9fb506e001..21af22d8f4149be665376d808290c0fea13d0ea4 100644 --- a/static/conversations.txt +++ b/static/conversations.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[5683,["5195","static/chunks/app/conversations/page-d1e1c668033ca84e.js"],"default",1] +3:I[5683,["5195","static/chunks/app/conversations/page-c7a6b871b4413f88.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["conversations",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["conversations",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","conversations","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["conversations",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["conversations",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","conversations","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/custom-providers.html b/static/custom-providers.html index 276548b9436b1f9e1118fe268cd1eae08ff5a8cc..08f8ca297c31a07887c3430455950e4d23498dcd 100644 --- a/static/custom-providers.html +++ b/static/custom-providers.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/custom-providers.txt b/static/custom-providers.txt index a0ecd347c5b58a3850936a1defb95b892947093a..d386bd36c8df57926c16f6d49e8e23f28b015e79 100644 --- a/static/custom-providers.txt +++ b/static/custom-providers.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[3946,["8587","static/chunks/app/custom-providers/page-138528cda1a2fab8.js"],"default",1] +3:I[3946,["8587","static/chunks/app/custom-providers/page-4fc98b07b6fcfdb0.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["custom-providers",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["custom-providers",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","custom-providers","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["custom-providers",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["custom-providers",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","custom-providers","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/docs.html b/static/docs.html index 95f26acb7286a41c6949801dffa501c37c5cf987..3d8b76491c059f321222c2a688b9db64136d09df 100644 --- a/static/docs.html +++ b/static/docs.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/docs.txt b/static/docs.txt index 2d43981a732f4f3e588212ef695cbbdef06139a5..e37b5ad02c5fc7f38869eefe2975c6a660cbc43f 100644 --- a/static/docs.txt +++ b/static/docs.txt @@ -2,9 +2,9 @@ 3:I[3532,["2726","static/chunks/app/docs/page-1e88501f62babd94.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["docs",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["docs",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","docs","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["docs",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["docs",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","docs","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/fallback-chains.html b/static/fallback-chains.html index 0387746f3ddd41c00f9b88aeac6d03c80992a5e1..d8ee64a6d6597f7a7e24c2e94dc72fc4c81af4ae 100644 --- a/static/fallback-chains.html +++ b/static/fallback-chains.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/fallback-chains.txt b/static/fallback-chains.txt index 3bdb0b5b3c104a4b4d6d0faf58bb7c7eeef182a4..e53631f9f7646a1baf9e0fb3ace1a4787ac9b3b6 100644 --- a/static/fallback-chains.txt +++ b/static/fallback-chains.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[4069,["1265","static/chunks/app/fallback-chains/page-8e5925e44323ee69.js"],"default",1] +3:I[4069,["1265","static/chunks/app/fallback-chains/page-85fd52fb5eae847a.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["fallback-chains",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["fallback-chains",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","fallback-chains","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["fallback-chains",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["fallback-chains",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","fallback-chains","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/fine-tuning.html b/static/fine-tuning.html index 641436edb543735fe5f27f18eadaf47ebe3b84f4..79591766e98926b60acb0a860b35e72f91bb36b4 100644 --- a/static/fine-tuning.html +++ b/static/fine-tuning.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/fine-tuning.txt b/static/fine-tuning.txt index 047c1b49ebc98e7db5c4a4e64bc3c1e82e71fbc0..85f8a81fb8852efb848f7871d43ffe24276d533e 100644 --- a/static/fine-tuning.txt +++ b/static/fine-tuning.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[3396,["8919","static/chunks/app/fine-tuning/page-ecbefa6299ef7516.js"],"default",1] +3:I[3396,["8919","static/chunks/app/fine-tuning/page-0f5de87c7b897ed1.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["fine-tuning",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["fine-tuning",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","fine-tuning","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["fine-tuning",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["fine-tuning",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","fine-tuning","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/health.html b/static/health.html index b17b60860d9e96a9b2f941348dfc3e444d5aa0e3..4eaa5da5873622c238a1df3dc397daf84786bcae 100644 --- a/static/health.html +++ b/static/health.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/health.txt b/static/health.txt index 31735974efb1dbde149d49322062796471768f93..06e1fc8e5e9ae63e541f0ca291ac93277768fdda 100644 --- a/static/health.txt +++ b/static/health.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[4523,["1613","static/chunks/app/health/page-0076cc8e10197b14.js"],"default",1] +3:I[4523,["1613","static/chunks/app/health/page-f9a55c9d3c1965a7.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["health",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["health",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","health","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["health",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["health",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","health","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/index.html b/static/index.html index d75022c4fe025329cc8704423a56dcf99e1dfdfc..cf3e3b5ecbe7030c54ffc222ceeb3a0ecd2c7dd1 100644 --- a/static/index.html +++ b/static/index.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/index.txt b/static/index.txt index acf2c2523fb902087e76c6c10f2841dc79d2d277..95522f7a119650f0a93544a30624267381942b91 100644 --- a/static/index.txt +++ b/static/index.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[6117,["1931","static/chunks/app/page-bbfccd1a277e7cd3.js"],"default",1] -4:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +3:I[6117,["1931","static/chunks/app/page-d699e41196a151c5.js"],"default",1] +4:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 5:I[4707,[],""] 6:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 7:I[6423,[],""] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L4",null,{"children":["$","$L5",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$6","errorStyles":[],"errorScripts":[],"template":["$","$L7",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L4",null,{"children":["$","$L5",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$6","errorStyles":[],"errorScripts":[],"template":["$","$L7",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/injection-logs.html b/static/injection-logs.html index 477f7b4a64dbab46c6e32fca78e9c8b7fab39582..cb79fcb1411b1912e1ee36bee9bddc24a1f11ddf 100644 --- a/static/injection-logs.html +++ b/static/injection-logs.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/injection-logs.txt b/static/injection-logs.txt index 6d216dee6c35d22e73553a3e80841ff5c8e81498..0d740799839c2d2860bd3d965bdd77c988fe92ea 100644 --- a/static/injection-logs.txt +++ b/static/injection-logs.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[6778,["9762","static/chunks/app/injection-logs/page-2706b6e7f373b605.js"],"default",1] +3:I[6778,["9762","static/chunks/app/injection-logs/page-6711c383734d1328.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["injection-logs",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["injection-logs",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","injection-logs","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["injection-logs",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["injection-logs",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","injection-logs","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/integration.html b/static/integration.html index 1b9197fff02382e751bcd6cbf21d96ed5a99b69c..b32a62267b23d415a63885c7e2b981fd00fd4173 100644 --- a/static/integration.html +++ b/static/integration.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/integration.txt b/static/integration.txt index 83b1243e7a4e3cb7b6b46a514899a06288508211..8242907a6b5ccb2053ec73679b65f065aa3b72e0 100644 --- a/static/integration.txt +++ b/static/integration.txt @@ -2,9 +2,9 @@ 3:I[1014,["9656","static/chunks/app/integration/page-97fb6efb22994472.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["integration",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["integration",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","integration","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["integration",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["integration",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","integration","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/keys.html b/static/keys.html index 0fdfb40f56990deb954309451124a59bba062652..1f60a82bb33045f2039d9c2ac666a2b865fb4142 100644 --- a/static/keys.html +++ b/static/keys.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/keys.txt b/static/keys.txt index d9525e3027350e3ea437c20c6c46db7b5acfb5ec..daeff760e48fee6359568d5d6937ebedfbe9a34e 100644 --- a/static/keys.txt +++ b/static/keys.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[8001,["23","static/chunks/app/keys/page-41ddea359d104a24.js"],"default",1] +3:I[8001,["23","static/chunks/app/keys/page-96ae9c1354f1877c.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["keys",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["keys",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","keys","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["keys",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["keys",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","keys","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/latency.html b/static/latency.html index 86f28b0db6f0ae1db09bcf3827effffd06ae9094..d700e6128aa77ddd82f16c80b5d9f0b099c437f8 100644 --- a/static/latency.html +++ b/static/latency.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/latency.txt b/static/latency.txt index 6df97e3b5f5e7db7ea57946d242b86dea0f9e2ca..515b8dc0aac5468d62842736bef818f02b2b4a0d 100644 --- a/static/latency.txt +++ b/static/latency.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[4911,["9395","static/chunks/app/latency/page-977dd72e08125802.js"],"default",1] +3:I[4911,["9395","static/chunks/app/latency/page-52b713a656b347a3.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["latency",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["latency",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","latency","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["latency",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["latency",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","latency","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/login.html b/static/login.html index 80a4d15341d0e2c2d46a8c25b2e1ae727889ae05..bb19b94612cc083a505cf43abc7541184a5abf59 100644 --- a/static/login.html +++ b/static/login.html @@ -1,84 +1 @@ - - - - - - - -Sign in — NexusAI Gateway - - - -
- -

NexusAI

-

Self-hosted AI API Gateway

-
Your session has expired. Please sign in again.
-
-
- - -
-
- - -
- -

Default: admin / nexus1234

-
- - - +NexusAI Gateway
\ No newline at end of file diff --git a/static/login.txt b/static/login.txt index f8982c042f0f1a3e1c79d2898f98af6faf021f1c..d81a3bbbc6d04221e773313b7bc4a030ec063dcd 100644 --- a/static/login.txt +++ b/static/login.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[8991,["2626","static/chunks/app/login/page-4c7d6e8163bf093b.js"],"default",1] +3:I[8991,["2626","static/chunks/app/login/page-f6080b011a358229.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["login",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["login",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","login","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["login",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["login",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","login","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/middleware.html b/static/middleware.html index 626223b820430afbf816667b28fa1ffa167adc3f..4de8294e97acd8562c993c016de7a6b59638c5c1 100644 --- a/static/middleware.html +++ b/static/middleware.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/middleware.txt b/static/middleware.txt index faaad2496995152e5064ae4aff08e037f80d89ea..370873585c5c910fc59f1d8fb04bc5f418c4d38d 100644 --- a/static/middleware.txt +++ b/static/middleware.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[3794,["7047","static/chunks/app/middleware/page-90a9795296d289fa.js"],"default",1] +3:I[3794,["7047","static/chunks/app/middleware/page-0a367244a83d6dfc.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["middleware",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["middleware",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","middleware","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["middleware",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["middleware",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","middleware","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/models.html b/static/models.html index 2b1cac468f3fdedf605cac4e4e7863469b3f5f85..890cd62fe9da81538ec2baed0b5cf69f1e8303d7 100644 --- a/static/models.html +++ b/static/models.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/models.txt b/static/models.txt index 227539db850f8993546f4482cea106aaf7f6850e..f0e7c5fa54e9e03c0e6ae40ee061e30607f74e44 100644 --- a/static/models.txt +++ b/static/models.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[2697,["4954","static/chunks/app/models/page-117eca1fbb20a433.js"],"default",1] +3:I[2697,["4954","static/chunks/app/models/page-9220ecf2972703a6.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["models",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["models",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","models","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["models",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["models",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","models","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/playground.html b/static/playground.html index 64482d7448cf3574467a29fc08a0b481e320990b..b176c6a848de7688b04d0f7ec76ec7bd9705d5c4 100644 --- a/static/playground.html +++ b/static/playground.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/playground.txt b/static/playground.txt index ea3735c5c9ec395eabe862d92358c0f2005b7042..9bdd462b28ff11a9a4c10c18670465c363ffeec4 100644 --- a/static/playground.txt +++ b/static/playground.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[5427,["2383","static/chunks/app/playground/page-66b5ce70d1dd254e.js"],"default",1] +3:I[5427,["2383","static/chunks/app/playground/page-4596e02c5be42048.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["playground",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["playground",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","playground","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["playground",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["playground",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","playground","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/presets.html b/static/presets.html index 56a9fc5dd667e5b0c53056b86c0d7c8d615be095..802dd285c86340c5d551e073b552a14cc17431e3 100644 --- a/static/presets.html +++ b/static/presets.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/presets.txt b/static/presets.txt index 52c0fb17e8c46c828406daeacc8ffb757efd26ff..fde32872e47ea82f453588f8c490bf501bcfa65c 100644 --- a/static/presets.txt +++ b/static/presets.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[7517,["6782","static/chunks/app/presets/page-e75a52cbe12d5661.js"],"default",1] +3:I[7517,["6782","static/chunks/app/presets/page-dd9839af3202a963.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["presets",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["presets",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","presets","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["presets",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["presets",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","presets","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/pricing.html b/static/pricing.html index 7111f7eb7a1a8f12582a753c7b613b08b5e4e4fa..b58d34689007062bb53dc2545168b23e6ecc0009 100644 --- a/static/pricing.html +++ b/static/pricing.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/pricing.txt b/static/pricing.txt index 538c66a3c4cf5f3ba5d93b98c60ea27445c3d736..53ecf9447d8984b72c009b3af9f66838ee701b83 100644 --- a/static/pricing.txt +++ b/static/pricing.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[7889,["9979","static/chunks/app/pricing/page-9f2846c18c318db8.js"],"default",1] +3:I[7889,["9979","static/chunks/app/pricing/page-71ebf02060044864.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["pricing",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["pricing",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","pricing","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["pricing",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["pricing",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","pricing","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/prompt-templates.html b/static/prompt-templates.html index ce39f78f8c787177b1c576a3eae0a25c4d7399c6..f6e7326212429fb9c0bfde34674f4709c76a0a75 100644 --- a/static/prompt-templates.html +++ b/static/prompt-templates.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/prompt-templates.txt b/static/prompt-templates.txt index 13324ce47863d2c7b16756df117a1a1bb4cbe184..c1561d10d5ba183d0a9459d86014ca3a997fb6c9 100644 --- a/static/prompt-templates.txt +++ b/static/prompt-templates.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[7416,["1820","static/chunks/app/prompt-templates/page-d7b73ef5e135a78f.js"],"default",1] +3:I[7416,["1820","static/chunks/app/prompt-templates/page-8b45083831cf0f9f.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["prompt-templates",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["prompt-templates",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","prompt-templates","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["prompt-templates",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["prompt-templates",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","prompt-templates","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/provider-keys.html b/static/provider-keys.html index 178b0e434851857daafe435fae0e3881b1422e5a..09aeeae4d9ad0458b63251a1a58e7d09a271b0cb 100644 --- a/static/provider-keys.html +++ b/static/provider-keys.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/provider-keys.txt b/static/provider-keys.txt index 3dc90a318ffb1d05649bc6de2dd7f1698b065f57..9e4b37cb53e1fd0721b5faf4ef9695ae402728f2 100644 --- a/static/provider-keys.txt +++ b/static/provider-keys.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[2180,["2705","static/chunks/app/provider-keys/page-a507c5d60a14edbb.js"],"default",1] +3:I[2180,["2705","static/chunks/app/provider-keys/page-37e31932382ae6c2.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["provider-keys",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["provider-keys",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","provider-keys","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["provider-keys",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["provider-keys",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","provider-keys","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/rag.html b/static/rag.html index 490317b61f9e3f4ae3d93ec3d703df3dfa64cb9a..a934b163fa9b12fb3af942c8d525a516f3e0db0f 100644 --- a/static/rag.html +++ b/static/rag.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/rag.txt b/static/rag.txt index fc08fd6bc56bb9527ea66402021a418cabdb19da..fb5ec6c2648ce2eeff11cb54606f12e60d8996a9 100644 --- a/static/rag.txt +++ b/static/rag.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[9420,["7240","static/chunks/app/rag/page-d3fb4e1b1cf4fbff.js"],"default",1] +3:I[9420,["7240","static/chunks/app/rag/page-3831eea5c6d27ccd.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["rag",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["rag",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","rag","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["rag",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["rag",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","rag","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/realtime.html b/static/realtime.html index bdb0b072085986d3da08f6b8e61bdacd735e5669..95f488f3ec4c435c1899c996bdb684cfb7be9f96 100644 --- a/static/realtime.html +++ b/static/realtime.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/realtime.txt b/static/realtime.txt index 01a9d88d0c573afb8d9cba3c8e50d47d14b636cc..78cd4d4f62c264563700087ab3e950b226d3ac96 100644 --- a/static/realtime.txt +++ b/static/realtime.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[5354,["5029","static/chunks/5029-9da5e34b5548aa96.js","655","static/chunks/app/realtime/page-31118a081ad27c14.js"],"default",1] +3:I[5354,["5029","static/chunks/5029-9da5e34b5548aa96.js","655","static/chunks/app/realtime/page-81ac2a49bbe724a6.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["realtime",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["realtime",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","realtime","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["realtime",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["realtime",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","realtime","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/response-filters.html b/static/response-filters.html index bc04da6720cf413afe5dd2576d725cc3d08fa8b8..2da96d4b24dcedb032f8665c735977f9a08e4f0a 100644 --- a/static/response-filters.html +++ b/static/response-filters.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/response-filters.txt b/static/response-filters.txt index 5ed26b465c41b14013e4a1107b19a0723f2e3d58..fb73871c64c3b21a5cba2dd09a8d2107a7617bff 100644 --- a/static/response-filters.txt +++ b/static/response-filters.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[2110,["9542","static/chunks/app/response-filters/page-83edbfac0827cf2b.js"],"default",1] +3:I[2110,["9542","static/chunks/app/response-filters/page-a2dcc868f436b552.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["response-filters",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["response-filters",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","response-filters","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["response-filters",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["response-filters",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","response-filters","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/routing.html b/static/routing.html index ee10f9d7150aa59ec5088aa7cc09bdb879549317..1705be1090160541e7086abca906d8670c0376a3 100644 --- a/static/routing.html +++ b/static/routing.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/routing.txt b/static/routing.txt index a0b8d13b1c6efc7b30b3cb7d73b68a94b9c88f6c..4e57bc4a8dadf1608b64d0e355d66bbc50e50c34 100644 --- a/static/routing.txt +++ b/static/routing.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[144,["3063","static/chunks/app/routing/page-e3048c19ed27d4cd.js"],"default",1] +3:I[144,["3063","static/chunks/app/routing/page-a1893f3089c33e49.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["routing",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["routing",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","routing","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["routing",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["routing",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","routing","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/status.html b/static/status.html index c1bb3f2dd392ce87cdfd7c8d3c98a98a709e0cf6..9e03e86d44554585077f975848998447f8a1aa39 100644 --- a/static/status.html +++ b/static/status.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/status.txt b/static/status.txt index 2ea6112aaafb5e1a85c60be57b89f9735a2da9cb..839a648ded97a2cd4934c471875a2a32b09e975f 100644 --- a/static/status.txt +++ b/static/status.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[8730,["5357","static/chunks/app/status/page-1c685d9e2718b0b1.js"],"default",1] +3:I[8730,["5357","static/chunks/app/status/page-0aab24a3e514ce40.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["status",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["status",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","status","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["status",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["status",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","status","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null diff --git a/static/webhooks.html b/static/webhooks.html index dfc016b619c0e6e51e533e80b528de9248338509..4914461999025509454053dd573a132f274c9150 100644 --- a/static/webhooks.html +++ b/static/webhooks.html @@ -1 +1 @@ -NexusAI Gateway \ No newline at end of file +NexusAI Gateway \ No newline at end of file diff --git a/static/webhooks.txt b/static/webhooks.txt index 13d2952784470c3fc726ee6305a6abda4da449b6..49fc462164acd39cf18dfe1303dc24085fc29de3 100644 --- a/static/webhooks.txt +++ b/static/webhooks.txt @@ -1,10 +1,10 @@ 2:I[9107,[],"ClientPageRoot"] -3:I[2397,["1297","static/chunks/app/webhooks/page-65e3822bce75043c.js"],"default",1] +3:I[2397,["1297","static/chunks/app/webhooks/page-861afa5d4827bc08.js"],"default",1] 4:I[4707,[],""] 5:I[6423,[],""] -6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-8a0f8a17324939d0.js"],"Providers"] +6:I[6198,["7593","static/chunks/7593-27216b2b02a4a8eb.js","3185","static/chunks/app/layout-62b35e683e324a12.js"],"Providers"] 7:I[376,["7601","static/chunks/app/error-b2ab4ca55fe81703.js"],"default"] 8:I[5292,["9160","static/chunks/app/not-found-94ff6d0f4372cc52.js"],"default"] -0:["6VYU5qR-4gYg0L7vwEHSN",[[["",{"children":["webhooks",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["webhooks",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","webhooks","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] +0:["7SRs9Ntci43nzMnYnHM1A",[[["",{"children":["webhooks",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["webhooks",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","webhooks","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/ab9b26685aa74f86.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"style":{"background":"#0a0a0a","color":"#fff","margin":0},"children":["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$7","errorStyles":[],"errorScripts":[],"template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[]}]}]}]}]],null],null],["$L9",null]]]] 9:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"name":"theme-color","content":"#0a0a0a"}],["$","meta","2",{"name":"color-scheme","content":"dark"}],["$","meta","3",{"charSet":"utf-8"}],["$","title","4",{"children":"NexusAI Gateway"}],["$","meta","5",{"name":"description","content":"Self-hosted AI API Gateway"}],["$","link","6",{"rel":"icon","href":"/favicon.svg"}]] 1:null