vinhnx90 commited on
Commit
bbf4421
·
1 Parent(s): e1b4f2a

Update commit

Browse files
Files changed (2) hide show
  1. src/ui/app.py +56 -52
  2. src/ui/components.py +9 -0
src/ui/app.py CHANGED
@@ -70,23 +70,25 @@ def create_app() -> gr.Blocks:
70
 
71
  /* Ensure proper text and background contrast */
72
  body,
73
- .gradio-container,
 
 
 
74
  .dark .gradio-container,
75
  .light .gradio-container {
76
- color: #1f2937 !important;
77
- background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
78
  }
79
 
80
  /* Header section - enhanced styling */
81
  .header-container {
82
  text-align: center;
83
  padding: 2.5rem 1rem;
84
- background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
85
- color: #1f2937 !important;
86
  border-radius: 12px;
87
  margin-bottom: 2.5rem;
88
- border: 1px solid #e2e8f0;
89
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
90
  position: relative;
91
  overflow: hidden;
92
  }
@@ -113,24 +115,23 @@ def create_app() -> gr.Blocks:
113
  margin: 0 0 0.5rem 0;
114
  font-size: 2.25rem;
115
  font-weight: 700;
116
- color: #1e293b !important;
117
- background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
118
  -webkit-background-clip: text;
119
  -webkit-text-fill-color: transparent;
120
  background-clip: text;
121
- text-fill-color: transparent;
122
  }
123
 
124
  .header-container p {
125
  margin: 0.25rem 0;
126
  font-size: 1.1rem;
127
- color: #475569 !important;
128
  font-weight: 400;
129
  }
130
 
131
  .header-subtitle {
132
  font-size: 1rem;
133
- color: #64748b !important;
134
  margin-top: 0.75rem;
135
  }
136
 
@@ -142,17 +143,17 @@ def create_app() -> gr.Blocks:
142
  /* Tool section */
143
  .tool-section {
144
  padding: 2rem;
145
- background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
146
  border-radius: 12px;
147
- border: 1px solid #e2e8f0;
148
  margin-bottom: 1.5rem;
149
  transition: all 0.3s ease;
150
- box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
151
  }
152
 
153
  .tool-section:hover {
154
- border-color: #c7d2fe;
155
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
156
  transform: translateY(-2px);
157
  }
158
 
@@ -160,11 +161,11 @@ def create_app() -> gr.Blocks:
160
  margin: 0 0 0.75rem 0;
161
  font-size: 1.375rem;
162
  font-weight: 600;
163
- color: #1e293b !important;
164
  }
165
 
166
  .tool-description {
167
- color: #475569 !important;
168
  font-size: 1rem;
169
  margin-bottom: 1.25rem;
170
  line-height: 1.6;
@@ -172,46 +173,47 @@ def create_app() -> gr.Blocks:
172
 
173
  /* Output box */
174
  .output-box {
175
- background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
176
  padding: 1.5rem;
177
  border-radius: 8px;
178
- border-left: 4px solid #c7d2fe;
179
- border: 1px solid #e2e8f0;
180
  margin-top: 1.25rem;
181
  line-height: 1.7;
182
- box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.03);
 
183
  }
184
 
185
  .output-box h1,
186
  .output-box h2,
187
  .output-box h3 {
188
- color: #1e293b !important;
189
  margin-top: 1.25rem;
190
  margin-bottom: 0.75rem;
191
  }
192
 
193
  .output-box h1 {
194
- border-bottom: 1px solid #e2e8f0;
195
  padding-bottom: 0.75rem;
196
  }
197
 
198
  /* Success and error states */
199
  .success {
200
- color: #059669 !important;
201
  }
202
 
203
  .error {
204
- color: #dc2626 !important;
205
  }
206
 
207
  .warning {
208
- color: #d97706 !important;
209
  }
210
 
211
  /* Input labels */
