Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix: broken chat history query (#4756)

Wolf Mermelstein60d85543a0a6
diff --git a/crates/macro_db_client/src/chat_history/mod.rs b/crates/macro_db_client/src/chat_history/mod.rs
index b053c13e4d..8126ea63c5 100644
--- a/crates/macro_db_client/src/chat_history/mod.rs
+++ b/crates/macro_db_client/src/chat_history/mod.rs
@@ -24,12 +24,12 @@ where
SELECT
c.id as chat_id,
c.title as chat_title,
- m.content as message_content,
+ m.content::text as message_content,
m."createdAt" as message_created_at,
ma."attachmentId" as attachment_id
FROM "Chat" c
JOIN "ChatMessage" m ON m."chatId" = c.id
- LEFT JOIN "ChatMessageAttachment" ma ON ma."messageId" = m.id
+ LEFT JOIN "ChatAttachment" ma ON ma."messageId" = m.id
WHERE c.id = $1
ORDER BY m."createdAt" ASC
"#,
@@ -55,12 +55,12 @@ where
SELECT
c.id as chat_id,
c.title as chat_title,
- m.content as message_content,
+ m.content::text as message_content,
m."createdAt" as message_created_at,
ma."attachmentId" as attachment_id
FROM "Chat" c
JOIN "ChatMessage" m ON m."chatId" = c.id
- LEFT JOIN "ChatMessageAttachment" ma ON ma."messageId" = m.id
+ LEFT JOIN "ChatAttachment" ma ON ma."messageId" = m.id
WHERE m.id = ANY($1)
ORDER BY m."createdAt" ASC
"#,