Use Onde Swift 1.1.0
Seto Elkahfi committed
May 15, 2026 at 06:10 UTC
8f543a55499f84d4866f45483dff01020066da21
4 files changed
+24
-7
Klepon.xcodeproj/project.pbxproj
+1
-1
@@ -808,7 +808,7 @@
808
repositoryURL = "https://github.com/ondeinference/onde-swift";
809
requirement = {
810
kind = exactVersion;
811
- version = 1.0.0;
811
+ version = 1.1.0;
812
};
813
};
814
/* End XCRemoteSwiftPackageReference section */
Klepon.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
+2
-2
@@ -6,8 +6,8 @@
6
"kind" : "remoteSourceControl",
7
"location" : "https://github.com/ondeinference/onde-swift",
8
"state" : {
9
- "revision" : "83bfe89489d3eee34a960dd7a3db31dc26735a09",
10
- "version" : "1.0.0"
9
+ "revision" : "d121bc121c2234964e71569e86cbb93cc750361e",
10
+ "version" : "1.1.0"
11
}
12
}
13
],
Klepon/AI/OndeGuideEngine.swift
+20
-3
@@ -96,15 +96,27 @@ final class OndeGuideEngine: ObservableObject {
96
@Published private(set) var storageUsedDescription: String =
97
OndeEnvironmentBootstrap.storageUsageDescription()
98
99
- private let engine = OndeChatEngine()
99
+ // Lazy so the Rust/UniFFI runtime is not initialized during app-state
100
+ // construction before the app actually needs the private guide engine.
101
+ private var engine: OndeChatEngine?
102
103
var estimatedDownloadDescription: String {
104
OndeEnvironmentBootstrap.estimatedDownloadDescription
105
}
106
107
+ private func getOrCreateEngine() -> OndeChatEngine {
108
+ if let engine {
109
+ return engine
110
+ }
111
+
112
+ let newEngine = OndeChatEngine()
113
+ engine = newEngine
114
+ return newEngine
115
+ }
116
+
117
func prepareIfNeeded(forceReload: Bool = false) async {
118
if forceReload {
107
- _ = await engine.unloadModel()
119
+ _ = await engine?.unloadModel()
120
availability = .notInstalled
121
}
122
@@ -118,6 +130,8 @@ final class OndeGuideEngine: ObservableObject {
130
availability = .preparing
131
OndeEnvironmentBootstrap.configureIfNeeded()
132
133
+ let engine = getOrCreateEngine()
134
+
135
do {
136
_ = try await engine.loadGgufModel(
137
config: qwen2515bConfig(),
@@ -140,6 +154,8 @@ final class OndeGuideEngine: ObservableObject {
154
throw OndeGuideError.unavailable
155
}
156
157
+ let engine = getOrCreateEngine()
158
+
159
availability = .answering
160
_ = await engine.clearHistory()
161
@@ -155,7 +171,8 @@ final class OndeGuideEngine: ObservableObject {
171
}
172
173
func removePrivateGuide() async {
158
- _ = await engine.unloadModel()
174
+ _ = await engine?.unloadModel()
175
+ engine = nil
176
OndeEnvironmentBootstrap.clearPrivateGuideFiles()
177
availability = .notInstalled
178
refreshStorageUsage()
project.yml
+1
-1
@@ -10,7 +10,7 @@ options:
10
packages:
11
Onde:
12
url: https://github.com/ondeinference/onde-swift
13
- exactVersion: 1.0.0
13
+ exactVersion: 1.1.0
14
15
schemes:
16
Klepon: