Backend: - New OpenClawEndpoint with GET /api/openclaw/sessions and POST /api/openclaw/import - Lists all OpenClaw sessions with preview messages, model, summary - Imports user/assistant text messages (skips tool-use/tool-result) - Cleans user messages (removes webchat prefixes, cron tags, conversation info blocks) - Re-import support: deletes previous openclaw-import chains before importing - New DatabaseService methods: CreateChainForImport, CreateMessageForImport, DeleteOpenClawImport - Added SortKey to MessageRecord (computed: openclaw-import gets id-10B, else id) History sorting: - OpenClaw-imported messages always appear before native messages - Sort by CASE WHEN tag='openclaw-import' THEN id-10000000000 ELSE id END - Cursor-based paging updated from beforeId/afterId to beforeSortKey/afterSortKey - All history queries (GetLatestActive, Before, After, CountBefore) updated Frontend: - Dashboard: new 'OpenClaw Import' menu item in session card dropdown - Modal: shows OpenClaw sessions with metadata, summary, preview messages - Imported messages display blue 'OC' badge in chat - API functions: apiGetOpenclawSessions, apiImportOpenclawSession - History paging updated to use sortKey cursors
33 lines
1.6 KiB
C#
33 lines
1.6 KiB
C#
namespace Gott.Models;
|
|
|
|
public class MessageRecord
|
|
{
|
|
public long Id { get; set; }
|
|
public string ChainId { get; set; }
|
|
public string Role { get; set; } // user, assistant
|
|
public string Type { get; set; } // text, tool_use, tool_result
|
|
public string Content { get; set; } // Text oder JSON
|
|
public string ToolName { get; set; } // null bei text
|
|
public string ToolCallId { get; set; } // tool_use id
|
|
public bool IsError { get; set; }
|
|
public int Iteration { get; set; } // welche Loop-Iteration
|
|
public int AttachmentCount { get; set; } // Anzahl angehängter Dateien
|
|
public string AttachmentNames { get; set; } // JSON-Array mit Dateinamen
|
|
public string Tag { get; set; } // null = normal, "preparer"/"review"/"finalizer" = Sub-Agent-Message
|
|
public bool IsMarked { get; set; } // als wichtig markiert
|
|
public string DeletedOn { get; set; } // null = aktiv, sonst Zeitstempel der Löschung
|
|
public string CreatedAt { get; set; }
|
|
public long SortKey { get; set; } // Computed: openclaw-import messages get id - 10B, else id
|
|
}
|
|
|
|
public class AttachmentRecord
|
|
{
|
|
public long Id { get; set; }
|
|
public long MessageId { get; set; } // FK auf messages.id
|
|
public string Type { get; set; } // image, document
|
|
public string MediaType { get; set; } // image/png, application/pdf, etc.
|
|
public string FileName { get; set; } // Original-Dateiname (optional)
|
|
public string Data { get; set; } // Base64-encoded Inhalt
|
|
public string CreatedAt { get; set; }
|
|
}
|