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