trimmed trailing white space
This commit is contained in:
parent
c02696846a
commit
a6ba4e2bb0
3 changed files with 10 additions and 10 deletions
|
@ -26,7 +26,7 @@ class LlamaState: ObservableObject {
|
||||||
loadModelsFromDisk()
|
loadModelsFromDisk()
|
||||||
loadDefaultModels()
|
loadDefaultModels()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func loadModelsFromDisk() {
|
private func loadModelsFromDisk() {
|
||||||
do {
|
do {
|
||||||
let documentsURL = getDocumentsDirectory()
|
let documentsURL = getDocumentsDirectory()
|
||||||
|
@ -46,11 +46,11 @@ class LlamaState: ObservableObject {
|
||||||
} catch {
|
} catch {
|
||||||
messageLog += "Error!\n"
|
messageLog += "Error!\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
for model in defaultModels {
|
for model in defaultModels {
|
||||||
let fileURL = getDocumentsDirectory().appendingPathComponent(model.filename)
|
let fileURL = getDocumentsDirectory().appendingPathComponent(model.filename)
|
||||||
if FileManager.default.fileExists(atPath: fileURL.path) {
|
if FileManager.default.fileExists(atPath: fileURL.path) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var undownloadedModel = model
|
var undownloadedModel = model
|
||||||
undownloadedModel.status = "download"
|
undownloadedModel.status = "download"
|
||||||
|
@ -112,8 +112,8 @@ class LlamaState: ObservableObject {
|
||||||
messageLog += "Load a model from the list below\n"
|
messageLog += "Load a model from the list below\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private func updateDownloadedModels(modelName: String, status: String) {
|
private func updateDownloadedModels(modelName: String, status: String) {
|
||||||
undownloadedModels.removeAll { $0.name == modelName }
|
undownloadedModels.removeAll { $0.name == modelName }
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ struct ContentView: View {
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
.navigationBarTitle("Model Settings", displayMode: .inline)
|
.navigationBarTitle("Model Settings", displayMode: .inline)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ struct ContentView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
struct DrawerView: View {
|
struct DrawerView: View {
|
||||||
|
|
||||||
@ObservedObject var llamaState: LlamaState
|
@ObservedObject var llamaState: LlamaState
|
||||||
@State private var showingHelp = false
|
@State private var showingHelp = false
|
||||||
func delete(at offsets: IndexSet) {
|
func delete(at offsets: IndexSet) {
|
||||||
|
@ -87,7 +87,7 @@ struct ContentView: View {
|
||||||
print("Error deleting file: \(error)")
|
print("Error deleting file: \(error)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove models from downloadedModels array
|
// Remove models from downloadedModels array
|
||||||
llamaState.downloadedModels.remove(atOffsets: offsets)
|
llamaState.downloadedModels.remove(atOffsets: offsets)
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ struct ContentView: View {
|
||||||
DownloadButton(llamaState: llamaState, modelName: model.name, modelUrl: model.url, filename: model.filename)
|
DownloadButton(llamaState: llamaState, modelName: model.name, modelUrl: model.url, filename: model.filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.listStyle(GroupedListStyle())
|
.listStyle(GroupedListStyle())
|
||||||
.navigationBarTitle("Model Settings", displayMode: .inline).toolbar {
|
.navigationBarTitle("Model Settings", displayMode: .inline).toolbar {
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct DownloadButton: View {
|
||||||
print("Writing to \(filename) completed")
|
print("Writing to \(filename) completed")
|
||||||
|
|
||||||
llamaState.cacheCleared = false
|
llamaState.cacheCleared = false
|
||||||
|
|
||||||
let model = Model(name: modelName, url: modelUrl, filename: filename, status: "downloaded")
|
let model = Model(name: modelName, url: modelUrl, filename: filename, status: "downloaded")
|
||||||
llamaState.downloadedModels.append(model)
|
llamaState.downloadedModels.append(model)
|
||||||
status = "downloaded"
|
status = "downloaded"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue