Anne31415 commited on
Commit
9deba2d
·
1 Parent(s): 0272cf0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -3
app.py CHANGED
@@ -92,10 +92,30 @@ def display_chat_history(chat_history):
92
  background_color = "#ffeecf" if chat[2] == "new" else "#ffeecf" if chat[0] == "User" else "#ffeecf"
93
  st.markdown(f"<div style='background-color: {background_color}; padding: 10px; border-radius: 10px; margin: 10px;'>{chat[0]}: {chat[1]}</div>", unsafe_allow_html=True)
94
 
 
95
  def handle_no_answer(response):
96
- if response.strip().lower() in ["i don't know", "i am not sure", ""]:
97
- # Return a more engaging response
98
- return "Hmm, that's a tough one. I might not have all the answers, but let's try exploring this together. Can you provide more details or ask a different question?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  return response
100
 
101
 
 
92
  background_color = "#ffeecf" if chat[2] == "new" else "#ffeecf" if chat[0] == "User" else "#ffeecf"
93
  st.markdown(f"<div style='background-color: {background_color}; padding: 10px; border-radius: 10px; margin: 10px;'>{chat[0]}: {chat[1]}</div>", unsafe_allow_html=True)
94
 
95
+
96
  def handle_no_answer(response):
97
+ no_answer_phrases = [
98
+ "ich weiß es nicht",
99
+ "ich weis es nicht",
100
+ "ich bin mir nicht sicher",
101
+ "es wird nicht erwähnt",
102
+ "keine Information",
103
+ "das ist unklar",
104
+ "da habe ich keine Antwort",
105
+ "das kann ich nicht beantworten"
106
+ "I do not have enough context"
107
+ "I don't know",
108
+ "I am not sure",
109
+ "It is not mentioned",
110
+ "No information",
111
+ "That's unclear",
112
+ "I have no answer to that"
113
+ # Add more phrases as you find them
114
+ ]
115
+
116
+ # Check if response matches any phrase in no_answer_phrases
117
+ if any(phrase in response.lower() for phrase in no_answer_phrases):
118
+ return "Hmm, das ist eine knifflige Frage. Ich habe vielleicht nicht auf alles eine Antwort, aber lass uns das gemeinsam erkunden. Kannst du mir mehr Details geben oder eine andere Frage stellen?"
119
  return response
120
 
121