| 1 | class Conversation { |
| 2 | final String id; |
| 3 | final String title; |
| 4 | final DateTime createdAt; |
| 5 | final DateTime updatedAt; |
| 6 | final bool isPinned; |
| 7 | final String? personaId; |
| 8 | final String? serverId; |
| 9 | final String? modelId; |
| 10 | final int messageCount; |
| 11 | final String? lastMessagePreview; |
| 12 | final String? systemPrompt; |
| 13 | final double? temperature; |
| 14 | final double? topP; |
| 15 | final int? maxTokens; |
| 16 | final int? contextLength; |
| 17 | final bool? mcpEnabled; |
| 18 | final List<String>? smartReplies; |
| 19 | final String? smartRepliesLastMessageId; |
| 20 | final String? folderId; |
| 21 | final bool isTemporary; |
| 22 | final bool isArchived; |
| 23 | final int characterCount; |
| 24 | final int? totalTokenCount; |
| 25 | |
| 26 | Conversation({ |
| 27 | required this.id, |
| 28 | required this.title, |
| 29 | required this.createdAt, |
| 30 | required this.updatedAt, |
| 31 | this.isPinned = false, |
| 32 | this.personaId, |
| 33 | this.serverId, |
| 34 | this.modelId, |
| 35 | this.messageCount = 0, |
| 36 | this.lastMessagePreview, |
| 37 | this.systemPrompt, |
| 38 | this.temperature, |
| 39 | this.topP, |
| 40 | this.maxTokens, |
| 41 | this.contextLength, |
| 42 | this.mcpEnabled, |
| 43 | this.smartReplies, |
| 44 | this.smartRepliesLastMessageId, |
| 45 | this.folderId, |
| 46 | this.isTemporary = false, |
| 47 | this.isArchived = false, |
| 48 | this.characterCount = 0, |
| 49 | this.totalTokenCount, |
| 50 | }); |
| 51 | |
| 52 | Conversation copyWith({ |
| 53 | String? id, |
| 54 | String? title, |
| 55 | DateTime? createdAt, |
| 56 | DateTime? updatedAt, |
| 57 | bool? isPinned, |
| 58 | String? personaId, |
| 59 | bool clearPersona = false, |
| 60 | String? serverId, |
| 61 | String? modelId, |
| 62 | int? messageCount, |
| 63 | String? lastMessagePreview, |
| 64 | String? systemPrompt, |
| 65 | bool clearSystemPrompt = false, |
| 66 | double? temperature, |
| 67 | bool clearTemperature = false, |
| 68 | double? topP, |
| 69 | bool clearTopP = false, |
| 70 | int? maxTokens, |
| 71 | bool clearMaxTokens = false, |
| 72 | int? contextLength, |
| 73 | bool clearContextLength = false, |
| 74 | bool? mcpEnabled, |
| 75 | bool clearMcpEnabled = false, |
| 76 | List<String>? smartReplies, |
| 77 | bool clearSmartReplies = false, |
| 78 | String? smartRepliesLastMessageId, |
| 79 | bool clearSmartRepliesLastMessageId = false, |
| 80 | String? folderId, |
| 81 | bool clearFolderId = false, |
| 82 | bool? isTemporary, |
| 83 | bool? isArchived, |
| 84 | int? characterCount, |
| 85 | int? totalTokenCount, |
| 86 | }) { |
| 87 | return Conversation( |
| 88 | id: id ?? this.id, |
| 89 | title: title ?? this.title, |
| 90 | createdAt: createdAt ?? this.createdAt, |
| 91 | updatedAt: updatedAt ?? this.updatedAt, |
| 92 | isPinned: isPinned ?? this.isPinned, |
| 93 | personaId: clearPersona ? null : (personaId ?? this.personaId), |
| 94 | serverId: serverId ?? this.serverId, |
| 95 | modelId: modelId ?? this.modelId, |
| 96 | messageCount: messageCount ?? this.messageCount, |
| 97 | lastMessagePreview: lastMessagePreview ?? this.lastMessagePreview, |
| 98 | systemPrompt: clearSystemPrompt |
| 99 | ? null |
| 100 | : (systemPrompt ?? this.systemPrompt), |
| 101 | temperature: clearTemperature ? null : (temperature ?? this.temperature), |
| 102 | topP: clearTopP ? null : (topP ?? this.topP), |
| 103 | maxTokens: clearMaxTokens ? null : (maxTokens ?? this.maxTokens), |
| 104 | contextLength: clearContextLength |
| 105 | ? null |
| 106 | : (contextLength ?? this.contextLength), |
| 107 | mcpEnabled: clearMcpEnabled ? null : (mcpEnabled ?? this.mcpEnabled), |
| 108 | smartReplies: clearSmartReplies |
| 109 | ? null |
| 110 | : (smartReplies ?? this.smartReplies), |
| 111 | smartRepliesLastMessageId: clearSmartRepliesLastMessageId |
| 112 | ? null |
| 113 | : (smartRepliesLastMessageId ?? this.smartRepliesLastMessageId), |
| 114 | folderId: clearFolderId ? null : (folderId ?? this.folderId), |
| 115 | isTemporary: isTemporary ?? this.isTemporary, |
| 116 | isArchived: isArchived ?? this.isArchived, |
| 117 | characterCount: characterCount ?? this.characterCount, |
| 118 | totalTokenCount: totalTokenCount ?? this.totalTokenCount, |
| 119 | ); |
| 120 | } |
| 121 | } |