@@ -43,7 +43,7 @@ public DashScopeChatClient(IDashScopeClient dashScopeClient, string modelId)
4343
4444 /// <inheritdoc />
4545 public async Task < ChatResponse > GetResponseAsync (
46- IList < ChatMessage > chatMessages ,
46+ IEnumerable < ChatMessage > chatMessages ,
4747 ChatOptions ? options = null ,
4848 CancellationToken cancellationToken = default )
4949 {
@@ -130,7 +130,7 @@ public async Task<ChatResponse> GetResponseAsync(
130130
131131 /// <inheritdoc />
132132 public async IAsyncEnumerable < ChatResponseUpdate > GetStreamingResponseAsync (
133- IList < ChatMessage > chatMessages ,
133+ IEnumerable < ChatMessage > chatMessages ,
134134 ChatOptions ? options = null ,
135135 [ EnumeratorCancellation ] CancellationToken cancellationToken = default )
136136 {
@@ -202,10 +202,10 @@ public async IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseAsync(
202202 yield return new ChatResponseUpdate ( )
203203 {
204204 ResponseId = completion . ResponseId ,
205- Role = completion . Message . Role ,
205+ Role = completion . Messages [ 0 ] . Role ,
206206 AdditionalProperties = completion . AdditionalProperties ,
207- Contents = completion . Message . Contents ,
208- RawRepresentation = completion . Message . RawRepresentation ,
207+ Contents = completion . Messages [ 0 ] . Contents ,
208+ RawRepresentation = completion . Messages [ 0 ] . RawRepresentation ,
209209 CreatedAt = completion . CreatedAt ,
210210 FinishReason = completion . FinishReason ,
211211 ModelId = completion . ModelId ,
@@ -392,11 +392,11 @@ private List<MultimodalMessageContent> ToMultimodalMessageContents(IList<AIConte
392392 var content = aiContent switch
393393 {
394394 TextContent text => MultimodalMessageContent . TextContent ( text . Text ) ,
395- DataContent { Data . Length : > 0 } data when data . MediaTypeStartsWith ( "image" ) =>
395+ DataContent { Data . Length : > 0 } data when data . HasTopLevelMediaType ( "image" ) =>
396396 MultimodalMessageContent . ImageContent (
397- data . Data . Value . Span ,
397+ data . Data . Span ,
398398 data . MediaType ?? throw new InvalidOperationException ( "image media type should not be null" ) ) ,
399- DataContent { Uri : { } uri } data when data . MediaTypeStartsWith ( "image" ) =>
399+ DataContent { Uri : { } uri } data when data . HasTopLevelMediaType ( "image" ) =>
400400 MultimodalMessageContent . ImageContent ( uri ) ,
401401 _ => null
402402 } ;
@@ -422,7 +422,7 @@ private IEnumerable<TextChatMessage> ToTextChatMessages(
422422 {
423423 yield return new TextChatMessage (
424424 from . Role . Value ,
425- from . Text ?? string . Empty ,
425+ from . Text ,
426426 from . AuthorName ) ;
427427 }
428428 else if ( from . Role == ChatRole . Tool )
@@ -464,7 +464,7 @@ private IEnumerable<TextChatMessage> ToTextChatMessages(
464464 // <400> InternalError.Algo.InvalidParameter: Empty tool_calls is not supported in message
465465 yield return new TextChatMessage (
466466 from . Role . Value ,
467- from . Text ?? string . Empty ,
467+ from . Text ,
468468 from . AuthorName ,
469469 null ,
470470 functionCall . Count > 0 ? functionCall : null ) ;
0 commit comments