@@ -177,7 +177,7 @@ private ResolvedEmbeddingConfig ResolveEmbeddingConfig()
177177
178178 private static async Task RunStageAsync
179179 (
180- PipelineContext context ,
180+ PipelineContext context ,
181181 PipelineStageKind kind ,
182182 Func < Task > action ,
183183 Func < string ? > ? detailFactory = null
@@ -208,13 +208,21 @@ private async Task<NarrationResult> RunPipelineAsync
208208 CancellationToken cancellationToken
209209 )
210210 {
211- await RunStageAsync ( context , PipelineStageKind . Retrieval ,
211+ await RunStageAsync
212+ (
213+ context ,
214+ PipelineStageKind . Retrieval ,
212215 ( ) => retrievalStage . ExecuteAsync ( context , cancellationToken ) ,
213- ( ) => $ "知识长度={ context . KnowledgeContext ? . Length ?? 0 } , 记忆长度={ context . MemoryContext ? . Length ?? 0 } ") ;
216+ ( ) => $ "知识长度={ context . KnowledgeContext ? . Length ?? 0 } , 记忆长度={ context . MemoryContext ? . Length ?? 0 } "
217+ ) ;
214218
215- await RunStageAsync ( context , PipelineStageKind . Generation ,
219+ await RunStageAsync
220+ (
221+ context ,
222+ PipelineStageKind . Generation ,
216223 ( ) => generationStage . ExecuteAsync ( context , cancellationToken ) ,
217- ( ) => $ "叙事长度={ context . NarrativeOutput ? . Length ?? 0 } ") ;
224+ ( ) => $ "叙事长度={ context . NarrativeOutput ? . Length ?? 0 } "
225+ ) ;
218226
219227 var now = DateTime . UtcNow ;
220228
@@ -227,18 +235,18 @@ await RunStageAsync(context, PipelineStageKind.Generation,
227235 RoundID = context . RoundID ,
228236 SceneID = context . CurrentSceneID ,
229237 Type = EventType . DirectorInput ,
230- Data = JsonSerializer . Serialize
231- (
232- context . DirectiveBatch . Directives . Select
233- ( d => new
234- {
235- type = d . Type . ToString ( ) ,
236- content = d . Content ,
237- order = d . Order ,
238- isSystem = d . IsSystem
239- }
240- )
241- ) ,
238+ Data = JsonSerializer . Serialize
239+ (
240+ context . DirectiveBatch . Directives . Select
241+ ( d => new
242+ {
243+ type = d . Type . ToString ( ) ,
244+ content = d . Content ,
245+ order = d . Order ,
246+ isSystem = d . IsSystem
247+ }
248+ )
249+ ) ,
242250 CreatedAt = now
243251 } ,
244252 new ( )
@@ -272,10 +280,17 @@ await RunStageAsync(context, PipelineStageKind.Generation,
272280
273281 await eventRepository . AppendBatchAsync ( events , cancellationToken ) ;
274282
275- await RunStageAsync ( context , PipelineStageKind . PostProcessing ,
276- ( ) => postProcessingStage . ExecuteAsync ( context , cancellationToken ) ) ;
283+ await RunStageAsync
284+ (
285+ context ,
286+ PipelineStageKind . PostProcessing ,
287+ ( ) => postProcessingStage . ExecuteAsync ( context , cancellationToken )
288+ ) ;
277289
278- await RunStageAsync ( context , PipelineStageKind . SystemState ,
290+ await RunStageAsync
291+ (
292+ context ,
293+ PipelineStageKind . SystemState ,
279294 ( ) => systemStateTransformer . ExecuteAsync
280295 (
281296 context . DirectiveBatch . ProjectID ,
@@ -284,7 +299,8 @@ await RunStageAsync(context, PipelineStageKind.SystemState,
284299 context . RoundID ,
285300 SystemTrigger . RoundEnd ,
286301 cancellationToken
287- ) ) ;
302+ )
303+ ) ;
288304
289305 await directiveRepository . DecrementTTLAsync ( context . SessionID , cancellationToken ) ;
290306
@@ -421,5 +437,4 @@ private static DirectiveBatch InjectSystemDirectives
421437
422438 return batch with { Directives = allDirectives } ;
423439 }
424-
425440}
0 commit comments