File tree Expand file tree Collapse file tree
Tool/Sources/OpenAIService Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ public extension ChatGPTMemory {
6565 content: String ? = nil ,
6666 functionCall: ChatMessage . FunctionCall ? = nil ,
6767 summary: String ? = nil ,
68- references: [ ChatMessage . Reference ] = [ ]
68+ references: [ ChatMessage . Reference ] ? = nil
6969 ) async {
7070 await mutateHistory { history in
7171 if let index = history. firstIndex ( where: { $0. id == id } ) {
@@ -90,14 +90,18 @@ public extension ChatGPTMemory {
9090 if let summary {
9191 history [ index] . summary = summary
9292 }
93+ if let references {
94+ history [ index] . references. append ( contentsOf: references)
95+ }
9396 } else {
9497 history. append ( . init(
9598 id: id,
9699 role: role ?? . system,
97100 content: content,
98101 name: nil ,
99102 functionCall: functionCall,
100- summary: summary
103+ summary: summary,
104+ references: references ?? [ ]
101105 ) )
102106 }
103107 }
Original file line number Diff line number Diff line change @@ -34,22 +34,19 @@ public struct ChatMessage: Equatable, Codable {
3434 public var content : String
3535 public var startLine : Int ?
3636 public var endLine : Int ?
37- public var metadata : [ String : String ]
3837
3938 public init (
4039 title: String ,
4140 subTitle: String ,
42- uri: String ,
4341 content: String ,
42+ uri: String ,
4443 startLine: Int ? ,
45- endLine: Int ? ,
46- metadata: [ String : String ]
44+ endLine: Int ?
4745 ) {
4846 self . title = title
4947 self . subTitle = subTitle
50- self . uri = uri
51- self . metadata = metadata
5248 self . content = content
49+ self . uri = uri
5350 self . startLine = startLine
5451 self . endLine = endLine
5552 }
You can’t perform that action at this time.
0 commit comments