Spaces:
Runtime error
Runtime error
Prevent storing empty assistant messages in the database
Browse files- src/chat.py +2 -1
src/chat.py
CHANGED
@@ -170,7 +170,8 @@ class ChatSession:
|
|
170 |
else:
|
171 |
content = message.content or ""
|
172 |
|
173 |
-
|
|
|
174 |
|
175 |
async def ask(self, messages: List[Msg], *, think: bool = True) -> ChatResponse:
|
176 |
"""Send a chat request, automatically prepending the system prompt."""
|
|
|
170 |
else:
|
171 |
content = message.content or ""
|
172 |
|
173 |
+
if content.strip():
|
174 |
+
DBMessage.create(conversation=conversation, role="assistant", content=content)
|
175 |
|
176 |
async def ask(self, messages: List[Msg], *, think: bool = True) -> ChatResponse:
|
177 |
"""Send a chat request, automatically prepending the system prompt."""
|