forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModels.swift
More file actions
38 lines (34 loc) · 759 Bytes
/
Models.swift
File metadata and controls
38 lines (34 loc) · 759 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
32
33
34
35
36
37
38
import Foundation
struct Cancellable {
let cancel: () -> Void
func callAsFunction() {
cancel()
}
}
public struct ChatMessage: Equatable, Codable {
public enum Role: String, Codable, Equatable {
case system
case user
case assistant
}
public var role: Role
public var content: String {
didSet {
tokensCount = nil
}
}
public var summary: String?
public var id: String
public var tokensCount: Int?
public init(
id: String = UUID().uuidString,
role: Role,
content: String,
summary: String? = nil
) {
self.role = role
self.content = content
self.summary = summary
self.id = id
}
}