Download src/intent.js from KyleAIers/Tina: direct link, hf CLI and curl.
- Browser
- Download file 760 Bytes
-
https://huggingface.co/spaces/KyleAIers/Tina/resolve/main/src/intent.js
- Command line
-
hf download hf://spaces/KyleAIers/Tina/src/intent.js
-
curl -L -o intent.js https://huggingface.co/spaces/KyleAIers/Tina/resolve/main/src/intent.js
760 Bytes
| export const detectIntent = (text) => { | |
| const lower = text.toLowerCase().trim(); | |
| // Explicit keywords | |
| const invTerms = ['inventory', 'stock', 'product', 'items', 'supplies', 'units']; | |
| const salesTerms = ['sales', 'revenue', 'orders', 'earnings', 'performance', 'stat']; | |
| const actionTerms = ['how many', 'show', 'list', 'check', 'total', 'get', 'what', 'view', 'display', 'analyze', 'identify']; | |
| const hasAction = actionTerms.some(a => lower.includes(a)); | |
| const hasInv = invTerms.some(i => lower.includes(i)); | |
| const hasSales = salesTerms.some(s => lower.includes(s)); | |
| if ((hasAction && hasInv) || invTerms.includes(lower)) return 'INVENTORY'; | |
| if ((hasAction && hasSales) || salesTerms.includes(lower)) return 'SALES'; | |
| return 'CHAT'; | |
| }; |