@@ -36,7 +36,7 @@ public static class Extension
3636 WriteIndented = true ,
3737 } ;
3838
39- public static void UpgradeAPIVersion ( this ChatCompletionsClient client , string apiVersion = "2024-12-01-preview" )
39+ public static void UpgradeApiVersion ( this ChatCompletionsClient client , string apiVersion = "2024-12-01-preview" )
4040 {
4141 var propertyInfo = client . GetType ( ) . GetField ( "_apiVersion" , BindingFlags . Instance | BindingFlags . NonPublic ) ;
4242 propertyInfo ? . SetValue ( client , apiVersion ) ;
@@ -63,7 +63,7 @@ public static IServiceCollection AddMap(this IServiceCollection collection)
6363 expression . CreateMap < DataContent , DataContentPO > ( )
6464 . ForMember ( po => po . Data , opt => opt . MapFrom ( content => content . Data ) ) ;
6565 expression . CreateMap < DataContentPO , DataContent > ( )
66- . ConstructUsing ( ( ( po , context ) =>
66+ . ConstructUsing ( ( ( po , _ ) =>
6767 {
6868 if ( po . Data != null )
6969 {
@@ -81,7 +81,7 @@ public static IServiceCollection AddMap(this IServiceCollection collection)
8181 expression . CreateMap < ErrorContentPO , ErrorContent > ( ) ;
8282 expression . CreateMap < FunctionResultContent , FunctionResultContentPO > ( ) ;
8383 expression . CreateMap < FunctionResultContentPO , FunctionResultContent > ( )
84- . ConstructUsing ( ( po , context ) => new FunctionResultContent ( po . CallId , po . Result )
84+ . ConstructUsing ( ( po , _ ) => new FunctionResultContent ( po . CallId , po . Result )
8585 { Exception = po . Exception } ) ;
8686 expression . CreateMap < TextReasoningContent , TextReasoningContentPO > ( ) ;
8787 expression . CreateMap < TextReasoningContentPO , TextReasoningContent > ( ) ;
@@ -180,7 +180,7 @@ public static string GetDebuggerString(this FunctionResultContent resultContent)
180180 var exception = resultContent . Exception ;
181181 return str + ( exception != null
182182 ? $ "{ exception . GetType ( ) . Name } (\" { exception . Message } \" )"
183- : ( resultContent . Result ? . ToString ( ) ?? "(null)" ) ?? "" ) ;
183+ : ( resultContent . Result ? . ToString ( ) ?? "(null)" ) ) ;
184184 }
185185
186186
@@ -335,7 +335,7 @@ public static string GetRootPropertyName(string json)
335335 public static ILLMChatClient ? CreateChatClient ( this ILLMChatModel llmModel )
336336 {
337337 var endpoint = llmModel . Endpoint ;
338- return ! endpoint . IsEnabled ? null : endpoint ? . NewChatClient ( llmModel ) ;
338+ return ! endpoint . IsEnabled ? null : endpoint . NewChatClient ( llmModel ) ;
339339 }
340340
341341 public static void AddLine ( this IList < string > list , string ? msg = null )
@@ -383,11 +383,9 @@ public static void NewLine(this IList<string> list, string? msg = null)
383383 if ( parentObject == null ) return null ;
384384
385385 //check if the parent matches the type we're looking for
386- T ? parent = parentObject as T ;
387- if ( parent != null )
386+ if ( parentObject is T parent )
388387 return parent ;
389- else
390- return FindVisualParent < T > ( parentObject ) ;
388+ return FindVisualParent < T > ( parentObject ) ;
391389 }
392390
393391 public static T Clone < T > ( T source ) where T : class
@@ -439,7 +437,7 @@ public static void TryAddAdditionalFunctionCallResult(this IEnumerable<ChunkNode
439437 }
440438 }
441439
442- public static void RecursiveAdditionalFunctionCallResult ( this ChunkNode node , List < AIContent > contents ,
440+ private static void RecursiveAdditionalFunctionCallResult ( this ChunkNode node , List < AIContent > contents ,
443441 StringBuilder stringBuilder )
444442 {
445443 var chunk = node . Chunk ;
@@ -474,6 +472,7 @@ public static IEnumerable<ChunkNode> OrderNode(this IList<ChunkNode> nodes)
474472
475473 public static SemanticKernelStore GetStore ( this RagOption ragOption )
476474 {
475+ ragOption . ThrowIfNotValid ( ) ;
477476 var dbConnection = ragOption . DBConnection ;
478477 var embeddingEndpoint = ragOption . EmbeddingEndpoint ;
479478 if ( embeddingEndpoint == null )
@@ -537,7 +536,7 @@ public static Func<string, CancellationToken, Task<string>> CreateSummaryDelegat
537536 return content ;
538537 }
539538
540- if ( cache ? . TryGetValue ( content , out var result ) == true )
539+ if ( cache . TryGetValue ( content , out var result ) )
541540 {
542541 return result ;
543542 }
@@ -580,10 +579,9 @@ public static Func<string, CancellationToken, Task<string>> CreateSummaryDelegat
580579 }
581580
582581 stringBuilder . Append ( content ) ;
583- var dialogContext = new DialogContext ( new [ ]
584- {
582+ var dialogContext = new DialogContext ( [
585583 new RequestViewItem ( ) { TextMessage = stringBuilder . ToString ( ) , }
586- } ) ;
584+ ] ) ;
587585 int tryCount = 0 ;
588586 while ( tryCount < retryCount )
589587 {
@@ -592,7 +590,7 @@ public static Func<string, CancellationToken, Task<string>> CreateSummaryDelegat
592590 var textResponse = response . TextResponse ;
593591 if ( ! string . IsNullOrEmpty ( textResponse ) && ! response . IsInterrupt )
594592 {
595- cache ? . TryAdd ( content , textResponse ) ;
593+ cache . TryAdd ( content , textResponse ) ;
596594 return textResponse ;
597595 }
598596 }
@@ -623,7 +621,7 @@ public static int CountRecursive(this PDFNode node)
623621 }
624622
625623 /// <summary>
626- /// use temp path in current directory. so it can be deleted when exit .
624+ /// use temp path in current directory. so it can be deleted when exited .
627625 /// </summary>
628626 public static string TempPath => Path . GetFullPath ( "Temp" ) ;
629627
0 commit comments