forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatPlugin.swift
More file actions
32 lines (27 loc) · 904 Bytes
/
ChatPlugin.swift
File metadata and controls
32 lines (27 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import Foundation
public struct ChatPluginRequest {
public var text: String
public var arguments: [String]
public var history: [ChatMessage]
public init(text: String, arguments: [String], history: [ChatMessage]) {
self.text = text
self.arguments = arguments
self.history = history
}
}
public protocol ChatPlugin {
typealias Response = ChatAgentResponse
typealias Request = ChatPluginRequest
static var id: String { get }
static var command: String { get }
static var name: String { get }
static var description: String { get }
func send(_ request: Request) async -> AsyncThrowingStream<Response, any Error>
func formatContent(_ content: Response.Content) -> Response.Content
init()
}
public extension ChatPlugin {
func formatContent(_ content: Response.Content) -> Response.Content {
return content
}
}