xertica-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.tsx +182 -0
- package/README.md +330 -0
- package/assets/xertica-logo.svg +38 -0
- package/assets/xertica-x-logo.svg +21 -0
- package/bin/cli.ts +193 -0
- package/components/AssistenteXertica.tsx +2003 -0
- package/components/AudioPlayer.tsx +203 -0
- package/components/CodeBlock.tsx +242 -0
- package/components/DocumentEditor.tsx +504 -0
- package/components/ForgotPasswordPage.tsx +170 -0
- package/components/FormattedDocument.tsx +87 -0
- package/components/HomeContent.tsx +123 -0
- package/components/HomePage.tsx +70 -0
- package/components/LanguageSelector.tsx +54 -0
- package/components/LoginPage.tsx +199 -0
- package/components/MarkdownMessage.tsx +62 -0
- package/components/ModernChatInput.tsx +502 -0
- package/components/PodcastPlayer.tsx +409 -0
- package/components/ResetPasswordPage.tsx +234 -0
- package/components/Sidebar.tsx +489 -0
- package/components/TemplateContent.tsx +629 -0
- package/components/TemplatePage.tsx +70 -0
- package/components/ThemeToggle.tsx +65 -0
- package/components/VerifyEmailPage.tsx +187 -0
- package/components/XerticaLogo.tsx +69 -0
- package/components/XerticaOrbe.tsx +1339 -0
- package/components/XerticaXLogo.tsx +53 -0
- package/components/examples/DrawingMapExample.tsx +530 -0
- package/components/examples/FilterableMapExample.tsx +380 -0
- package/components/examples/LocationPickerExample.tsx +330 -0
- package/components/examples/MapExamples.tsx +280 -0
- package/components/examples/MapShowcase.tsx +446 -0
- package/components/examples/RouteMapExamples.tsx +329 -0
- package/components/examples/SimpleFilterableMap.tsx +192 -0
- package/components/examples/index.ts +52 -0
- package/components/figma/ImageWithFallback.tsx +27 -0
- package/components/index.ts +44 -0
- package/components/media/AudioPlayer.tsx +278 -0
- package/components/media/FloatingMediaWrapper.tsx +166 -0
- package/components/media/VideoPlayer.tsx +285 -0
- package/components/ui/accordion.tsx +66 -0
- package/components/ui/alert-dialog.tsx +159 -0
- package/components/ui/alert.tsx +91 -0
- package/components/ui/aspect-ratio.tsx +11 -0
- package/components/ui/avatar.tsx +65 -0
- package/components/ui/badge.tsx +55 -0
- package/components/ui/breadcrumb.tsx +109 -0
- package/components/ui/button.tsx +78 -0
- package/components/ui/calendar.tsx +235 -0
- package/components/ui/card.tsx +92 -0
- package/components/ui/carousel.tsx +241 -0
- package/components/ui/chart.tsx +353 -0
- package/components/ui/checkbox.tsx +32 -0
- package/components/ui/collapsible.tsx +33 -0
- package/components/ui/command.tsx +177 -0
- package/components/ui/context-menu.tsx +252 -0
- package/components/ui/dialog.tsx +138 -0
- package/components/ui/drawer.tsx +134 -0
- package/components/ui/dropdown-menu.tsx +257 -0
- package/components/ui/empty.tsx +90 -0
- package/components/ui/file-upload.tsx +152 -0
- package/components/ui/form.tsx +195 -0
- package/components/ui/google-maps-loader.tsx +379 -0
- package/components/ui/hover-card.tsx +44 -0
- package/components/ui/index.ts +242 -0
- package/components/ui/input-otp.tsx +77 -0
- package/components/ui/input.tsx +38 -0
- package/components/ui/label.tsx +24 -0
- package/components/ui/map-config.ts +12 -0
- package/components/ui/map-layers.tsx +129 -0
- package/components/ui/map.exports.ts +31 -0
- package/components/ui/map.tsx +412 -0
- package/components/ui/menubar.tsx +276 -0
- package/components/ui/navigation-menu.tsx +162 -0
- package/components/ui/notification-badge.tsx +61 -0
- package/components/ui/page-header.tsx +229 -0
- package/components/ui/pagination.tsx +127 -0
- package/components/ui/popover.tsx +48 -0
- package/components/ui/progress.tsx +31 -0
- package/components/ui/radio-group.tsx +56 -0
- package/components/ui/rating.tsx +102 -0
- package/components/ui/resizable.tsx +405 -0
- package/components/ui/route-map.tsx +246 -0
- package/components/ui/scroll-area.tsx +58 -0
- package/components/ui/search.tsx +70 -0
- package/components/ui/select.tsx +176 -0
- package/components/ui/separator.tsx +28 -0
- package/components/ui/sheet.tsx +138 -0
- package/components/ui/sidebar.tsx +726 -0
- package/components/ui/simple-map.tsx +92 -0
- package/components/ui/skeleton.tsx +13 -0
- package/components/ui/slider.tsx +58 -0
- package/components/ui/sonner.tsx +77 -0
- package/components/ui/stats-card.tsx +84 -0
- package/components/ui/stepper.tsx +126 -0
- package/components/ui/switch.tsx +34 -0
- package/components/ui/table.tsx +116 -0
- package/components/ui/tabs.tsx +66 -0
- package/components/ui/textarea.tsx +26 -0
- package/components/ui/timeline.tsx +140 -0
- package/components/ui/toggle-group.tsx +71 -0
- package/components/ui/toggle.tsx +46 -0
- package/components/ui/tooltip.tsx +61 -0
- package/components/ui/tree-view.tsx +123 -0
- package/components/ui/use-mobile.ts +24 -0
- package/components/ui/utils.ts +6 -0
- package/components/ui/xertica-assistant.tsx +1420 -0
- package/contexts/ApiKeyContext.tsx +123 -0
- package/contexts/AssistenteContext.tsx +118 -0
- package/contexts/BrandColorsContext.tsx +551 -0
- package/contexts/LanguageContext.tsx +36 -0
- package/contexts/ThemeContext.tsx +85 -0
- package/dist/cli.js +20922 -0
- package/eslint.config.js +41 -0
- package/guidelines/Guidelines.md +61 -0
- package/hooks/useTheme.ts +4 -0
- package/imports/Podcast.tsx +389 -0
- package/imports/XerticaAi.tsx +46 -0
- package/imports/XerticaX.tsx +20 -0
- package/imports/svg-aueiaqngck.ts +11 -0
- package/imports/svg-v9krss1ozd.ts +16 -0
- package/imports/svg-vhrdofe3qe.ts +5 -0
- package/index.css +4448 -0
- package/index.html +14 -0
- package/main.tsx +10 -0
- package/package.json +119 -0
- package/postcss.config.js +6 -0
- package/routes.tsx +33 -0
- package/styles/globals.css +15 -0
- package/styles/xertica/app-overrides/chat.css +61 -0
- package/styles/xertica/app-overrides/scrollbar.css +33 -0
- package/styles/xertica/base.css +70 -0
- package/styles/xertica/integrations/google-maps.css +76 -0
- package/styles/xertica/integrations/sonner.css +73 -0
- package/styles/xertica/theme-map.css +88 -0
- package/styles/xertica/tokens.css +190 -0
- package/tsconfig.json +31 -0
- package/tsconfig.node.json +10 -0
- package/utils/gemini.ts +140 -0
- package/vite-env.d.ts +12 -0
- package/vite.config.ts +36 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
🎨 TOKENS / VARIABLES
|
|
3
|
+
============================================ */
|
|
4
|
+
|
|
5
|
+
:root,
|
|
6
|
+
:root[data-theme="default"] {
|
|
7
|
+
/* Brand Tokens - Source of Truth */
|
|
8
|
+
--xertica-primary: rgba(44, 39, 91, 1);
|
|
9
|
+
--xertica-dark: rgba(35, 29, 79, 1);
|
|
10
|
+
|
|
11
|
+
/* Semantic Colors */
|
|
12
|
+
--background: rgba(255, 255, 255, 1);
|
|
13
|
+
--foreground: rgba(9, 9, 11, 1);
|
|
14
|
+
|
|
15
|
+
--card: rgba(255, 255, 255, 1);
|
|
16
|
+
--card-foreground: rgba(9, 9, 11, 1);
|
|
17
|
+
|
|
18
|
+
--popover: rgba(255, 255, 255, 1);
|
|
19
|
+
--popover-foreground: rgba(9, 9, 11, 1);
|
|
20
|
+
|
|
21
|
+
--primary: var(--xertica-primary);
|
|
22
|
+
--primary-foreground: rgba(250, 250, 250, 1);
|
|
23
|
+
--primary-light: rgba(44, 39, 91, 0.15);
|
|
24
|
+
--primary-light-foreground: rgba(44, 39, 91, 1);
|
|
25
|
+
|
|
26
|
+
--secondary: rgba(244, 244, 245, 1);
|
|
27
|
+
--secondary-foreground: rgba(24, 24, 27, 1);
|
|
28
|
+
|
|
29
|
+
--muted: rgba(244, 244, 245, 1);
|
|
30
|
+
--muted-foreground: rgba(113, 113, 122, 1);
|
|
31
|
+
|
|
32
|
+
--accent: rgba(244, 244, 245, 1);
|
|
33
|
+
--accent-foreground: rgba(24, 24, 27, 1);
|
|
34
|
+
|
|
35
|
+
--destructive: rgba(239, 68, 68, 1);
|
|
36
|
+
--destructive-foreground: rgba(250, 250, 250, 1);
|
|
37
|
+
|
|
38
|
+
--border: rgba(228, 228, 231, 1);
|
|
39
|
+
--input: rgba(244, 244, 245, 0.5);
|
|
40
|
+
--input-background: rgba(244, 244, 245, 0.5);
|
|
41
|
+
--ring: rgba(161, 161, 170, 1);
|
|
42
|
+
|
|
43
|
+
/* Sidebar */
|
|
44
|
+
--sidebar: rgba(44, 39, 91, 1);
|
|
45
|
+
--sidebar-foreground: rgba(250, 250, 250, 1);
|
|
46
|
+
--sidebar-primary: rgba(255, 255, 255, 1);
|
|
47
|
+
--sidebar-primary-foreground: rgba(9, 9, 11, 1);
|
|
48
|
+
--sidebar-accent: rgba(244, 244, 245, 1);
|
|
49
|
+
--sidebar-accent-foreground: rgba(24, 24, 27, 1);
|
|
50
|
+
--sidebar-border: rgba(65, 61, 107, 1);
|
|
51
|
+
--sidebar-ring: rgba(161, 161, 170, 1);
|
|
52
|
+
|
|
53
|
+
/* Charts */
|
|
54
|
+
--chart-1: rgba(44, 39, 91, 1);
|
|
55
|
+
--chart-2: rgba(5, 150, 105, 1);
|
|
56
|
+
--chart-3: rgba(245, 158, 11, 1);
|
|
57
|
+
--chart-4: rgba(37, 99, 235, 1);
|
|
58
|
+
--chart-5: rgba(239, 68, 68, 1);
|
|
59
|
+
|
|
60
|
+
/* Gradients */
|
|
61
|
+
--gradient-diagonal: linear-gradient(135deg, #FDB0F2 0%, #72CDFD 100%);
|
|
62
|
+
|
|
63
|
+
/* Spacing & Radius */
|
|
64
|
+
--radius: 6px;
|
|
65
|
+
--radius-button: 12px;
|
|
66
|
+
--radius-card: 12px;
|
|
67
|
+
|
|
68
|
+
--elevation-sm: 0px 0px 48px 0px rgba(0, 0, 0, 0.1);
|
|
69
|
+
|
|
70
|
+
/* Typography */
|
|
71
|
+
--font-size: 16px;
|
|
72
|
+
--text-h1: 2rem;
|
|
73
|
+
--text-h2: 1.75rem;
|
|
74
|
+
--text-h3: 1.5rem;
|
|
75
|
+
--text-h4: 1.25rem;
|
|
76
|
+
--text-base: 1rem;
|
|
77
|
+
--text-p: 0.875rem;
|
|
78
|
+
--text-label: 0.875rem;
|
|
79
|
+
--text-small: 0.875rem;
|
|
80
|
+
--text-xs: 0.75rem;
|
|
81
|
+
--text-muted: 0.875rem;
|
|
82
|
+
--text-stats: 2.25rem;
|
|
83
|
+
--text-table-head: 1.25rem;
|
|
84
|
+
|
|
85
|
+
--font-weight-regular: 400;
|
|
86
|
+
--font-weight-medium: 500;
|
|
87
|
+
--font-weight-semibold: 600;
|
|
88
|
+
--font-weight-bold: 700;
|
|
89
|
+
--font-weight-extrabold: 800;
|
|
90
|
+
|
|
91
|
+
--spacing-1: 0.25rem;
|
|
92
|
+
--spacing-2: 0.5rem;
|
|
93
|
+
--spacing-3: 0.75rem;
|
|
94
|
+
--spacing-4: 1rem;
|
|
95
|
+
--spacing-5: 1.25rem;
|
|
96
|
+
--spacing-6: 1.5rem;
|
|
97
|
+
--spacing-8: 2rem;
|
|
98
|
+
|
|
99
|
+
/* Calendar */
|
|
100
|
+
--cell-size: 2.5rem;
|
|
101
|
+
--cell-radius: var(--radius);
|
|
102
|
+
--calendar-caption-size: 15px;
|
|
103
|
+
--calendar-weekday-size: 12px;
|
|
104
|
+
--calendar-day-size: 14px;
|
|
105
|
+
|
|
106
|
+
/* Toast - Success */
|
|
107
|
+
--toast-success-bg: rgba(220, 252, 231, 1);
|
|
108
|
+
--toast-success-border: rgba(5, 150, 105, 1);
|
|
109
|
+
--toast-success-icon: rgba(5, 150, 105, 1);
|
|
110
|
+
/* Toast - Warning */
|
|
111
|
+
--toast-warning-bg: rgba(254, 243, 199, 1);
|
|
112
|
+
--toast-warning-border: rgba(245, 158, 11, 1);
|
|
113
|
+
--toast-warning-icon: rgba(245, 158, 11, 1);
|
|
114
|
+
/* Toast - Info */
|
|
115
|
+
--toast-info-bg: rgba(219, 234, 254, 1);
|
|
116
|
+
--toast-info-border: rgba(37, 99, 235, 1);
|
|
117
|
+
--toast-info-icon: rgba(37, 99, 235, 1);
|
|
118
|
+
/* Toast - Error */
|
|
119
|
+
--toast-error-bg: rgba(254, 226, 226, 1);
|
|
120
|
+
--toast-error-border: rgba(239, 68, 68, 1);
|
|
121
|
+
--toast-error-icon: rgba(239, 68, 68, 1);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
:root[data-mode="dark"],
|
|
125
|
+
.dark {
|
|
126
|
+
/* Brand Tokens */
|
|
127
|
+
--xertica-primary: rgba(44, 39, 91, 1);
|
|
128
|
+
|
|
129
|
+
/* Semantic Colors */
|
|
130
|
+
--background: rgba(5, 5, 5, 1);
|
|
131
|
+
--foreground: rgba(250, 250, 250, 1);
|
|
132
|
+
|
|
133
|
+
--card: rgba(20, 20, 22, 1);
|
|
134
|
+
--card-foreground: rgba(250, 250, 250, 1);
|
|
135
|
+
|
|
136
|
+
--popover: rgba(20, 20, 22, 1);
|
|
137
|
+
--popover-foreground: rgba(250, 250, 250, 1);
|
|
138
|
+
|
|
139
|
+
--primary-foreground: rgba(250, 250, 250, 1);
|
|
140
|
+
--primary-light: rgba(44, 39, 91, 0.15);
|
|
141
|
+
--primary-light-foreground: rgba(44, 39, 91, 1);
|
|
142
|
+
|
|
143
|
+
--secondary: rgba(39, 39, 42, 1);
|
|
144
|
+
--secondary-foreground: rgba(250, 250, 250, 1);
|
|
145
|
+
|
|
146
|
+
--muted: rgba(39, 39, 42, 1);
|
|
147
|
+
--muted-foreground: rgba(161, 161, 170, 1);
|
|
148
|
+
|
|
149
|
+
--accent: rgba(39, 39, 42, 1);
|
|
150
|
+
--accent-foreground: rgba(250, 250, 250, 1);
|
|
151
|
+
|
|
152
|
+
--destructive: rgba(239, 68, 68, 1);
|
|
153
|
+
--destructive-foreground: rgba(250, 250, 250, 1);
|
|
154
|
+
|
|
155
|
+
--border: rgba(63, 63, 70, 1);
|
|
156
|
+
--input: rgba(39, 39, 42, 0.5);
|
|
157
|
+
--input-background: rgba(39, 39, 42, 0.5);
|
|
158
|
+
--ring: rgba(113, 113, 122, 1);
|
|
159
|
+
|
|
160
|
+
--elevation-sm: 0px 0px 48px 0px rgba(0, 0, 0, 0.3);
|
|
161
|
+
|
|
162
|
+
/* Sidebar */
|
|
163
|
+
--sidebar-foreground: rgba(250, 250, 250, 1);
|
|
164
|
+
--sidebar-primary: rgba(255, 255, 255, 1);
|
|
165
|
+
--sidebar-primary-foreground: rgba(9, 9, 11, 1);
|
|
166
|
+
--sidebar-accent: rgba(63, 63, 70, 1);
|
|
167
|
+
--sidebar-accent-foreground: rgba(250, 250, 250, 1);
|
|
168
|
+
--sidebar-border: rgba(65, 61, 107, 1);
|
|
169
|
+
--sidebar-ring: rgba(161, 161, 170, 1);
|
|
170
|
+
|
|
171
|
+
/* Gradients */
|
|
172
|
+
--gradient-diagonal: linear-gradient(135deg, #7B4A7A 0%, #3A5C7D 100%);
|
|
173
|
+
|
|
174
|
+
/* Toast - Success */
|
|
175
|
+
--toast-success-bg: rgba(6, 78, 59, 1);
|
|
176
|
+
--toast-success-border: rgba(34, 197, 94, 1);
|
|
177
|
+
--toast-success-icon: rgba(34, 197, 94, 1);
|
|
178
|
+
/* Toast - Warning */
|
|
179
|
+
--toast-warning-bg: rgba(113, 63, 18, 1);
|
|
180
|
+
--toast-warning-border: rgba(251, 191, 36, 1);
|
|
181
|
+
--toast-warning-icon: rgba(251, 191, 36, 1);
|
|
182
|
+
/* Toast - Info */
|
|
183
|
+
--toast-info-bg: rgba(30, 58, 138, 1);
|
|
184
|
+
--toast-info-border: rgba(96, 165, 250, 1);
|
|
185
|
+
--toast-info-icon: rgba(96, 165, 250, 1);
|
|
186
|
+
/* Toast - Error */
|
|
187
|
+
--toast-error-bg: rgba(127, 29, 29, 1);
|
|
188
|
+
--toast-error-border: rgba(248, 113, 113, 1);
|
|
189
|
+
--toast-error-icon: rgba(248, 113, 113, 1);
|
|
190
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"jsx": "react-jsx",
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": false,
|
|
20
|
+
"noUnusedParameters": false,
|
|
21
|
+
"noFallthroughCasesInSwitch": true,
|
|
22
|
+
|
|
23
|
+
/* Path mapping */
|
|
24
|
+
"baseUrl": ".",
|
|
25
|
+
"paths": {
|
|
26
|
+
"@/*": ["./*"]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"include": ["./**/*.ts", "./**/*.tsx"],
|
|
30
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
31
|
+
}
|
package/utils/gemini.ts
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { GoogleGenerativeAI, GenerativeModel } from "@google/generative-ai";
|
|
2
|
+
|
|
3
|
+
export interface GeminiMessage {
|
|
4
|
+
role: 'user' | 'model';
|
|
5
|
+
parts: { text: string }[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export async function callGeminiAPI(
|
|
9
|
+
apiKey: string,
|
|
10
|
+
message: string,
|
|
11
|
+
conversationHistory: GeminiMessage[] = []
|
|
12
|
+
): Promise<string> {
|
|
13
|
+
try {
|
|
14
|
+
// Inicializar o cliente Gemini
|
|
15
|
+
const genAI = new GoogleGenerativeAI(apiKey);
|
|
16
|
+
|
|
17
|
+
// Obter o modelo gemini-2.0-flash
|
|
18
|
+
const model: GenerativeModel = genAI.getGenerativeModel({
|
|
19
|
+
model: "gemini-2.0-flash",
|
|
20
|
+
generationConfig: {
|
|
21
|
+
temperature: 0.9,
|
|
22
|
+
topK: 40,
|
|
23
|
+
topP: 0.95,
|
|
24
|
+
maxOutputTokens: 2048,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
console.log('Calling Gemini API with:', {
|
|
29
|
+
model: 'gemini-2.0-flash',
|
|
30
|
+
messageLength: message.length,
|
|
31
|
+
historyLength: conversationHistory.length
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
let result;
|
|
35
|
+
|
|
36
|
+
// Se houver histórico, usar chat com contexto
|
|
37
|
+
if (conversationHistory.length > 0) {
|
|
38
|
+
// Criar sessão de chat com histórico
|
|
39
|
+
const chat = model.startChat({
|
|
40
|
+
history: conversationHistory.map(msg => ({
|
|
41
|
+
role: msg.role,
|
|
42
|
+
parts: msg.parts
|
|
43
|
+
})),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Enviar mensagem no contexto do chat
|
|
47
|
+
result = await chat.sendMessage(message);
|
|
48
|
+
} else {
|
|
49
|
+
// Sem histórico, fazer chamada simples
|
|
50
|
+
result = await model.generateContent(message);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Obter o texto da resposta
|
|
54
|
+
const response = result.response;
|
|
55
|
+
const text = response.text();
|
|
56
|
+
|
|
57
|
+
console.log('Gemini API Response:', {
|
|
58
|
+
hasText: !!text,
|
|
59
|
+
textLength: text?.length || 0
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
if (!text || text.trim().length === 0) {
|
|
63
|
+
throw new Error('Resposta vazia recebida da API.');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return text;
|
|
67
|
+
|
|
68
|
+
} catch (error: any) {
|
|
69
|
+
console.error('Error calling Gemini API:', error);
|
|
70
|
+
|
|
71
|
+
// Tratamento de erros específicos da biblioteca
|
|
72
|
+
if (error.message) {
|
|
73
|
+
const errorMsg = error.message.toLowerCase();
|
|
74
|
+
|
|
75
|
+
// Erro de API Key vazada/leaked
|
|
76
|
+
if (errorMsg.includes('leaked') || errorMsg.includes('reported')) {
|
|
77
|
+
throw new Error('🔐 Sua chave de API foi reportada como vazada e foi desativada por segurança. Gere uma nova chave em https://aistudio.google.com/apikey e configure em Configurações.');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Erro de API Key inválida ou expirada
|
|
81
|
+
if (errorMsg.includes('api key') || errorMsg.includes('api_key') || errorMsg.includes('invalid') || errorMsg.includes('expired') || errorMsg.includes('403')) {
|
|
82
|
+
if (errorMsg.includes('expired')) {
|
|
83
|
+
throw new Error('❌ Chave de API expirada. Gere uma nova chave em https://aistudio.google.com/apikey e configure em Configurações.');
|
|
84
|
+
}
|
|
85
|
+
if (errorMsg.includes('403')) {
|
|
86
|
+
throw new Error('🔐 Acesso negado. Sua chave de API pode ter sido desativada. Gere uma nova em https://aistudio.google.com/apikey e configure em Configurações.');
|
|
87
|
+
}
|
|
88
|
+
throw new Error('❌ Chave de API inválida ou sem permissão. Verifique sua chave nas Configurações.');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Erro de modelo não encontrado
|
|
92
|
+
if (errorMsg.includes('not found') || errorMsg.includes('404')) {
|
|
93
|
+
throw new Error('⚠️ Modelo não encontrado. A API pode estar temporariamente indisponível.');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Erro de quota/rate limit
|
|
97
|
+
if (errorMsg.includes('quota') || errorMsg.includes('limit') || errorMsg.includes('429')) {
|
|
98
|
+
throw new Error('⏱️ Limite de requisições excedido. Tente novamente em alguns minutos.');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Erro de bloqueio por segurança
|
|
102
|
+
if (errorMsg.includes('safety') || errorMsg.includes('blocked')) {
|
|
103
|
+
throw new Error('🛡️ A resposta foi bloqueada por filtros de segurança. Tente uma pergunta diferente.');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Erro de rede
|
|
107
|
+
if (errorMsg.includes('fetch') || errorMsg.includes('network')) {
|
|
108
|
+
throw new Error('🌐 Erro de conexão. Verifique sua internet e tente novamente.');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Erro genérico com mensagem específica
|
|
112
|
+
throw new Error(`Erro na API do Gemini: ${error.message}`);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Erro sem mensagem específica
|
|
116
|
+
throw new Error('❌ Erro desconhecido ao processar sua mensagem. Tente novamente.');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function buildSystemPrompt(): string {
|
|
121
|
+
return `Você é o Assistente Xertica, uma IA desenvolvida para ajudar usuários da plataforma Xertica.ai a gerenciar projetos, analisar dados e otimizar processos.
|
|
122
|
+
|
|
123
|
+
Características importantes:
|
|
124
|
+
- Você é prestativo, profissional e direto
|
|
125
|
+
- Responda sempre em português brasileiro
|
|
126
|
+
- Seja conciso mas informativo
|
|
127
|
+
- Quando não souber algo específico da plataforma, seja honesto
|
|
128
|
+
- Foque em ajudar o usuário com suas tarefas e dúvidas
|
|
129
|
+
- Mantenha um tom amigável e acessível
|
|
130
|
+
|
|
131
|
+
A plataforma Xertica.ai oferece:
|
|
132
|
+
- Gerenciamento de projetos e tarefas
|
|
133
|
+
- Análise de dados e métricas
|
|
134
|
+
- Criação de documentos e relatórios
|
|
135
|
+
- Geração de podcasts a partir de conteúdo
|
|
136
|
+
- Sistema de pesquisa integrado
|
|
137
|
+
- Colaboração em equipe
|
|
138
|
+
|
|
139
|
+
Você está aqui para ajudar os usuários a tirar o máximo proveito dessas funcionalidades.`;
|
|
140
|
+
}
|
package/vite-env.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
// Declaração para variáveis de ambiente
|
|
4
|
+
interface ImportMetaEnv {
|
|
5
|
+
readonly VITE_GEMINI_API_KEY?: string;
|
|
6
|
+
readonly VITE_APP_NAME?: string;
|
|
7
|
+
readonly VITE_APP_VERSION?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface ImportMeta {
|
|
11
|
+
readonly env: ImportMetaEnv;
|
|
12
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import react from "@vitejs/plugin-react";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import tailwindcss from "@tailwindcss/postcss";
|
|
5
|
+
import autoprefixer from "autoprefixer";
|
|
6
|
+
|
|
7
|
+
// https://vitejs.dev/config/
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
plugins: [react()],
|
|
10
|
+
css: {
|
|
11
|
+
postcss: {
|
|
12
|
+
plugins: [tailwindcss, autoprefixer],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
resolve: {
|
|
16
|
+
alias: {
|
|
17
|
+
"@": path.resolve(__dirname, "./"),
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
server: {
|
|
21
|
+
port: 3000,
|
|
22
|
+
open: true,
|
|
23
|
+
},
|
|
24
|
+
build: {
|
|
25
|
+
outDir: "dist",
|
|
26
|
+
sourcemap: false,
|
|
27
|
+
rollupOptions: {
|
|
28
|
+
output: {
|
|
29
|
+
manualChunks: {
|
|
30
|
+
vendor: ["react", "react-dom", "react-router"],
|
|
31
|
+
ui: ["lucide-react", "sonner"],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|