-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAIChatSession.cs
More file actions
117 lines (97 loc) · 4.68 KB
/
Copy pathAIChatSession.cs
File metadata and controls
117 lines (97 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
using CrestApps.Core.AI.ResponseHandling;
namespace CrestApps.Core.AI.Models;
public sealed class AIChatSession : ExtensibleEntity
{
/// <summary>
/// Gets or sets the unique identifier for the chat session.
/// This property is used to track and manage the session across its lifecycle.
/// </summary>
public string SessionId { get; set; }
/// <summary>
/// Gets or sets the profile identifier associated with this chat session.
/// It references the user's or client's profile during the session.
/// </summary>
public string ProfileId { get; set; }
/// <summary>
/// Gets or sets the title of the chat session.
/// This can be a descriptive name or label for the session, such as "Customer Support Chat".
/// </summary>
public string Title { get; set; }
/// <summary>
/// Gets or sets the user identifier who created this session.
/// This is used to associate the session with a specific user. If unavailable, <see cref="ClientId"/> is used instead.
/// </summary>
public string UserId { get; set; }
/// <summary>
/// Gets or sets the client identifier who created this session when <see cref="UserId"/> is not available.
/// This is typically used for cases where the session is initiated by a client or service instead of a specific user.
/// </summary>
public string ClientId { get; set; }
/// <summary>
/// Gets or sets the collection of document references attached to this session.
/// Documents are uploaded by users and used for RAG (Retrieval-Augmented Generation).
/// </summary>
public List<ChatDocumentInfo> Documents { get; set; } = [];
/// <summary>
/// Gets or sets the UTC date and time when the session was first created.
/// This property helps track the start time of the session in a standardized format (UTC).
/// </summary>
public DateTime CreatedUtc { get; set; }
/// <summary>
/// Gets or sets the UTC date and time of the last activity in this session.
/// </summary>
public DateTime LastActivityUtc { get; set; }
/// <summary>
/// Gets or sets the UTC date and time when the session ended.
/// </summary>
public DateTime? ClosedAtUtc { get; set; }
/// <summary>
/// Gets or sets the status of the chat session.
/// </summary>
public ChatSessionStatus Status { get; set; }
/// <summary>
/// Gets or sets the technical name of the <see cref="IChatResponseHandler"/> currently
/// handling prompts for this session. When <see langword="null"/> or empty, the default
/// AI handler is used. This value can be changed mid-conversation (e.g., by an AI
/// function that transfers the chat to a live-agent platform).
/// </summary>
public string ResponseHandlerName { get; set; }
/// <summary>
/// Gets or sets the extracted data fields for this session.
/// Keys are field names from the data extraction configuration.
/// </summary>
public Dictionary<string, ExtractedFieldState> ExtractedData { get; set; } = [];
/// <summary>
/// Gets or sets the results of post-session processing tasks.
/// Keys are task names from the post-session processing configuration.
/// Populated after the session is closed.
/// </summary>
public Dictionary<string, PostSessionResult> PostSessionResults { get; set; } = [];
/// <summary>
/// Gets or sets the status of post-session processing for this session.
/// </summary>
public PostSessionProcessingStatus PostSessionProcessingStatus { get; set; }
/// <summary>
/// Gets or sets the number of attempts made to process post-session tasks.
/// </summary>
public int PostSessionProcessingAttempts { get; set; }
/// <summary>
/// Gets or sets the UTC timestamp of the last post-session processing attempt.
/// </summary>
public DateTime? PostSessionProcessingLastAttemptUtc { get; set; }
/// <summary>
/// Gets or sets whether post-session tasks (custom AI tasks) have been processed.
/// Used to track partial completion so successful steps are not re-run on retry.
/// </summary>
public bool IsPostSessionTasksProcessed { get; set; }
/// <summary>
/// Gets or sets whether analytics events (resolution detection and session-end metrics)
/// have been recorded. Used to track partial completion so successful steps are not re-run on retry.
/// </summary>
public bool IsAnalyticsRecorded { get; set; }
/// <summary>
/// Gets or sets whether conversion goals have been evaluated.
/// Tracked independently from analytics so each step can be retried without re-running the other.
/// </summary>
public bool IsConversionGoalsEvaluated { get; set; }
}