Spaces:
Sleeping
Sleeping
Update src/components/ai_core_async_methods.py
Browse files
src/components/ai_core_async_methods.py
CHANGED
|
@@ -186,34 +186,30 @@ def _generate_model_response(self, prompt: str) -> str:
|
|
| 186 |
|
| 187 |
# Filter out system messages and protected content (minimal filtering)
|
| 188 |
system_markers = [
|
| 189 |
-
'[Protected:', '[System:', '
|
| 190 |
]
|
| 191 |
|
| 192 |
lines = response.split('\n')
|
| 193 |
filtered_lines = []
|
| 194 |
for line in lines:
|
| 195 |
-
#
|
| 196 |
if any(marker in line for marker in system_markers):
|
| 197 |
continue
|
| 198 |
-
#
|
| 199 |
-
# (removed - allow all content unless explicitly marked)
|
| 200 |
-
|
| 201 |
filtered_lines.append(line)
|
| 202 |
|
| 203 |
-
response = '
|
| 204 |
-
|
| 205 |
-
#
|
| 206 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
response = "I am Codette, an AI programming assistant. How can I help with your development tasks?"
|
| 208 |
-
|
| 209 |
-
# Clean up any remaining character dialogues
|
| 210 |
-
if ':' in response:
|
| 211 |
-
parts = response.split(':', 1)
|
| 212 |
-
speaker = parts[0].lower().strip()
|
| 213 |
-
if speaker == 'codette':
|
| 214 |
-
response = parts[1].strip()
|
| 215 |
-
|
| 216 |
-
# Allow all responses (removed fictional marker filtering)
|
| 217 |
|
| 218 |
return response.strip()
|
| 219 |
|
|
|
|
| 186 |
|
| 187 |
# Filter out system messages and protected content (minimal filtering)
|
| 188 |
system_markers = [
|
| 189 |
+
'[Protected:', '[System:', '[System:', # Only specific tags
|
| 190 |
]
|
| 191 |
|
| 192 |
lines = response.split('\n')
|
| 193 |
filtered_lines = []
|
| 194 |
for line in lines:
|
| 195 |
+
# Only skip lines with actual system markers (be lenient)
|
| 196 |
if any(marker in line for marker in system_markers):
|
| 197 |
continue
|
| 198 |
+
# Otherwise keep the line
|
|
|
|
|
|
|
| 199 |
filtered_lines.append(line)
|
| 200 |
|
| 201 |
+
response = '\n'.join(filtered_lines).strip() # Use newline join, not space
|
| 202 |
+
|
| 203 |
+
# Return whatever we got (don't replace with default unless truly empty)
|
| 204 |
+
if response.strip():
|
| 205 |
+
# Clean up any remaining character dialogues
|
| 206 |
+
if ':' in response:
|
| 207 |
+
parts = response.split(':', 1)
|
| 208 |
+
speaker = parts[0].lower().strip()
|
| 209 |
+
if speaker == 'codette':
|
| 210 |
+
response = parts[1].strip()
|
| 211 |
+
else:
|
| 212 |
response = "I am Codette, an AI programming assistant. How can I help with your development tasks?"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
return response.strip()
|
| 215 |
|