File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,7 +56,16 @@ public final class ChatService: ObservableObject {
5656 await runningPlugin. send ( content: content)
5757 } else if let pluginType = plugins [ command] {
5858 let plugin = pluginType. init ( inside: chatGPTService, delegate: self )
59- await plugin. send ( content: String ( content. dropFirst ( command. count + 1 ) ) )
59+ if #available( macOS 13 . 0 , * ) {
60+ await plugin. send (
61+ content: String (
62+ content. dropFirst ( command. count + 1 )
63+ . trimmingPrefix ( while: { $0 == " " } )
64+ )
65+ )
66+ } else {
67+ await plugin. send ( content: String ( content. dropFirst ( command. count + 1 ) ) )
68+ }
6069 } else {
6170 _ = try await chatGPTService. send ( content: content, summary: nil )
6271 }
@@ -106,7 +115,7 @@ extension ChatService: ChatPluginDelegate {
106115 public func pluginDidEnd( _: ChatPlugin ) {
107116 runningPlugin = nil
108117 }
109-
118+
110119 public func shouldStartAnotherPlugin( _ type: ChatPlugin . Type , withContent content: String ) {
111120 let plugin = type. init ( inside: chatGPTService, delegate: self )
112121 Task {
You can’t perform that action at this time.
0 commit comments