From 5bd481375386004e3d660cbe080e2c27bcf47cf2 Mon Sep 17 00:00:00 2001 From: Andres Ballares Date: Sun, 14 Jun 2026 12:16:23 -0400 Subject: [PATCH 1/3] Configure Vite dev server port and add Groq API key --- package-lock.json | 14 -------------- vite.config.js | 3 +++ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index a80ea36..caf6077 100644 --- a/package-lock.json +++ b/package-lock.json @@ -74,7 +74,6 @@ "integrity": "sha512-H3mcG6ZDLTlYfaSNi0iOKkigqMFvkTKlGUYlD8GW7nNOYRrevuA46iTypPyv+06V3fEmvvazfntkBU34L0azAw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/code-frame": "^7.28.6", "@babel/generator": "^7.28.6", @@ -1573,7 +1572,6 @@ "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.10.tgz", "integrity": "sha512-WPigyYuGhgZ/cTPRXB2EwUw+XvsRA3GqHlsP4qteqrnnjDrApbS7MxcGr/hke5iUoeB7E/gQtrs9I37zAJ0Vjw==", "license": "MIT", - "peer": true, "dependencies": { "csstype": "^3.2.2" } @@ -1639,7 +1637,6 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -1864,7 +1861,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -2370,7 +2366,6 @@ "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -3186,7 +3181,6 @@ "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", "dev": true, "license": "MIT", - "peer": true, "bin": { "jiti": "bin/jiti.js" } @@ -4303,7 +4297,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -4503,7 +4496,6 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==", "license": "MIT", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -4513,7 +4505,6 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz", "integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==", "license": "MIT", - "peer": true, "dependencies": { "scheduler": "^0.27.0" }, @@ -4928,7 +4919,6 @@ "integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", @@ -5025,7 +5015,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -5267,7 +5256,6 @@ "integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.27.0", "fdir": "^6.5.0", @@ -5361,7 +5349,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -5446,7 +5433,6 @@ "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", "dev": true, "license": "MIT", - "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/vite.config.js b/vite.config.js index 8b0f57b..49ffa96 100644 --- a/vite.config.js +++ b/vite.config.js @@ -4,4 +4,7 @@ import react from '@vitejs/plugin-react' // https://vite.dev/config/ export default defineConfig({ plugins: [react()], + server: { + port: 3000, + }, }) From 9d0d39a88036e8c71ea9c7cfa09ebaac04330382 Mon Sep 17 00:00:00 2001 From: Andres Ballares Date: Sun, 14 Jun 2026 12:30:23 -0400 Subject: [PATCH 2/3] changed category distribution name from unknowm to contact customer --- src/pages/AnalyzePage.jsx | 7 ++++--- src/pages/DashboardPage.jsx | 7 ++++++- src/pages/HistoryPage.jsx | 14 ++++++++++---- src/pages/HomePage.jsx | 9 +++++++-- src/utils/llmHelper.js | 2 +- src/utils/templates.js | 6 +++++- 6 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/pages/AnalyzePage.jsx b/src/pages/AnalyzePage.jsx index 64517d7..2c71cbe 100644 --- a/src/pages/AnalyzePage.jsx +++ b/src/pages/AnalyzePage.jsx @@ -2,7 +2,7 @@ import { useState, useEffect } from 'react' import ReactMarkdown from 'react-markdown' import { categorizeMessage } from '../utils/llmHelper' import { calculateUrgency } from '../utils/urgencyScorer' -import { getRecommendedAction } from '../utils/templates' +import { getRecommendedAction, normalizeCategory } from '../utils/templates' function AnalyzePage() { const [message, setMessage] = useState('') @@ -30,16 +30,17 @@ function AnalyzePage() { try { // Run categorization (LLM call) const { category, reasoning } = await categorizeMessage(message) + const normalizedCategory = normalizeCategory(category) // Calculate urgency (rule-based) const urgency = calculateUrgency(message) // Get recommended action (template-based) - const recommendedAction = getRecommendedAction(category) + const recommendedAction = getRecommendedAction(normalizedCategory) const analysisResult = { message, - category, + category: normalizedCategory, urgency, recommendedAction, reasoning, diff --git a/src/pages/DashboardPage.jsx b/src/pages/DashboardPage.jsx index a00f086..6088a74 100644 --- a/src/pages/DashboardPage.jsx +++ b/src/pages/DashboardPage.jsx @@ -1,4 +1,5 @@ import { useState, useEffect } from 'react' +import { normalizeCategory } from '../utils/templates' function DashboardPage() { const [stats, setStats] = useState({ @@ -15,7 +16,11 @@ function DashboardPage() { }, []) const loadDashboardData = () => { - const history = JSON.parse(localStorage.getItem('triageHistory') || '[]') + const history = JSON.parse(localStorage.getItem('triageHistory') || '[]').map(item => ({ + ...item, + category: normalizeCategory(item.category) + })) + localStorage.setItem('triageHistory', JSON.stringify(history)) const today = new Date().toDateString() const todayMessages = history.filter(item => new Date(item.timestamp).toDateString() === today diff --git a/src/pages/HistoryPage.jsx b/src/pages/HistoryPage.jsx index 7411eb0..bd593f9 100644 --- a/src/pages/HistoryPage.jsx +++ b/src/pages/HistoryPage.jsx @@ -1,5 +1,6 @@ import { useState, useEffect } from 'react' import ReactMarkdown from 'react-markdown' +import { normalizeCategory } from '../utils/templates' function HistoryPage() { const [history, setHistory] = useState([]) @@ -12,7 +13,12 @@ function HistoryPage() { const loadHistory = () => { const savedHistory = JSON.parse(localStorage.getItem('triageHistory') || '[]') - setHistory(savedHistory) + const normalizedHistory = savedHistory.map(item => ({ + ...item, + category: normalizeCategory(item.category) + })) + setHistory(normalizedHistory) + localStorage.setItem('triageHistory', JSON.stringify(normalizedHistory)) } const clearHistory = () => { @@ -28,9 +34,9 @@ function HistoryPage() { const filteredHistory = filter === 'all' ? sortedHistory - : sortedHistory.filter(item => item.category === filter) + : sortedHistory.filter(item => normalizeCategory(item.category) === filter) - const categories = [...new Set(history.map(item => item.category))] + const categories = [...new Set(history.map(item => normalizeCategory(item.category)))] return (
@@ -118,7 +124,7 @@ function HistoryPage() {
- {item.category} + {normalizeCategory(item.category)} { // Load stats from localStorage - const history = JSON.parse(localStorage.getItem('triageHistory') || '[]') + const history = JSON.parse(localStorage.getItem('triageHistory') || '[]').map(item => ({ + ...item, + category: normalizeCategory(item.category) + })) + localStorage.setItem('triageHistory', JSON.stringify(history)) const today = new Date().toDateString() const todayCount = history.filter(item => new Date(item.timestamp).toDateString() === today @@ -109,7 +114,7 @@ function HomePage() {
- {item.category} + {normalizeCategory(item.category)} Date: Sun, 14 Jun 2026 12:49:49 -0400 Subject: [PATCH 3/3] Set Contact Customer urgency to High --- src/pages/AnalyzePage.jsx | 4 ++-- src/pages/DashboardPage.jsx | 4 +++- src/pages/HistoryPage.jsx | 4 +++- src/pages/HomePage.jsx | 4 +++- src/utils/urgencyScorer.js | 4 ++++ 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/pages/AnalyzePage.jsx b/src/pages/AnalyzePage.jsx index 2c71cbe..b3a7e9d 100644 --- a/src/pages/AnalyzePage.jsx +++ b/src/pages/AnalyzePage.jsx @@ -1,7 +1,7 @@ import { useState, useEffect } from 'react' import ReactMarkdown from 'react-markdown' import { categorizeMessage } from '../utils/llmHelper' -import { calculateUrgency } from '../utils/urgencyScorer' +import { calculateUrgency, normalizeUrgency } from '../utils/urgencyScorer' import { getRecommendedAction, normalizeCategory } from '../utils/templates' function AnalyzePage() { @@ -33,7 +33,7 @@ function AnalyzePage() { const normalizedCategory = normalizeCategory(category) // Calculate urgency (rule-based) - const urgency = calculateUrgency(message) + const urgency = normalizeUrgency(normalizedCategory, calculateUrgency(message)) // Get recommended action (template-based) const recommendedAction = getRecommendedAction(normalizedCategory) diff --git a/src/pages/DashboardPage.jsx b/src/pages/DashboardPage.jsx index 6088a74..15c6951 100644 --- a/src/pages/DashboardPage.jsx +++ b/src/pages/DashboardPage.jsx @@ -1,5 +1,6 @@ import { useState, useEffect } from 'react' import { normalizeCategory } from '../utils/templates' +import { normalizeUrgency } from '../utils/urgencyScorer' function DashboardPage() { const [stats, setStats] = useState({ @@ -18,7 +19,8 @@ function DashboardPage() { const loadDashboardData = () => { const history = JSON.parse(localStorage.getItem('triageHistory') || '[]').map(item => ({ ...item, - category: normalizeCategory(item.category) + category: normalizeCategory(item.category), + urgency: normalizeUrgency(normalizeCategory(item.category), item.urgency) })) localStorage.setItem('triageHistory', JSON.stringify(history)) const today = new Date().toDateString() diff --git a/src/pages/HistoryPage.jsx b/src/pages/HistoryPage.jsx index bd593f9..051f97d 100644 --- a/src/pages/HistoryPage.jsx +++ b/src/pages/HistoryPage.jsx @@ -1,6 +1,7 @@ import { useState, useEffect } from 'react' import ReactMarkdown from 'react-markdown' import { normalizeCategory } from '../utils/templates' +import { normalizeUrgency } from '../utils/urgencyScorer' function HistoryPage() { const [history, setHistory] = useState([]) @@ -15,7 +16,8 @@ function HistoryPage() { const savedHistory = JSON.parse(localStorage.getItem('triageHistory') || '[]') const normalizedHistory = savedHistory.map(item => ({ ...item, - category: normalizeCategory(item.category) + category: normalizeCategory(item.category), + urgency: normalizeUrgency(normalizeCategory(item.category), item.urgency) })) setHistory(normalizedHistory) localStorage.setItem('triageHistory', JSON.stringify(normalizedHistory)) diff --git a/src/pages/HomePage.jsx b/src/pages/HomePage.jsx index 0b4bc77..fba5ddc 100644 --- a/src/pages/HomePage.jsx +++ b/src/pages/HomePage.jsx @@ -1,6 +1,7 @@ import { Link } from 'react-router-dom' import { useEffect, useState } from 'react' import { normalizeCategory } from '../utils/templates' +import { normalizeUrgency } from '../utils/urgencyScorer' function HomePage() { const [stats, setStats] = useState({ total: 0, today: 0 }) @@ -10,7 +11,8 @@ function HomePage() { // Load stats from localStorage const history = JSON.parse(localStorage.getItem('triageHistory') || '[]').map(item => ({ ...item, - category: normalizeCategory(item.category) + category: normalizeCategory(item.category), + urgency: normalizeUrgency(normalizeCategory(item.category), item.urgency) })) localStorage.setItem('triageHistory', JSON.stringify(history)) const today = new Date().toDateString() diff --git a/src/utils/urgencyScorer.js b/src/utils/urgencyScorer.js index 7af6b01..fd06698 100644 --- a/src/utils/urgencyScorer.js +++ b/src/utils/urgencyScorer.js @@ -39,3 +39,7 @@ export function calculateUrgency(message) { if (urgencyScore < 30) return "Low" return "Medium" } + +export function normalizeUrgency(category, urgency) { + return category === 'Contact Customer' ? 'High' : urgency +}