Files
cim_summary/backend/frontend-dist/assets/UploadMonitoringDashboard-90d06ab8.js
Jon 185c780486
Some checks failed
CI/CD Pipeline / Backend - Lint & Test (push) Has been cancelled
CI/CD Pipeline / Frontend - Lint & Test (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Build Backend (push) Has been cancelled
CI/CD Pipeline / Build Frontend (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Performance Tests (push) Has been cancelled
CI/CD Pipeline / Dependency Updates (push) Has been cancelled
🚀 Update to Claude 3.7 latest and fix LLM processing issues
- Updated Anthropic API to latest version (2024-01-01)
- Set Claude 3.7 Sonnet Latest as primary model
- Removed deprecated Opus 3.5 references
- Fixed LLM response validation and JSON parsing
- Improved error handling and logging
- Updated model configurations and pricing
- Enhanced document processing reliability
- Fixed TypeScript type issues
- Updated environment configuration
2025-08-17 17:31:56 -04:00

8 lines
15 KiB
JavaScript

import{c as e,r as s,j as r,A as a,T as t,e as l}from"./index-9817dacc.js";import{A as d,C as i}from"./check-circle-937a9172.js";import{C as c}from"./clock-9f043116.js";import{A as n}from"./alert-triangle-326a303a.js";
/**
* @license lucide-react v0.294.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const x=e("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"}]]),o=()=>{const[e,o]=s.useState(null),[m,h]=s.useState(!0),[u,g]=s.useState(null),[j,p]=s.useState("24"),[b,N]=s.useState(!0),f=()=>{return e=void 0,s=null,r=function*(){try{h(!0);const e=yield l.get(`/monitoring/dashboard?hours=${j}`);o(e.data.data),g(null)}catch(e){g(e instanceof Error?e.message:"Failed to fetch data")}finally{h(!1)}},new Promise((a,t)=>{var l=e=>{try{i(r.next(e))}catch(s){t(s)}},d=e=>{try{i(r.throw(e))}catch(s){t(s)}},i=e=>e.done?a(e.value):Promise.resolve(e.value).then(l,d);i((r=r.apply(e,s)).next())});var e,s,r};s.useEffect(()=>{f()},[j]),s.useEffect(()=>{if(!b)return;const e=setInterval(f,3e4);return()=>clearInterval(e)},[b,j]);const v=e=>e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${(e/6e4).toFixed(1)}m`;if(m&&!e)return r.jsxs("div",{className:"flex items-center justify-center h-64",children:[r.jsx(x,{className:"h-8 w-8 animate-spin"}),r.jsx("span",{className:"ml-2",children:"Loading dashboard data..."})]});if(u)return r.jsx("div",{className:"mb-4 p-4 bg-red-50 border border-red-200 rounded-lg",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx(d,{className:"h-4 w-4 text-red-600 mr-2"}),r.jsx("span",{className:"text-red-800",children:u})]})});if(!e)return r.jsx("div",{className:"mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-lg",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx(d,{className:"h-4 w-4 text-yellow-600 mr-2"}),r.jsx("span",{className:"text-yellow-800",children:"No dashboard data available"})]})});let y,w,S,T;if(e.metrics&&e.healthStatus&&e.realTimeStats&&e.errorAnalysis)({metrics:y,healthStatus:w,realTimeStats:S,errorAnalysis:T}=e);else{const s={metrics:e.metrics||{totalUploads:0,successfulUploads:0,failedUploads:0,successRate:0,averageProcessingTime:0},healthStatus:e.healthStatus||{status:"unknown",successRate:0,averageProcessingTime:0,recentErrors:[],recommendations:[]},realTimeStats:e.realTimeStats||{activeUploads:0,uploadsLastMinute:0,uploadsLastHour:0,currentSuccessRate:0},errorAnalysis:e.errorAnalysis||{topErrorTypes:[],topErrorStages:[],errorTrends:[]}};({metrics:y,healthStatus:w,realTimeStats:S,errorAnalysis:T}=s)}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold",children:"Upload Pipeline Monitoring"}),r.jsx("p",{className:"text-muted-foreground",children:"Real-time monitoring and analytics for document upload processing"})]}),r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsxs("select",{value:j,onChange:e=>p(e.target.value),className:"w-32 px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",children:[r.jsx("option",{value:"1",children:"1 Hour"}),r.jsx("option",{value:"6",children:"6 Hours"}),r.jsx("option",{value:"24",children:"24 Hours"}),r.jsx("option",{value:"168",children:"7 Days"})]}),r.jsxs("button",{className:"px-4 py-2 text-sm font-medium rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 "+(b?"bg-blue-600 text-white hover:bg-blue-700":"bg-white text-gray-700 border border-gray-300 hover:bg-gray-50"),onClick:()=>N(!b),children:[r.jsx(x,{className:"h-4 w-4 mr-2 inline "+(b?"animate-spin":"")}),"Auto Refresh"]}),r.jsxs("button",{className:"px-4 py-2 text-sm font-medium bg-white text-gray-700 border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500",onClick:f,children:[r.jsx(x,{className:"h-4 w-4 mr-2 inline"}),"Refresh"]})]})]}),r.jsxs("div",{className:"bg-white shadow rounded-lg border border-gray-200",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsxs("h3",{className:"text-lg font-medium text-gray-900 flex items-center space-x-2",children:[(e=>{switch(e){case"healthy":return r.jsx(i,{className:"h-5 w-5 text-green-500"});case"degraded":return r.jsx(n,{className:"h-5 w-5 text-yellow-500"});case"unhealthy":return r.jsx(d,{className:"h-5 w-5 text-red-500"});default:return r.jsx(a,{className:"h-5 w-5 text-gray-500"})}})(w.status),r.jsx("span",{children:"System Health Status"}),r.jsx("span",{className:`ml-2 px-2 py-1 text-xs font-medium rounded-full ${(e=>{switch(e){case"healthy":return"bg-green-500";case"degraded":return"bg-yellow-500";case"unhealthy":return"bg-red-500";default:return"bg-gray-500"}})(w.status)} text-white`,children:w.status.toUpperCase()})]})}),r.jsxs("div",{className:"px-6 py-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsxs("div",{className:"text-2xl font-bold text-green-600",children:[w.successRate.toFixed(1),"%"]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Success Rate"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-blue-600",children:v(w.averageProcessingTime)}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Avg Processing Time"})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-orange-600",children:w.recentErrors.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Recent Errors"})]})]}),w.recommendations.length>0&&r.jsxs("div",{className:"mt-4",children:[r.jsx("h4",{className:"font-semibold mb-2",children:"Recommendations:"}),r.jsx("ul",{className:"space-y-1",children:w.recommendations.map((e,s)=>r.jsxs("li",{className:"text-sm text-muted-foreground flex items-start",children:[r.jsx(d,{className:"h-4 w-4 mr-2 mt-0.5 text-yellow-500"}),e]},s))})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"bg-white shadow rounded-lg border border-gray-200 p-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(a,{className:"h-4 w-4 text-blue-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Active Uploads"})]}),r.jsx("div",{className:"text-2xl font-bold",children:S.activeUploads})]}),r.jsxs("div",{className:"bg-white shadow rounded-lg border border-gray-200 p-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(c,{className:"h-4 w-4 text-green-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Last Minute"})]}),r.jsx("div",{className:"text-2xl font-bold",children:S.uploadsLastMinute})]}),r.jsxs("div",{className:"bg-white shadow rounded-lg border border-gray-200 p-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(t,{className:"h-4 w-4 text-purple-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Last Hour"})]}),r.jsx("div",{className:"text-2xl font-bold",children:S.uploadsLastHour})]}),r.jsxs("div",{className:"bg-white shadow rounded-lg border border-gray-200 p-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(i,{className:"h-4 w-4 text-green-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Success Rate"})]}),r.jsxs("div",{className:"text-2xl font-bold",children:[S.currentSuccessRate.toFixed(1),"%"]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"border-b border-gray-200",children:r.jsxs("nav",{className:"-mb-px flex space-x-8",children:[r.jsx("button",{className:"border-b-2 border-blue-500 py-2 px-1 text-sm font-medium text-blue-600",children:"Overview"}),r.jsx("button",{className:"border-b-2 border-transparent py-2 px-1 text-sm font-medium text-gray-500 hover:text-gray-700 hover:border-gray-300",children:"Error Analysis"}),r.jsx("button",{className:"border-b-2 border-transparent py-2 px-1 text-sm font-medium text-gray-500 hover:text-gray-700 hover:border-gray-300",children:"Performance"})]})}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"bg-white shadow rounded-lg border border-gray-200",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Upload Statistics"})}),r.jsx("div",{className:"px-6 py-4",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[r.jsx("span",{children:"Success Rate"}),r.jsxs("span",{children:[y.successRate.toFixed(1),"%"]})]}),r.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:r.jsx("div",{className:"bg-blue-600 h-2 rounded-full",style:{width:`${y.successRate}%`}})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4 text-center",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-2xl font-bold text-green-600",children:y.successfulUploads}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Successful"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-2xl font-bold text-red-600",children:y.failedUploads}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Failed"})]})]})]})})]}),r.jsxs("div",{className:"bg-white shadow rounded-lg border border-gray-200",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"File Size Distribution"})}),r.jsx("div",{className:"px-6 py-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-sm",children:"Small (< 1MB)"}),r.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-gray-100 text-gray-800 rounded-full",children:y.fileSizeDistribution.small})]}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-sm",children:"Medium (1MB - 10MB)"}),r.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-gray-100 text-gray-800 rounded-full",children:y.fileSizeDistribution.medium})]}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-sm",children:"Large (> 10MB)"}),r.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-gray-100 text-gray-800 rounded-full",children:y.fileSizeDistribution.large})]})]})})]})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"bg-white shadow rounded-lg border border-gray-200",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Top Error Types"})}),r.jsx("div",{className:"px-6 py-4",children:r.jsx("div",{className:"space-y-3",children:T.topErrorTypes.map((e,s)=>r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-sm truncate",children:e.type}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm font-medium",children:e.count}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",e.percentage.toFixed(1),"%)"]})]})]},s))})})]}),r.jsxs("div",{className:"bg-white shadow rounded-lg border border-gray-200",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Top Error Stages"})}),r.jsx("div",{className:"px-6 py-4",children:r.jsx("div",{className:"space-y-3",children:T.topErrorStages.map((e,s)=>r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-sm truncate",children:e.stage}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-sm font-medium",children:e.count}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",e.percentage.toFixed(1),"%)"]})]})]},s))})})]})]}),w.recentErrors.length>0&&r.jsxs("div",{className:"bg-white shadow rounded-lg border border-gray-200",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Recent Errors"})}),r.jsx("div",{className:"px-6 py-4",children:r.jsx("div",{className:"space-y-3",children:w.recentErrors.slice(0,5).map(e=>r.jsxs("div",{className:"border rounded-lg p-3",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsx("span",{className:"font-medium text-sm",children:e.fileInfo.originalName}),r.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]}),r.jsxs("div",{className:"text-sm text-muted-foreground mb-1",children:["Stage: ",e.stage||"Unknown"]}),e.error&&r.jsx("div",{className:"text-sm text-red-600",children:e.error.message})]},e.id))})})]})]}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"bg-white shadow rounded-lg border border-gray-200",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Processing Time Distribution"})}),r.jsx("div",{className:"px-6 py-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-sm",children:"Fast (< 30s)"}),r.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-gray-100 text-green-600 rounded-full",children:y.processingTimeDistribution.fast})]}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-sm",children:"Normal (30s - 5m)"}),r.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-gray-100 text-blue-600 rounded-full",children:y.processingTimeDistribution.normal})]}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-sm",children:"Slow (> 5m)"}),r.jsx("span",{className:"px-2 py-1 text-xs font-medium bg-gray-100 text-red-600 rounded-full",children:y.processingTimeDistribution.slow})]})]})})]}),r.jsxs("div",{className:"bg-white shadow rounded-lg border border-gray-200",children:[r.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:r.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Performance Metrics"})}),r.jsx("div",{className:"px-6 py-4",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:"Average Processing Time"}),r.jsx("div",{className:"text-2xl font-bold",children:v(y.averageProcessingTime)})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:"Total Processing Time"}),r.jsx("div",{className:"text-2xl font-bold",children:v(y.totalProcessingTime)})]})]})})]})]})})]}),r.jsxs("div",{className:"text-center text-sm text-muted-foreground",children:["Last updated: ",new Date(e.timestamp).toLocaleString()]})]})};export{o as default};