@@ -12,7 +12,7 @@ namespace Cnblogs.DashScope.Core;
1212/// <param name="Partial">Notify model that next message should use this message as prefix.</param>
1313/// <param name="ToolCalls">Calls to the function.</param>
1414[ method: JsonConstructor ]
15- public record ChatMessage (
15+ public record TextChatMessage (
1616 string Role ,
1717 string Content ,
1818 string ? Name = null ,
@@ -23,7 +23,7 @@ public record ChatMessage(
2323 /// Create chat message from an uploaded DashScope file.
2424 /// </summary>
2525 /// <param name="fileId">The id of the file.</param>
26- public ChatMessage ( DashScopeFileId fileId )
26+ public TextChatMessage ( DashScopeFileId fileId )
2727 : this ( "system" , fileId . ToUrl ( ) )
2828 {
2929 }
@@ -32,7 +32,7 @@ public ChatMessage(DashScopeFileId fileId)
3232 /// Create chat message from multiple DashScope file.
3333 /// </summary>
3434 /// <param name="fileIds">Ids of the files.</param>
35- public ChatMessage ( IEnumerable < DashScopeFileId > fileIds )
35+ public TextChatMessage ( IEnumerable < DashScopeFileId > fileIds )
3636 : this ( "system" , string . Join ( ',' , fileIds . Select ( f => f . ToUrl ( ) ) ) )
3737 {
3838 }
@@ -42,19 +42,19 @@ public ChatMessage(IEnumerable<DashScopeFileId> fileIds)
4242 /// </summary>
4343 /// <param name="fileId">The id of the file.</param>
4444 /// <returns></returns>
45- public static ChatMessage File ( DashScopeFileId fileId )
45+ public static TextChatMessage File ( DashScopeFileId fileId )
4646 {
47- return new ChatMessage ( fileId ) ;
47+ return new TextChatMessage ( fileId ) ;
4848 }
4949
5050 /// <summary>
5151 /// Creates a file message.
5252 /// </summary>
5353 /// <param name="fileIds">The file id list.</param>
5454 /// <returns></returns>
55- public static ChatMessage File ( IEnumerable < DashScopeFileId > fileIds )
55+ public static TextChatMessage File ( IEnumerable < DashScopeFileId > fileIds )
5656 {
57- return new ChatMessage ( fileIds ) ;
57+ return new TextChatMessage ( fileIds ) ;
5858 }
5959
6060 /// <summary>
@@ -63,19 +63,19 @@ public static ChatMessage File(IEnumerable<DashScopeFileId> fileIds)
6363 /// <param name="content">Content of the message.</param>
6464 /// <param name="name">Author name.</param>
6565 /// <returns></returns>
66- public static ChatMessage User ( string content , string ? name = null )
66+ public static TextChatMessage User ( string content , string ? name = null )
6767 {
68- return new ChatMessage ( DashScopeRoleNames . User , content , name ) ;
68+ return new TextChatMessage ( DashScopeRoleNames . User , content , name ) ;
6969 }
7070
7171 /// <summary>
7272 /// Create a system message.
7373 /// </summary>
7474 /// <param name="content">The content of the message.</param>
7575 /// <returns></returns>
76- public static ChatMessage System ( string content )
76+ public static TextChatMessage System ( string content )
7777 {
78- return new ChatMessage ( DashScopeRoleNames . System , content ) ;
78+ return new TextChatMessage ( DashScopeRoleNames . System , content ) ;
7979 }
8080
8181 /// <summary>
@@ -86,9 +86,9 @@ public static ChatMessage System(string content)
8686 /// <param name="name">Author name.</param>
8787 /// <param name="toolCalls">Tool calls by model.</param>
8888 /// <returns></returns>
89- public static ChatMessage Assistant ( string content , bool ? partial = null , string ? name = null , List < ToolCall > ? toolCalls = null )
89+ public static TextChatMessage Assistant ( string content , bool ? partial = null , string ? name = null , List < ToolCall > ? toolCalls = null )
9090 {
91- return new ChatMessage ( DashScopeRoleNames . Assistant , content , name , partial , toolCalls ) ;
91+ return new TextChatMessage ( DashScopeRoleNames . Assistant , content , name , partial , toolCalls ) ;
9292 }
9393
9494 /// <summary>
@@ -97,8 +97,8 @@ public static ChatMessage Assistant(string content, bool? partial = null, string
9797 /// <param name="content">The output from tool.</param>
9898 /// <param name="name">The name of the tool.</param>
9999 /// <returns></returns>
100- public static ChatMessage Tool ( string content , string ? name = null )
100+ public static TextChatMessage Tool ( string content , string ? name = null )
101101 {
102- return new ChatMessage ( DashScopeRoleNames . Tool , content , name ) ;
102+ return new TextChatMessage ( DashScopeRoleNames . Tool , content , name ) ;
103103 }
104104}
0 commit comments