alaselababatunde commited on
Commit
8d00f16
·
1 Parent(s): 2f34bac
Files changed (1) hide show
  1. main.py +8 -1
main.py CHANGED
@@ -103,7 +103,7 @@ Conversation so far:
103
  {conversation_history}
104
 
105
  User: {query}
106
- Tech Disciples AI:
107
  """
108
 
109
  prompt = PromptTemplate(
@@ -124,9 +124,16 @@ def clean_response(text):
124
  text = re.sub(r'<\|endoftext\|>', '', text)
125
  text = re.sub(r'</s>', '', text)
126
 
 
 
 
127
  # Remove excessive newlines
128
  text = re.sub(r'\n{3,}', '\n\n', text)
129
 
 
 
 
 
130
  # Strip whitespace
131
  text = text.strip()
132
 
 
103
  {conversation_history}
104
 
105
  User: {query}
106
+ Tech Disciples AI (respond with warmth, depth, and Biblical understanding):
107
  """
108
 
109
  prompt = PromptTemplate(
 
124
  text = re.sub(r'<\|endoftext\|>', '', text)
125
  text = re.sub(r'</s>', '', text)
126
 
127
+ # Remove repetitive emojis (more than 3 in a row)
128
+ text = re.sub(r'(😉|😊|📝|✨){4,}', '', text)
129
+
130
  # Remove excessive newlines
131
  text = re.sub(r'\n{3,}', '\n\n', text)
132
 
133
+ # Truncate if response is unreasonably long (likely a loop)
134
+ if len(text) > 2000:
135
+ text = text[:2000] + "..."
136
+
137
  # Strip whitespace
138
  text = text.strip()
139