fCola commited on
Commit
010a2a3
·
verified ·
1 Parent(s): 2291ffa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -528,6 +528,9 @@ def send_message(message, history):
528
  partial = ""
529
  idx = 0
530
  cleared = False
 
 
 
531
 
532
  for t in response_generator:
533
  if idx <= 3:
@@ -538,9 +541,9 @@ def send_message(message, history):
538
  # Quando arriva il primo token utile, svuota la textbox
539
  if not cleared:
540
  cleared = True
541
- yield gr.update(value=""), history + [{"role": "assistant", "content": partial}], gr.update(value="```json\n" + json.dumps(context, indent=2) + "\n```")
542
  else:
543
- yield "", history + [{"role": "assistant", "content": partial}], gr.update(value="```json\n" + json.dumps(context, indent=2) + "\n```")
544
 
545
 
546
  # Create the dashboard
 
528
  partial = ""
529
  idx = 0
530
  cleared = False
531
+
532
+ if len(context) > 1000:
533
+ context = context[:1000] + "[...]"
534
 
535
  for t in response_generator:
536
  if idx <= 3:
 
541
  # Quando arriva il primo token utile, svuota la textbox
542
  if not cleared:
543
  cleared = True
544
+ yield gr.update(value=""), history + [{"role": "assistant", "content": partial}], gr.update(value=context)
545
  else:
546
+ yield "", history + [{"role": "assistant", "content": partial}], gr.update(value=context)
547
 
548
 
549
  # Create the dashboard