Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ abandoned/
bin/
datasources/
diskcache_dir/
docs/recordings/00_chapters.txt
docs/recordings/*
etc/
example_projects/
lib/
share/
tmp/*
src/ansari_backend.egg-info/*

.__atomic-write*
.env
.history
*.pyc
Expand Down
10 changes: 5 additions & 5 deletions src/ansari/ansari_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,11 +616,11 @@ def get_thread_llm_whatsapp(self, thread_id: str, user_id_whatsapp: int) -> list
ORDER BY timestamp;
"""
result = self._execute_query(select_cmd, (thread_id, user_id_whatsapp), "all")[0]
return (
[{"role": x[0], "content": x[1], "name": x[2]} if x[2] else {"role": x[0], "content": x[1]} for x in result]
if result
else []
)
msgs = []
for db_row in result:
msgs.extend(self.convert_message_llm(db_row))

return msgs
except Exception as e:
logger.warning(f"Warning (possible error): {e}")
return []
Expand Down
Loading