Jeremy Live commited on
Commit
01f6487
·
1 Parent(s): e7f3f46

fix exception & paramer chatbot

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -575,13 +575,8 @@ async def stream_agent_response(question: str, chat_history: List) -> List[Dict]
575
 
576
  except Exception as e:
577
  error_msg = f"## ❌ Error\n\nOcurrió un error al procesar tu solicitud:\n\n```\n{str(e)}\n```"
578
- if "assistant_message" in locals():
579
- assistant_message["content"] = error_msg
580
- else:
581
- assistant_message = {"role": "assistant", "content": error_msg}
582
-
583
  logger.error(f"Error in stream_agent_response: {str(e)}", exc_info=True)
584
- return [assistant_message]
585
 
586
  # Custom CSS for the app
587
  custom_css = """
@@ -692,7 +687,9 @@ def create_ui():
692
  height=600,
693
  render_markdown=True, # Enable markdown rendering
694
  show_label=False,
695
- show_share_button=False
 
 
696
  )
697
 
698
  # Input area
 
575
 
576
  except Exception as e:
577
  error_msg = f"## ❌ Error\n\nOcurrió un error al procesar tu solicitud:\n\n```\n{str(e)}\n```"
 
 
 
 
 
578
  logger.error(f"Error in stream_agent_response: {str(e)}", exc_info=True)
579
+ return [(None, error_msg)]
580
 
581
  # Custom CSS for the app
582
  custom_css = """
 
687
  height=600,
688
  render_markdown=True, # Enable markdown rendering
689
  show_label=False,
690
+ show_share_button=False,
691
+ container=True,
692
+ layout="panel" # Better layout for messages
693
  )
694
 
695
  # Input area