Multi-File Upload, Dateinamen in History, kein Auto-Scroll bei Attachment-Klick
This commit is contained in:
1 parent
0b2c9a08c6
commit
663f2c2a9a
7 files changed
+66
-40
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Dapper;
|
||||
using Gott.Models;
|
||||
@@ -121,6 +122,7 @@ public class DatabaseService
|
||||
TryAddColumn(conn, "sessions", "is_deleted", "INTEGER NOT NULL DEFAULT 0");
|
||||
TryAddColumn(conn, "chains", "agent_id", "TEXT");
|
||||
TryAddColumn(conn, "messages", "attachment_count", "INTEGER NOT NULL DEFAULT 0");
|
||||
TryAddColumn(conn, "messages", "attachment_names", "TEXT");
|
||||
}
|
||||
|
||||
private void TryAddColumn(SqliteConnection conn, string table, string column, string type)
|
||||
@@ -370,9 +372,14 @@ public class DatabaseService
|
||||
|
||||
record.CreatedAt = DateTime.UtcNow.ToString("o");
|
||||
record.AttachmentCount = attachments?.Count ?? 0;
|
||||
if (attachments != null && attachments.Count > 0)
|
||||
{
|
||||
var names = attachments.Select(a => a.FileName ?? "").ToArray();
|
||||
record.AttachmentNames = System.Text.Json.JsonSerializer.Serialize(names);
|
||||
}
|
||||
var messageId = await conn.ExecuteScalarAsync<long>(@"
|
||||
INSERT INTO messages (chain_id, role, type, content, tool_name, tool_call_id, is_error, iteration, attachment_count, created_at)
|
||||
VALUES (@ChainId, @Role, @Type, @Content, @ToolName, @ToolCallId, @IsError, @Iteration, @AttachmentCount, @CreatedAt);
|
||||
INSERT INTO messages (chain_id, role, type, content, tool_name, tool_call_id, is_error, iteration, attachment_count, attachment_names, created_at)
|
||||
VALUES (@ChainId, @Role, @Type, @Content, @ToolName, @ToolCallId, @IsError, @Iteration, @AttachmentCount, @AttachmentNames, @CreatedAt);
|
||||
SELECT last_insert_rowid();
|
||||
", record, tx);
|
||||
|
||||
|
||||
Reference in new issue
Block a user