gnokit commited on
Commit
df88931
·
1 Parent(s): f7ffdeb

add validation check on text_input

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -20,8 +20,13 @@ class EggTartAgentUI(GradioUI):
20
  self.description = app_description
21
  self.example_questions = example_questions
22
 
 
 
 
 
23
  def interact_with_agent(self, prompt, messages, session_state):
24
- import gradio as gr
 
25
 
26
  # Get the agent type from the template agent
27
  if "agent" not in session_state:
 
20
  self.description = app_description
21
  self.example_questions = example_questions
22
 
23
+ def validate_question_length(self, question):
24
+ if len(question.strip()) < 20:
25
+ raise gr.Error("Please enter a question with at least 20 characters.")
26
+
27
  def interact_with_agent(self, prompt, messages, session_state):
28
+
29
+ self.validate_question_length(prompt)
30
 
31
  # Get the agent type from the template agent
32
  if "agent" not in session_state: