tlong-ds commited on
Commit
eb55cc9
·
verified ·
1 Parent(s): 23979be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -26
app.py CHANGED
@@ -90,11 +90,7 @@ def show_specs(state, history=None):
90
  if not specs_map:
91
  df = pd.DataFrame({}, columns=columns)
92
  markdown_table = df.to_markdown(index=False)
93
- history.append({
94
- "role": "assistant",
95
- "content": f"📄 Thông số kỹ thuật\n{markdown_table}"
96
- })
97
- return history
98
 
99
  # print(specs_map)
100
  for prod_id, data in specs_map.items():
@@ -188,11 +184,7 @@ def show_specs(state, history=None):
188
  [["Không có thông số kỹ thuật", "", ""]], columns=columns)
189
 
190
  markdown_table = df.to_markdown(index=False)
191
- history.append({
192
- "role": "assistant",
193
- "content": f"📄 Thông số kỹ thuật\n{markdown_table}"
194
- })
195
- return history
196
 
197
 
198
  def show_advantages(state, history=None):
@@ -231,11 +223,7 @@ def show_advantages(state, history=None):
231
  df = pd.DataFrame([["Không có ưu điểm", ""]], columns=columns)
232
 
233
  markdown_table = df.to_markdown(index=False)
234
- history.append({
235
- "role": "assistant",
236
- "content": f"💡 Ưu điểm nổi trội\n{markdown_table}"
237
- })
238
- return history
239
 
240
 
241
  def show_solution_packages(state, history=None):
@@ -258,11 +246,7 @@ def show_solution_packages(state, history=None):
258
  solution_packages[key] = data
259
 
260
  if not solution_packages:
261
- history.append({
262
- "role": "assistant",
263
- "content": "📦 Không có gói sản phẩm nào"
264
- })
265
- return history
266
 
267
  # Build markdown content for each package
268
  markdown_content = "## 📦 Gói sản phẩm\n\n"
@@ -272,11 +256,7 @@ def show_solution_packages(state, history=None):
272
 
273
  markdown_content += spec_content + "\n\n"
274
 
275
- history.append({
276
- "role": "assistant",
277
- "content": markdown_content
278
- })
279
- return history
280
 
281
 
282
  css = """
@@ -391,7 +371,6 @@ with gr.Blocks(fill_height=True, css=css) as demo:
391
  "https://cdn-icons-png.flaticon.com/512/219/219983.png",
392
  "assets/agent.png"
393
  ],
394
- type="messages",
395
  height=800
396
  )
397
 
 
90
  if not specs_map:
91
  df = pd.DataFrame({}, columns=columns)
92
  markdown_table = df.to_markdown(index=False)
93
+ return f"📄 Thông số kỹ thuật\n{markdown_table}"
 
 
 
 
94
 
95
  # print(specs_map)
96
  for prod_id, data in specs_map.items():
 
184
  [["Không có thông số kỹ thuật", "", ""]], columns=columns)
185
 
186
  markdown_table = df.to_markdown(index=False)
187
+ return f"📄 Thông số kỹ thuật\n{markdown_table}"
 
 
 
 
188
 
189
 
190
  def show_advantages(state, history=None):
 
223
  df = pd.DataFrame([["Không có ưu điểm", ""]], columns=columns)
224
 
225
  markdown_table = df.to_markdown(index=False)
226
+ return f"💡 Ưu điểm nổi trội\n{markdown_table}"
 
 
 
 
227
 
228
 
229
  def show_solution_packages(state, history=None):
 
246
  solution_packages[key] = data
247
 
248
  if not solution_packages:
249
+ return "📦 Không có gói sản phẩm nào"
 
 
 
 
250
 
251
  # Build markdown content for each package
252
  markdown_content = "## 📦 Gói sản phẩm\n\n"
 
256
 
257
  markdown_content += spec_content + "\n\n"
258
 
259
+ return markdown_content
 
 
 
 
260
 
261
 
262
  css = """
 
371
  "https://cdn-icons-png.flaticon.com/512/219/219983.png",
372
  "assets/agent.png"
373
  ],
 
374
  height=800
375
  )
376