@@ -47,21 +47,24 @@ public struct ChatMessage: Equatable, Codable {
4747 }
4848
4949 public struct Reference : Codable , Equatable {
50- public enum Kind : String , Codable {
51- case `class`
52- case `struct`
53- case `enum`
54- case `actor`
55- case `protocol`
56- case `extension`
57- case `case`
58- case property
59- case `typealias`
60- case function
61- case method
50+ public enum Kind : Codable , Equatable {
51+ public enum Symbol : String , Codable {
52+ case `class`
53+ case `struct`
54+ case `enum`
55+ case `actor`
56+ case `protocol`
57+ case `extension`
58+ case `case`
59+ case property
60+ case `typealias`
61+ case function
62+ case method
63+ }
64+ case symbol( Symbol )
6265 case text
6366 case webpage
64- case other
67+ case other( String )
6568 }
6669
6770 public var title : String
@@ -78,8 +81,8 @@ public struct ChatMessage: Equatable, Codable {
7881 subTitle: String ,
7982 content: String ,
8083 uri: String ,
81- startLine: Int ? ,
82- endLine: Int ? ,
84+ startLine: Int ? = nil ,
85+ endLine: Int ? = nil ,
8386 kind: Kind
8487 ) {
8588 self . title = title
@@ -116,6 +119,12 @@ public struct ChatMessage: Equatable, Codable {
116119
117120 /// The id of the message.
118121 public var id : ID
122+
123+ /// The id of the sender of the message.
124+ public var senderId : String ?
125+
126+ /// The id of the message that this message is a response to.
127+ public var responseTo : ID ?
119128
120129 /// The number of tokens of this message.
121130 public var tokensCount : Int ?
@@ -134,6 +143,8 @@ public struct ChatMessage: Equatable, Codable {
134143
135144 public init (
136145 id: String = UUID ( ) . uuidString,
146+ senderId: String ? = nil ,
147+ repinesToo: String ? = nil ,
137148 role: Role ,
138149 content: String ? ,
139150 name: String ? = nil ,
@@ -143,6 +154,8 @@ public struct ChatMessage: Equatable, Codable {
143154 references: [ Reference ] = [ ]
144155 ) {
145156 self . role = role
157+ self . senderId = senderId
158+ self . responseTo = responseTo
146159 self . content = content
147160 self . name = name
148161 self . toolCalls = toolCalls
@@ -154,7 +167,7 @@ public struct ChatMessage: Equatable, Codable {
154167}
155168
156169public struct ReferenceKindFallback : FallbackValueProvider {
157- public static var defaultValue : ChatMessage . Reference . Kind { . other }
170+ public static var defaultValue : ChatMessage . Reference . Kind { . other( " Unknown " ) }
158171}
159172
160173public struct ChatMessageRoleFallback : FallbackValueProvider {
0 commit comments