212
  .input-label {
213
  font-weight: 500;
214
- color: #334155 !important;
215
  margin-bottom: 0.5rem;
216
  font-size: 1rem;
217
  }
@@ -243,11 +245,12 @@ def create_app() -> gr.Blocks:
243
 
244
  /* Examples section */
245
  .examples-section {
246
- background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%) !important;
247
  border-radius: 8px;
248
  padding: 1rem;
249
  margin-top: 1.25rem;
250
- border: 1px solid #cbd5e1;
 
251
  }
252
 
253
  /* About section */
@@ -255,10 +258,11 @@ def create_app() -> gr.Blocks:
255
  max-width: 900px;
256
  margin: 0 auto;
257
  padding: 2rem;
 
258
  }
259
 
260
  .about-container h2 {
261
- color: #1e293b !important;
262
  margin-top: 1.5rem;
263
  margin-bottom: 1rem;
264
  font-weight: 700;
@@ -273,30 +277,30 @@ def create_app() -> gr.Blocks:
273
  }
274
 
275
  .feature-card {
276
- background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
277
  padding: 1.5rem;
278
  border-radius: 10px;
279
- border: 1px solid #e2e8f0;
280
  transition: all 0.3s ease;
281
- box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
282
  }
283
 
284
  .feature-card:hover {
285
- border-color: #c7d2fe;
286
- box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
287
  transform: translateY(-3px);
288
  }
289
 
290
  .feature-card h3 {
291
  margin: 0 0 0.75rem 0;
292
- color: #1e293b !important;
293
  font-size: 1.125rem;
294
  font-weight: 600;
295
  }
296
 
297
  .feature-card p {
298
  margin: 0;
299
- color: #475569 !important;
300
  font-size: 0.9rem;
301
  line-height: 1.5;
302
  }
@@ -314,31 +318,31 @@ def create_app() -> gr.Blocks:
314
  /* Markdown improvements */
315
  .gr-markdown {
316
  line-height: 1.7;
317
- color: #1e293b !important;
318
  }
319
 
320
  .gr-markdown strong {
321
  font-weight: 600;
322
- color: #1e293b !important;
323
  }
324
 
325
  .gr-markdown code {
326
- background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%) !important;
327
  padding: 0.2rem 0.4rem;
328
  border-radius: 4px;
329
  font-family: 'Courier New', monospace;
330
  font-size: 0.9rem;
331
- color: #475569 !important;
332
- border: 1px solid #cbd5e1;
333
  }
334
 
335
  .gr-markdown pre code {
336
- background: #1e293b !important;
337
- color: #f8fafc !important;
338
  padding: 1rem;
339
  border-radius: 6px;
340
  overflow-x: auto;
341
- border: none;
342
  }
343
 
344
  /* Form spacing */
@@ -349,9 +353,9 @@ def create_app() -> gr.Blocks:
349
  /* Input and textbox styles */
350
  .gr-input,
351
  .gr-textbox {
352
- background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
353
- color: #1e293b !important;
354
- border: 1px solid #cbd5e1 !important;
355
  border-radius: 8px;
356
  padding: 0.625rem !important;
357
  transition: all 0.2s ease;
@@ -359,8 +363,8 @@ def create_app() -> gr.Blocks:
359
 
360
  .gr-input:focus,
361
  .gr-textbox:focus {
362
- border-color: #93c5fd !important;
363
- box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.2) !important;
364
  }
365
 
366
  /* Responsive adjustments */
 
70
 
71
  /* Ensure proper text and background contrast */
72
  body,
73
+ .gradio-container {
74
+ color: #f8fafc !important;
75
+ }
76
+
77
  .dark .gradio-container,
78
  .light .gradio-container {
79
+ color: #f8fafc !important;
 
80
  }
81
 
82
  /* Header section - enhanced styling */
