tlong-ds commited on
Commit
94eba24
·
verified ·
1 Parent(s): eb55cc9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -6
app.py CHANGED
@@ -77,7 +77,7 @@ def respond_to_chat(message, history, state, selected_model):
77
  state["raw_documents"] = raw_documents
78
  state["outputs"] = outputs
79
 
80
- return response
81
 
82
 
83
  def show_specs(state, history=None):
@@ -90,7 +90,11 @@ 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
- 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,7 +188,11 @@ def show_specs(state, history=None):
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):
@@ -222,8 +230,12 @@ def show_advantages(state, history=None):
222
  else:
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):
@@ -256,7 +268,11 @@ def show_solution_packages(state, history=None):
256
 
257
  markdown_content += spec_content + "\n\n"
258
 
259
- return markdown_content
 
 
 
 
260
 
261
 
262
  css = """
@@ -371,6 +387,7 @@ with gr.Blocks(fill_height=True, css=css) as demo:
371
  "https://cdn-icons-png.flaticon.com/512/219/219983.png",
372
  "assets/agent.png"
373
  ],
 
374
  height=800
375
  )
376
 
 
77
  state["raw_documents"] = raw_documents
78
  state["outputs"] = outputs
79
 
80
+ return {"role": "assistant", "content": response}
81
 
82
 
83
  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
  [["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):
 
230
  else:
231
  df = pd.DataFrame([["Không có ưu điểm", ""]], columns=columns)
232
 
233
+ mmarkdown_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):
 
268
 
269
  markdown_content += spec_content + "\n\n"
270
 
271
+ history.append({
272
+ "role": "assistant",
273
+ "content": markdown_content
274
+ })
275
+ return history
276
 
277
 
278
  css = """
 
387
  "https://cdn-icons-png.flaticon.com/512/219/219983.png",
388
  "assets/agent.png"
389
  ],
390
+ type="messages",
391
  height=800
392
  )
393