Skip to content

Commit d4c9c24

Browse files
committed
WIP
1 parent 7c9958a commit d4c9c24

File tree

20 files changed

+711
-156
lines changed

20 files changed

+711
-156
lines changed

Core/Sources/ChatPlugin/AITerminalChatPlugin.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ public actor AITerminalChatPlugin: ChatPlugin {
66
public static var command: String { "airun" }
77
public nonisolated var name: String { "AI Terminal" }
88

9-
let chatGPTService: any ChatGPTServiceType
9+
let chatGPTService: any LegacyChatGPTServiceType
1010
var terminal: TerminalType = Terminal()
1111
var isCancelled = false
1212
weak var delegate: ChatPluginDelegate?
1313
var isStarted = false
1414
var command: String?
1515

16-
public init(inside chatGPTService: any ChatGPTServiceType, delegate: ChatPluginDelegate) {
16+
public init(inside chatGPTService: any LegacyChatGPTServiceType, delegate: ChatPluginDelegate) {
1717
self.chatGPTService = chatGPTService
1818
self.delegate = delegate
1919
}

Core/Sources/ChatPlugin/AskChatGPT.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public func askChatGPT(
1414
configuration: configuration,
1515
functionProvider: NoChatGPTFunctionProvider()
1616
)
17-
let service = ChatGPTService(
17+
let service = LegacyChatGPTService(
1818
memory: memory,
1919
configuration: configuration
2020
)

Core/Sources/ChatPlugin/CallAIFunction.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func callAIFunction(
1818
let argsString = args.joined(separator: ", ")
1919
let configuration = UserPreferenceChatGPTConfiguration()
2020
.overriding(.init(temperature: 0))
21-
let service = ChatGPTService(
21+
let service = LegacyChatGPTService(
2222
memory: AutoManagedChatGPTMemory(
2323
systemPrompt: "You are now the following python function: ```# \(description)\n\(function)```\n\nOnly respond with your `return` value.",
2424
configuration: configuration,

Core/Sources/ChatPlugin/ChatPlugin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public protocol ChatPlugin: AnyObject {
66
static var command: String { get }
77
var name: String { get }
88

9-
init(inside chatGPTService: any ChatGPTServiceType, delegate: ChatPluginDelegate)
9+
init(inside chatGPTService: any LegacyChatGPTServiceType, delegate: ChatPluginDelegate)
1010
func send(content: String, originalMessage: String) async
1111
func cancel() async
1212
func stopResponding() async

Core/Sources/ChatPlugin/TerminalChatPlugin.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ public actor TerminalChatPlugin: ChatPlugin {
77
public static var command: String { "run" }
88
public nonisolated var name: String { "Terminal" }
99

10-
let chatGPTService: any ChatGPTServiceType
10+
let chatGPTService: any LegacyChatGPTServiceType
1111
var terminal: TerminalType = Terminal()
1212
var isCancelled = false
1313
weak var delegate: ChatPluginDelegate?
1414

15-
public init(inside chatGPTService: any ChatGPTServiceType, delegate: ChatPluginDelegate) {
15+
public init(inside chatGPTService: any LegacyChatGPTServiceType, delegate: ChatPluginDelegate) {
1616
self.chatGPTService = chatGPTService
1717
self.delegate = delegate
1818
}

Core/Sources/ChatPlugins/MathChatPlugin/MathChatPlugin.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ public actor MathChatPlugin: ChatPlugin {
77
public static var command: String { "math" }
88
public nonisolated var name: String { "Math" }
99

10-
let chatGPTService: any ChatGPTServiceType
10+
let chatGPTService: any LegacyChatGPTServiceType
1111
var isCancelled = false
1212
weak var delegate: ChatPluginDelegate?
1313

14-
public init(inside chatGPTService: any ChatGPTServiceType, delegate: ChatPluginDelegate) {
14+
public init(inside chatGPTService: any LegacyChatGPTServiceType, delegate: ChatPluginDelegate) {
1515
self.chatGPTService = chatGPTService
1616
self.delegate = delegate
1717
}

Core/Sources/ChatPlugins/SearchChatPlugin/SearchChatPlugin.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ public actor SearchChatPlugin: ChatPlugin {
66
public static var command: String { "search" }
77
public nonisolated var name: String { "Search" }
88

9-
let chatGPTService: any ChatGPTServiceType
9+
let chatGPTService: any LegacyChatGPTServiceType
1010
var isCancelled = false
1111
weak var delegate: ChatPluginDelegate?
1212

13-
public init(inside chatGPTService: any ChatGPTServiceType, delegate: ChatPluginDelegate) {
13+
public init(inside chatGPTService: any LegacyChatGPTServiceType, delegate: ChatPluginDelegate) {
1414
self.chatGPTService = chatGPTService
1515
self.delegate = delegate
1616
}

Core/Sources/ChatPlugins/ShortcutChatPlugin/ShortcutChatPlugin.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ public actor ShortcutChatPlugin: ChatPlugin {
88
public static var command: String { "shortcut" }
99
public nonisolated var name: String { "Shortcut" }
1010

11-
let chatGPTService: any ChatGPTServiceType
11+
let chatGPTService: any LegacyChatGPTServiceType
1212
var terminal: TerminalType = Terminal()
1313
var isCancelled = false
1414
weak var delegate: ChatPluginDelegate?
1515

16-
public init(inside chatGPTService: any ChatGPTServiceType, delegate: ChatPluginDelegate) {
16+
public init(inside chatGPTService: any LegacyChatGPTServiceType, delegate: ChatPluginDelegate) {
1717
self.chatGPTService = chatGPTService
1818
self.delegate = delegate
1919
}

Core/Sources/ChatPlugins/ShortcutChatPlugin/ShortcutInputChatPlugin.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ public actor ShortcutInputChatPlugin: ChatPlugin {
88
public static var command: String { "shortcutInput" }
99
public nonisolated var name: String { "Shortcut Input" }
1010

11-
let chatGPTService: any ChatGPTServiceType
11+
let chatGPTService: any LegacyChatGPTServiceType
1212
var terminal: TerminalType = Terminal()
1313
var isCancelled = false
1414
weak var delegate: ChatPluginDelegate?
1515

16-
public init(inside chatGPTService: any ChatGPTServiceType, delegate: ChatPluginDelegate) {
16+
public init(inside chatGPTService: any LegacyChatGPTServiceType, delegate: ChatPluginDelegate) {
1717
self.chatGPTService = chatGPTService
1818
self.delegate = delegate
1919
}

Core/Sources/ChatService/ChatPluginController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import Foundation
44
import OpenAIService
55

66
final class ChatPluginController {
7-
let chatGPTService: any ChatGPTServiceType
7+
let chatGPTService: any LegacyChatGPTServiceType
88
let plugins: [String: ChatPlugin.Type]
99
var runningPlugin: ChatPlugin?
1010
weak var chatService: ChatService?
1111

12-
init(chatGPTService: any ChatGPTServiceType, plugins: [ChatPlugin.Type]) {
12+
init(chatGPTService: any LegacyChatGPTServiceType, plugins: [ChatPlugin.Type]) {
1313
self.chatGPTService = chatGPTService
1414
var all = [String: ChatPlugin.Type]()
1515
for plugin in plugins {
@@ -18,7 +18,7 @@ final class ChatPluginController {
1818
self.plugins = all
1919
}
2020

21-
convenience init(chatGPTService: any ChatGPTServiceType, plugins: ChatPlugin.Type...) {
21+
convenience init(chatGPTService: any LegacyChatGPTServiceType, plugins: ChatPlugin.Type...) {
2222
self.init(chatGPTService: chatGPTService, plugins: plugins)
2323
}
2424

0 commit comments

Comments
 (0)