83
  .header-container {
84
  text-align: center;
85
  padding: 2.5rem 1rem;
86
+ background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
87
+ color: #f8fafc !important;
88
  border-radius: 12px;
89
  margin-bottom: 2.5rem;
90
+ border: 1px solid #334155;
91
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
92
  position: relative;
93
  overflow: hidden;
94
  }
 
115
  margin: 0 0 0.5rem 0;
116
  font-size: 2.25rem;
117
  font-weight: 700;
118
+ color: #ffffff !important;
119
+ background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
120
  -webkit-background-clip: text;
121
  -webkit-text-fill-color: transparent;
122
  background-clip: text;
 
123
  }
124
 
125
  .header-container p {
126
  margin: 0.25rem 0;
127
  font-size: 1.1rem;
128
+ color: #cbd5e1 !important;
129
  font-weight: 400;
130
  }
131
 
132
  .header-subtitle {
133
  font-size: 1rem;
134
+ color: #cbd5e1 !important;
135
  margin-top: 0.75rem;
136
  }
137
 
 
143
  /* Tool section */
144
  .tool-section {
145
  padding: 2rem;
146
+ background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
147
  border-radius: 12px;
148
+ border: 1px solid #334155;
149
  margin-bottom: 1.5rem;
150
  transition: all 0.3s ease;
151
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.2);
152
  }
153
 
154
  .tool-section:hover {
155
+ border-color: #3b82f6;
156
+ box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
157
  transform: translateY(-2px);
158
  }
159
 
 
161
  margin: 0 0 0.75rem 0;
162
  font-size: 1.375rem;
163
  font-weight: 600;
164
+ color: #ffffff !important;
165
  }
166
 
167
  .tool-description {
168
+ color: #cbd5e1 !important;
169
  font-size: 1rem;
170
  margin-bottom: 1.25rem;
171
  line-height: 1.6;
 
173
 
174
  /* Output box */
175
  .output-box {
176
+ background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
177
  padding: 1.5rem;
178
  border-radius: 8px;
179
+ border-left: 4px solid #3b82f6;
180
+ border: 1px solid #334155;
181
  margin-top: 1.25rem;
182
  line-height: 1.7;
183
+ color: #e2e8f0 !important;
184
+ box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.3);
185
  }
186
 
187
  .output-box h1,
188
  .output-box h2,
189
  .output-box h3 {
190
+ color: #ffffff !important;
191
  margin-top: 1.25rem;
192
  margin-bottom: 0.75rem;
193
  }
194
 
195
  .output-box h1 {
196
+ border-bottom: 1px solid #334155;
197
  padding-bottom: 0.75rem;
198
  }
199
 
200
  /* Success and error states */
201
  .success {
202
+ color: #10b981 !important;
203
  }
204
 
205
  .error {
206
+ color: #ef4444 !important;
207
  }
208
 
209
  .warning {
210
+ color: #f59e0b !important;
211
  }
212
 
213
  /* Input labels */
214
  .input-label {
215
  font-weight: 500;
216
+ color: #e2e8f0 !important;
217
  margin-bottom: 0.5rem;
218
  font-size: 1rem;
219
  }
 
245
 
246
  /* Examples section */
247
  .examples-section {
248
+ background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
249
  border-radius: 8px;
250
  padding: 1rem;
251
  margin-top: 1.25rem;
252
+ border: 1px solid #334155;
253
+ color: #cbd5e1 !important;
254
  }
255
 
256
  /* About section */
 
258
  max-width: 900px;
259
  margin: 0 auto;
260
  padding: 2rem;
261
+ color: #e2e8f0 !important;
262
  }
263
 
264
  .about-container h2 {
265
+ color: #ffffff !important;
266
  margin-top: 1.5rem;
267
  margin-bottom: 1rem;
268
  font-weight: 700;
 
277
  }
278
 
279
  .feature-card {
280
+ background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
281
  padding: 1.5rem;
282
  border-radius: 10px;
283
+ border: 1px solid #334155;
284
  transition: all 0.3s ease;
285
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
286
  }
287
 
