@@ -14,19 +14,19 @@ export type ContentType =
1414export type AttachmentType = 'image' | 'video' | 'audio' | 'pdf' | 'doc' | 'ppt' | 'txt' ;
1515
1616// 基础类型
17- export interface BaseContent < T extends string , TData > {
17+ export interface ChatBaseContent < T extends string , TData > {
1818 type : T ;
1919 data : TData ;
2020 status ?: MessageStatus | ( ( currentStatus : MessageStatus | undefined ) => MessageStatus ) ;
2121 id ?: string ;
2222}
2323
2424// 内容类型
25- export type TextContent = BaseContent < 'text' , string > ;
25+ export type TextContent = ChatBaseContent < 'text' , string > ;
2626
27- export type MarkdownContent = BaseContent < 'markdown' , string > ;
27+ export type MarkdownContent = ChatBaseContent < 'markdown' , string > ;
2828
29- export type ImageContent = BaseContent <
29+ export type ImageContent = ChatBaseContent <
3030 'image' ,
3131 {
3232 name ?: string ;
@@ -47,7 +47,7 @@ export type ReferenceItem = {
4747 site ?: string ;
4848 date ?: string ;
4949} ;
50- export type SearchContent = BaseContent <
50+ export type SearchContent = ChatBaseContent <
5151 'search' ,
5252 {
5353 title ?: string ;
@@ -59,7 +59,7 @@ export type SuggestionItem = {
5959 title : string ;
6060 prompt ?: string ;
6161} ;
62- export type SuggestionContent = BaseContent < 'suggestion' , SuggestionItem [ ] > ;
62+ export type SuggestionContent = ChatBaseContent < 'suggestion' , SuggestionItem [ ] > ;
6363
6464// 附件消息
6565export type AttachmentItem = {
@@ -72,10 +72,10 @@ export type AttachmentItem = {
7272 height ?: number ;
7373 metadata ?: Record < string , any > ;
7474} ;
75- export type AttachmentContent = BaseContent < 'attachment' , AttachmentItem [ ] > ;
75+ export type AttachmentContent = ChatBaseContent < 'attachment' , AttachmentItem [ ] > ;
7676
7777// 思考过程
78- export type ThinkingContent = BaseContent <
78+ export type ThinkingContent = ChatBaseContent <
7979 'thinking' ,
8080 {
8181 text ?: string ;
@@ -195,12 +195,12 @@ export interface ChatState {
195195 model : ModelServiceState ;
196196}
197197
198- export type AIContentHandler < T extends BaseContent < any , any > > = ( chunk : T , existing ?: T ) => T ;
198+ export type AIContentHandler < T extends ChatBaseContent < any , any > > = ( chunk : T , existing ?: T ) => T ;
199199
200200export interface ContentTypeDefinition < T extends string = string , D = any > {
201201 type : T ;
202- handler ?: AIContentHandler < BaseContent < T , D > > ;
203- renderer ?: ContentRenderer < BaseContent < T , D > > ;
202+ handler ?: AIContentHandler < ChatBaseContent < T , D > > ;
203+ renderer ?: ContentRenderer < ChatBaseContent < T , D > > ;
204204}
205205
206- export type ContentRenderer < T extends BaseContent < any , any > > = ( content : T ) => unknown ;
206+ export type ContentRenderer < T extends ChatBaseContent < any , any > > = ( content : T ) => unknown ;
0 commit comments