fix: rowid column shift in get_message_with_rowid; add file logging and frontend error reporting

This commit is contained in:
Xianren Studio
2026-08-13 23:31:06 +08:00
parent 57df39e4ce
commit 00624d81cf
8 changed files with 77 additions and 4 deletions
+2 -2
View File
@@ -148,11 +148,11 @@ pub fn get_message(db: &Connection, id: &str) -> Result<Option<Message>> {
pub fn get_message_with_rowid(db: &Connection, id: &str) -> Result<Option<(i64, Message)>> {
let mut stmt = db.prepare(
"SELECT rowid, id, conversation_id, role, content, tokens_in, tokens_out, elapsed_ms, first_token_ms, images_json, created_at
"SELECT id, conversation_id, role, content, tokens_in, tokens_out, elapsed_ms, first_token_ms, images_json, created_at, rowid
FROM messages WHERE id = ?1",
)?;
let mut rows = stmt.query_map(params![id], |row| {
let rowid: i64 = row.get(0)?;
let rowid: i64 = row.get(10)?;
let msg = row_to_message(row)?;
Ok((rowid, msg))
})?;