288
  .feature-card:hover {
289
+ border-color: #3b82f6;
290
+ box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
291
  transform: translateY(-3px);
292
  }
293
 
294
  .feature-card h3 {
295
  margin: 0 0 0.75rem 0;
296
+ color: #ffffff !important;
297
  font-size: 1.125rem;
298
  font-weight: 600;
299
  }
300
 
301
  .feature-card p {
302
  margin: 0;
303
+ color: #cbd5e1 !important;
304
  font-size: 0.9rem;
305
  line-height: 1.5;
306
  }
 
318
  /* Markdown improvements */
319
  .gr-markdown {
320
  line-height: 1.7;
321
+ color: #e2e8f0 !important;
322
  }
323
 
324
  .gr-markdown strong {
325
  font-weight: 600;
326
+ color: #ffffff !important;
327
  }
328
 
329
  .gr-markdown code {
330
+ background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
331
  padding: 0.2rem 0.4rem;
332
  border-radius: 4px;
333
  font-family: 'Courier New', monospace;
334
  font-size: 0.9rem;
335
+ color: #60a5fa !important;
336
+ border: 1px solid #334155;
337
  }
338
 
339
  .gr-markdown pre code {
340
+ background: #0f172a !important;
341
+ color: #e2e8f0 !important;
342
  padding: 1rem;
343
  border-radius: 6px;
344
  overflow-x: auto;
345
+ border: 1px solid #334155;
346
  }
347
 
348
  /* Form spacing */
 
353
  /* Input and textbox styles */
354
  .gr-input,
355
  .gr-textbox {
356
+ background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
357
+ color: #e2e8f0 !important;
358
+ border: 1px solid #334155 !important;
359
  border-radius: 8px;
360
  padding: 0.625rem !important;
361
  transition: all 0.2s ease;
 
363
 
364
  .gr-input:focus,
365
  .gr-textbox:focus {
366
+ border-color: #3b82f6 !important;
367
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
368
  }
369
 
370
  /* Responsive adjustments */
src/ui/components.py CHANGED
@@ -96,6 +96,9 @@ class ToolCallHandler:
96
  Returns:
97
  Formatted markdown string for UI display
98
  """
 
 
 
99
  # Validate input
100
  if not product_name or not isinstance(product_name, str):
101
  return "**Error: Product name is required and must be text**"
@@ -307,6 +310,9 @@ class ToolCallHandler:
307
  Returns:
308
  Formatted markdown string with pricing strategy
309
  """
 
 
 
310
  # Validate inputs
311
  if not product_name or not isinstance(product_name, str):
312
  return "**Error: Product name is required and must be text**"
@@ -400,6 +406,9 @@ class ToolCallHandler:
400
  Returns:
401
  Formatted markdown string with competitive analysis
402
  """
 
 
 
403
  # Validate product name
404
  if not product_name or not isinstance(product_name, str):
405
  return "**Error: Product name is required and must be text**"
 
96
  Returns:
97
  Formatted markdown string for UI display
98
  """
99
+ # Ensure category has a value to avoid "referenced before assignment" errors
100
+ category = category or "general"
101
+
102
  # Validate input
103
  if not product_name or not isinstance(product_name, str):
104
  return "**Error: Product name is required and must be text**"
 
310
  Returns:
311
  Formatted markdown string with pricing strategy
312
  """
313
+ # Ensure category has a value to avoid "referenced before assignment" errors
314
+ category = category or "general"
315
+
316
  # Validate inputs
317
  if not product_name or not isinstance(product_name, str):
318
  return "**Error: Product name is required and must be text**"
 
406
  Returns:
407
  Formatted markdown string with competitive analysis
408
  """
409
+ # Ensure category has a value to avoid "referenced before assignment" errors
410
+ category = category or "general"
411
+
412
  # Validate product name
413
  if not product_name or not isinstance(product_name, str):
414
  return "**Error: Product name is required and must be text**"