@@ -53,24 +53,28 @@ public final class ChatService: ObservableObject {
5353 }
5454 }
5555 } else if let runningPlugin {
56- await runningPlugin. send ( content: content)
56+ await runningPlugin. send ( content: content, originalMessage : content )
5757 } else if let pluginType = plugins [ command] {
5858 let plugin = pluginType. init ( inside: chatGPTService, delegate: self )
5959 if #available( macOS 13 . 0 , * ) {
6060 await plugin. send (
6161 content: String (
6262 content. dropFirst ( command. count + 1 )
6363 . trimmingPrefix ( while: { $0 == " " } )
64- )
64+ ) ,
65+ originalMessage: content
6566 )
6667 } else {
67- await plugin. send ( content: String ( content. dropFirst ( command. count + 1 ) ) )
68+ await plugin. send (
69+ content: String ( content. dropFirst ( command. count + 1 ) ) ,
70+ originalMessage: content
71+ )
6872 }
6973 } else {
7074 _ = try await chatGPTService. send ( content: content, summary: nil )
7175 }
7276 } else if let runningPlugin {
73- await runningPlugin. send ( content: content)
77+ await runningPlugin. send ( content: content, originalMessage : content )
7478 } else {
7579 _ = try await chatGPTService. send ( content: content, summary: nil )
7680 }
@@ -89,13 +93,13 @@ public final class ChatService: ObservableObject {
8993 }
9094 await chatGPTService. clearHistory ( )
9195 }
92-
96+
9397 public func deleteMessage( id: String ) async {
9498 await chatGPTService. mutateHistory { messages in
9599 messages. removeAll ( where: { $0. id == id } )
96100 }
97101 }
98-
102+
99103 public func resendMessage( id: String ) async throws {
100104 if let message = ( await chatGPTService. history) . first ( where: { $0. id == id } ) {
101105 try await send ( content: message. content)
@@ -133,7 +137,7 @@ extension ChatService: ChatPluginDelegate {
133137 public func shouldStartAnotherPlugin( _ type: ChatPlugin . Type , withContent content: String ) {
134138 let plugin = type. init ( inside: chatGPTService, delegate: self )
135139 Task {
136- await plugin. send ( content: content)
140+ await plugin. send ( content: content, originalMessage : content )
137141 }
138142 }
139143}
0 commit comments