From afd9ad0560d76c2a6d161dad52553b10ff428905 Mon Sep 17 00:00:00 2001
From: Kujtim Hoxha <kujtimii.h@gmail.com>
Date: Thu, 27 Mar 2025 22:35:48 +0100
Subject: rework llm

---
 internal/db/sql/messages.sql | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

(limited to 'internal/db/sql/messages.sql')

diff --git a/internal/db/sql/messages.sql b/internal/db/sql/messages.sql
index db5e192fc..0674e62c1 100644
--- a/internal/db/sql/messages.sql
+++ b/internal/db/sql/messages.sql
@@ -13,14 +13,29 @@ ORDER BY created_at ASC;
 INSERT INTO messages (
     id,
     session_id,
-    message_data,
+    role,
+    finished,
+    content,
+    tool_calls,
+    tool_results,
     created_at,
     updated_at
 ) VALUES (
-    ?, ?, ?, strftime('%s', 'now'), strftime('%s', 'now')
+    ?, ?, ?, ?, ?, ?, ?, strftime('%s', 'now'), strftime('%s', 'now')
 )
 RETURNING *;
 
+-- name: UpdateMessage :exec
+UPDATE messages
+SET
+    content = ?,
+    thinking = ?,
+    tool_calls = ?,
+    tool_results = ?,
+    finished = ?,
+    updated_at = strftime('%s', 'now')
+WHERE id = ?;
+
 -- name: DeleteMessage :exec
 DELETE FROM messages
 WHERE id = ?;
-- 
cgit v1.2.3

