@@ -76,7 +76,10 @@ await notificationService.DispatchNotification(
7676 await agentRepository . UpdateAgent ( agent . Id , agent ) ;
7777
7878 await notificationService . DispatchNotification (
79- NotificationMessageBuilder . ProcessingComplete ( agentId , agent . CurrentBehaviour , "COMPLETED" ) , "ReceiveAgentUpdate" ) ;
79+ NotificationMessageBuilder . ProcessingComplete (
80+ agentId ,
81+ agent . CurrentBehaviour ,
82+ "COMPLETED" ) , "ReceiveAgentUpdate" ) ;
8083
8184 //normalize message before returning it to user
8285 chat . Messages . Last ( ) . Content = Replace (
@@ -90,7 +93,8 @@ await notificationService.DispatchNotification(
9093 catch ( Exception ex )
9194 {
9295 await notificationService . DispatchNotification (
93- NotificationMessageBuilder . ProcessingFailed ( agentId , agent . CurrentBehaviour , ex . Message ) , "ReceiveAgentUpdate" ) ;
96+ NotificationMessageBuilder . ProcessingFailed ( agentId , agent . CurrentBehaviour , ex . Message ) ,
97+ "ReceiveAgentUpdate" ) ;
9498 throw ;
9599 }
96100 }
@@ -128,15 +132,13 @@ public async Task<Agent> CreateAgent(Agent agent, bool flow = false, bool intera
128132
129133 agent . Started = true ;
130134 agent . Flow = flow ;
135+ agent . ChatId = chat . Id ;
131136 agent . Behaviours ??= [ ] ;
132137 agent . Behaviours . Add ( "Default" , agent . Context . Instruction ! ) ;
133138 agent . CurrentBehaviour = "Default" ;
134139
135- var agentDocument = agent . ToDocument ( ) ;
136- agentDocument . ChatId = chat . Id ;
137-
138140 await chatRepository . AddChat ( chat . ToDocument ( ) ) ;
139- await agentRepository . AddAgent ( agentDocument ) ;
141+ await agentRepository . AddAgent ( agent . ToDocument ( ) ) ;
140142
141143 return agent ;
142144 }
0 commit comments