1+ using Microsoft . Extensions . Logging ;
2+
13namespace ProjectVG . Application . Models . Chat
24{
35 public class ChatPreprocessContext
@@ -15,5 +17,40 @@ public class ChatPreprocessContext
1517
1618 public string MemoryStore { get ; set ; } = string . Empty ;
1719 public string VoiceName { get ; set ; } = string . Empty ;
20+
21+ public override string ToString ( )
22+ {
23+ return $ "ChatPreprocessContext(SessionId={ SessionId } , UserId={ UserId } , CharacterId={ CharacterId } , UserMessage='{ UserMessage } ', MemoryContext.Count={ MemoryContext . Count } , ConversationHistory.Count={ ConversationHistory . Count } )";
24+ }
25+
26+ public string GetDetailedInfo ( )
27+ {
28+ var info = new System . Text . StringBuilder ( ) ;
29+ info . AppendLine ( "=== ChatPreprocessContext ===" ) ;
30+ info . AppendLine ( $ "SessionId: { SessionId } ") ;
31+ info . AppendLine ( $ "UserId: { UserId } ") ;
32+ info . AppendLine ( $ "CharacterId: { CharacterId } ") ;
33+ info . AppendLine ( $ "Action: { Action ?? "N/A" } ") ;
34+ info . AppendLine ( $ "VoiceName: { VoiceName } ") ;
35+ info . AppendLine ( $ "MemoryStore: { MemoryStore } ") ;
36+ info . AppendLine ( $ "UserMessage: { UserMessage } ") ;
37+ info . AppendLine ( $ "SystemMessage: { SystemMessage } ") ;
38+ info . AppendLine ( $ "Instructions: { Instructions } ") ;
39+
40+ info . AppendLine ( $ "MemoryContext ({ MemoryContext . Count } items):") ;
41+ for ( int i = 0 ; i < MemoryContext . Count ; i ++ )
42+ {
43+ info . AppendLine ( $ " [{ i } ]: { MemoryContext [ i ] } ") ;
44+ }
45+
46+ info . AppendLine ( $ "ConversationHistory ({ ConversationHistory . Count } items):") ;
47+ for ( int i = 0 ; i < ConversationHistory . Count ; i ++ )
48+ {
49+ info . AppendLine ( $ " [{ i } ]: { ConversationHistory [ i ] } ") ;
50+ }
51+ info . AppendLine ( "=== End ChatPreprocessContext ===" ) ;
52+
53+ return info . ToString ( ) ;
54+ }
1855 }
1956}
0 commit comments