alaselababatunde commited on
Commit
253e3ae
·
1 Parent(s): 2f61e8d

Improve UI: Add table support (GFM), professional CSS styling, and refine AI output formatting

Browse files
frontend/package.json CHANGED
@@ -12,7 +12,9 @@
12
  "lucide-react": "^0.395.0",
13
  "react": "^18.3.1",
14
  "react-dom": "^18.3.1",
15
- "react-markdown": "^9.0.1"
 
 
16
  },
17
  "devDependencies": {
18
  "@vitejs/plugin-react": "^4.3.1",
 
12
  "lucide-react": "^0.395.0",
13
  "react": "^18.3.1",
14
  "react-dom": "^18.3.1",
15
+ "react-markdown": "^9.0.1",
16
+ "remark-gfm": "^4.0.0",
17
+ "rehype-raw": "^7.0.0"
18
  },
19
  "devDependencies": {
20
  "@vitejs/plugin-react": "^4.3.1",
frontend/src/App.jsx CHANGED
@@ -1,5 +1,7 @@
1
  import React, { useState, useEffect, useRef } from 'react';
2
  import ReactMarkdown from 'react-markdown';
 
 
3
  import { Send, User, Bot, Loader2 } from 'lucide-react';
4
 
5
  const App = () => {
@@ -124,7 +126,12 @@ const App = () => {
124
  <span></span>
125
  </div>
126
  ) : (
127
- <ReactMarkdown>{msg.content}</ReactMarkdown>
 
 
 
 
 
128
  )}
129
  </div>
130
  </div>
 
1
  import React, { useState, useEffect, useRef } from 'react';
2
  import ReactMarkdown from 'react-markdown';
3
+ import remarkGfm from 'remark-gfm';
4
+ import rehypeRaw from 'rehype-raw';
5
  import { Send, User, Bot, Loader2 } from 'lucide-react';
6
 
7
  const App = () => {
 
126
  <span></span>
127
  </div>
128
  ) : (
129
+ <ReactMarkdown
130
+ remarkPlugins={[remarkGfm]}
131
+ rehypePlugins={[rehypeRaw]}
132
+ >
133
+ {msg.content}
134
+ </ReactMarkdown>
135
  )}
136
  </div>
137
  </div>
frontend/src/index.css CHANGED
@@ -233,6 +233,41 @@ pre {
233
  margin: 1rem 0;
234
  }
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  /* Typing Indicator Animation */
237
  .typing-indicator {
238
  display: flex;
 
233
  margin: 1rem 0;
234
  }
235
 
236
+ /* Table styling */
237
+ .assistant .message-bubble table {
238
+ width: 100%;
239
+ border-collapse: collapse;
240
+ margin: 1rem 0;
241
+ font-size: 0.9rem;
242
+ background: white;
243
+ border-radius: 8px;
244
+ overflow: hidden;
245
+ border: 1px solid var(--border-color);
246
+ }
247
+
248
+ .assistant .message-bubble th {
249
+ background-color: #f8f9fa;
250
+ color: var(--primary);
251
+ font-weight: 600;
252
+ text-align: left;
253
+ padding: 0.75rem;
254
+ border-bottom: 2px solid var(--border-color);
255
+ }
256
+
257
+ .assistant .message-bubble td {
258
+ padding: 0.75rem;
259
+ border-bottom: 1px solid var(--border-color);
260
+ line-height: 1.4;
261
+ }
262
+
263
+ .assistant .message-bubble tr:last-child td {
264
+ border-bottom: none;
265
+ }
266
+
267
+ .assistant .message-bubble tr:hover {
268
+ background-color: #fff9f9;
269
+ }
270
+
271
  /* Typing Indicator Animation */
272
  .typing-indicator {
273
  display: flex;
llm.py CHANGED
@@ -30,6 +30,9 @@ Rules:
30
  - If you still don't know, suggest visiting a UBA branch or calling the official help line.
31
  - Use proper formatting (paragraphs, bullet points) for readability.
32
  - Maintain a helpful and polite tone.
 
 
 
33
  """
34
 
35
  async def get_streaming_response(messages: List[Dict[str, str]]) -> AsyncGenerator[str, None]:
 
30
  - If you still don't know, suggest visiting a UBA branch or calling the official help line.
31
  - Use proper formatting (paragraphs, bullet points) for readability.
32
  - Maintain a helpful and polite tone.
33
+ - When comparing products or listing details, use standard Markdown tables.
34
+ - Use subheadings and bullet points for structured information.
35
+ - Avoid cluttered text; ensure there is adequate whitespace.
36
  """
37
 
38
  async def get_streaming_response(messages: List[Dict[str, str]]) -> AsyncGenerator[str, None]: