@@ -15,7 +15,7 @@ public struct DisplayedChatMessage: Equatable {
1515
1616 public struct Reference : Equatable {
1717 public typealias Kind = ChatMessage . Reference . Kind
18-
18+
1919 public var title : String
2020 public var subtitle : String
2121 public var uri : String
@@ -135,7 +135,7 @@ struct Chat: ReducerProtocol {
135135 await send ( . focusOnTextField)
136136 await send ( . refresh)
137137 }
138-
138+
139139 case . refresh:
140140 return . run { send in
141141 await send ( . chatMenu( . refresh) )
@@ -298,8 +298,9 @@ struct Chat: ReducerProtocol {
298298 } . cancellable ( id: CancelID . observeDefaultScopesChange ( id) , cancelInFlight: true )
299299
300300 case . historyChanged:
301- state. history = service. chatHistory. map { message in
302- . init(
301+ state. history = service. chatHistory. flatMap { message in
302+ var all = [ DisplayedChatMessage] ( )
303+ all. append ( . init(
303304 id: message. id,
304305 role: {
305306 switch message. role {
@@ -312,7 +313,6 @@ struct Chat: ReducerProtocol {
312313 return . assistant
313314 }
314315 return . ignored
315- case . tool: return . tool
316316 }
317317 } ( ) ,
318318 text: message. summary ?? message. content ?? " " ,
@@ -325,7 +325,20 @@ struct Chat: ReducerProtocol {
325325 kind: $0. kind
326326 )
327327 }
328- )
328+ ) )
329+
330+ if let responses = message. toolCallContext? . responses {
331+ for response in responses {
332+ all. append ( . init(
333+ id: message. id + response. id,
334+ role: . tool,
335+ text: response. summary ?? response. content,
336+ references: [ ]
337+ ) )
338+ }
339+ }
340+
341+ return all
329342 }
330343
331344 state. title = {
@@ -401,7 +414,7 @@ struct ChatMenu: ReducerProtocol {
401414 return . run {
402415 await $0 ( . refresh)
403416 }
404-
417+
405418 case . refresh:
406419 state. temperatureOverride = service. configuration. overriding. temperature
407420 state. chatModelIdOverride = service. configuration. overriding. modelId
0 commit comments