| | | 1 | | namespace Elsa.AI.Abstractions.Models; |
| | | 2 | | |
| | | 3 | | public record AIConversation |
| | | 4 | | { |
| | 298 | 5 | | public string Id { get; init; } = default!; |
| | 224 | 6 | | public string? TenantId { get; init; } |
| | 393 | 7 | | public string UserId { get; init; } = default!; |
| | 108 | 8 | | public string? Title { get; init; } |
| | 118 | 9 | | public AIConversationStatus Status { get; init; } = AIConversationStatus.Active; |
| | 126 | 10 | | public DateTimeOffset CreatedAt { get; init; } |
| | 102 | 11 | | public DateTimeOffset UpdatedAt { get; init; } |
| | 108 | 12 | | public string? ProviderSessionId { get; init; } |
| | 276 | 13 | | public AIRetentionMode RetentionMode { get; init; } = AIRetentionMode.Configured; |
| | 180 | 14 | | public DateTimeOffset? RetentionExpiresAt { get; init; } |
| | 227 | 15 | | public IReadOnlyCollection<AIMessage> Messages { get; init; } = []; |
| | | 16 | | } |
| | | 17 | | |
| | | 18 | | public record AIMessage |
| | | 19 | | { |
| | | 20 | | public string Id { get; init; } = default!; |
| | | 21 | | public string ConversationId { get; init; } = default!; |
| | | 22 | | public AIMessageRole Role { get; init; } |
| | | 23 | | public string Content { get; init; } = ""; |
| | | 24 | | public DateTimeOffset CreatedAt { get; init; } |
| | | 25 | | public long StreamSequence { get; init; } |
| | | 26 | | public JsonObject Metadata { get; init; } = []; |
| | | 27 | | } |
| | | 28 | | |
| | | 29 | | public record AIChatRequest |
| | | 30 | | { |
| | | 31 | | public string? ConversationId { get; init; } |
| | | 32 | | public string Message { get; init; } = ""; |
| | | 33 | | public string? Agent { get; init; } |
| | | 34 | | public string? ProviderName { get; init; } |
| | | 35 | | public ICollection<AIContextAttachment> Attachments { get; init; } = []; |
| | | 36 | | public string? TenantId { get; init; } |
| | | 37 | | public string UserId { get; init; } = default!; |
| | | 38 | | public ICollection<string> UserPermissions { get; init; } = []; |
| | | 39 | | public bool IsReconnect { get; init; } |
| | | 40 | | } |
| | | 41 | | |
| | | 42 | | public record AIStreamEvent |
| | | 43 | | { |
| | | 44 | | public string Type { get; init; } = default!; |
| | | 45 | | public string ConversationId { get; init; } = default!; |
| | | 46 | | public long Sequence { get; init; } |
| | | 47 | | public DateTimeOffset Timestamp { get; init; } |
| | | 48 | | public JsonObject Data { get; init; } = []; |
| | | 49 | | } |
| | | 50 | | |
| | | 51 | | public record AISessionHandle |
| | | 52 | | { |
| | | 53 | | public string Id { get; init; } = Guid.NewGuid().ToString("N"); |
| | | 54 | | public string? ProviderSessionId { get; init; } |
| | | 55 | | } |
| | | 56 | | |
| | | 57 | | public record CreateAISessionRequest |
| | | 58 | | { |
| | | 59 | | public string ConversationId { get; init; } = default!; |
| | | 60 | | public string? Agent { get; init; } |
| | | 61 | | public string? TenantId { get; init; } |
| | | 62 | | public AIProviderConfiguration? ProviderConfiguration { get; init; } |
| | | 63 | | public JsonObject Metadata { get; init; } = []; |
| | | 64 | | } |
| | | 65 | | |
| | | 66 | | public record AITurnRequest |
| | | 67 | | { |
| | | 68 | | public string ConversationId { get; init; } = default!; |
| | | 69 | | public string? ProviderSessionId { get; init; } |
| | | 70 | | public string Message { get; init; } = ""; |
| | | 71 | | public IReadOnlyCollection<AIMessage> Messages { get; init; } = []; |
| | | 72 | | public IReadOnlyCollection<AIResolvedContext> Context { get; init; } = []; |
| | | 73 | | public IReadOnlyCollection<AIToolDefinition> Tools { get; init; } = []; |
| | | 74 | | public IReadOnlyCollection<AIToolTurnResult> ToolResults { get; init; } = []; |
| | | 75 | | public string? Agent { get; init; } |
| | | 76 | | public AIProviderConfiguration? ProviderConfiguration { get; init; } |
| | | 77 | | } |
| | | 78 | | |
| | | 79 | | public record AIProviderConfiguration |
| | | 80 | | { |
| | | 81 | | public string Name { get; init; } = default!; |
| | | 82 | | public string Provider { get; init; } = default!; |
| | | 83 | | public string? Model { get; init; } |
| | | 84 | | public string? ApiKeySecretName { get; init; } |
| | | 85 | | public string? Endpoint { get; init; } |
| | | 86 | | } |
| | | 87 | | |
| | | 88 | | public record AIToolTurnResult |
| | | 89 | | { |
| | | 90 | | public string ToolCallId { get; init; } = default!; |
| | | 91 | | public string ToolName { get; init; } = default!; |
| | | 92 | | public AIToolResult Result { get; init; } = new(); |
| | | 93 | | } |
| | | 94 | | |
| | | 95 | | public record AIProviderEvent |
| | | 96 | | { |
| | | 97 | | public string Type { get; init; } = default!; |
| | | 98 | | public long Sequence { get; init; } |
| | | 99 | | public DateTimeOffset Timestamp { get; init; } |
| | | 100 | | public JsonObject Data { get; init; } = []; |
| | | 101 | | } |
| | | 102 | | |
| | | 103 | | public enum AIConversationStatus |
| | | 104 | | { |
| | | 105 | | Active, |
| | | 106 | | Completed, |
| | | 107 | | Failed, |
| | | 108 | | Expired |
| | | 109 | | } |
| | | 110 | | |
| | | 111 | | public enum AIRetentionMode |
| | | 112 | | { |
| | | 113 | | Configured, |
| | | 114 | | Ephemeral, |
| | | 115 | | Durable |
| | | 116 | | } |
| | | 117 | | |
| | | 118 | | public enum AIMessageRole |
| | | 119 | | { |
| | | 120 | | User, |
| | | 121 | | Assistant, |
| | | 122 | | System, |
| | | 123 | | Tool |
| | | 124 | | } |