mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 17:01:53 +03:00
mac: streamline model config UI
This commit is contained in:
@@ -1486,15 +1486,6 @@ struct ConfigSettings: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LabeledContent("Context tokens") {
|
|
||||||
TextField("Optional", text: self.$configContextTokens)
|
|
||||||
.textFieldStyle(.roundedBorder)
|
|
||||||
.frame(width: 160)
|
|
||||||
.onChange(of: self.configContextTokens) { _, _ in
|
|
||||||
self.autosaveConfig()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
@@ -1525,7 +1516,6 @@ struct ConfigSettings: View {
|
|||||||
guard let data = try? Data(contentsOf: url) else {
|
guard let data = try? Data(contentsOf: url) else {
|
||||||
self.configModel = SessionLoader.fallbackModel
|
self.configModel = SessionLoader.fallbackModel
|
||||||
self.configStorePath = SessionLoader.defaultStorePath
|
self.configStorePath = SessionLoader.defaultStorePath
|
||||||
self.configContextTokens = ""
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
guard
|
guard
|
||||||
@@ -1547,11 +1537,6 @@ struct ConfigSettings: View {
|
|||||||
self.configModel = SessionLoader.fallbackModel
|
self.configModel = SessionLoader.fallbackModel
|
||||||
self.customModel = SessionLoader.fallbackModel
|
self.customModel = SessionLoader.fallbackModel
|
||||||
}
|
}
|
||||||
if let ctx = (agent?["contextTokens"] as? NSNumber)?.intValue {
|
|
||||||
self.configContextTokens = "\(ctx)"
|
|
||||||
} else {
|
|
||||||
self.configContextTokens = ""
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func autosaveConfig() {
|
private func autosaveConfig() {
|
||||||
@@ -1564,7 +1549,6 @@ struct ConfigSettings: View {
|
|||||||
self.configSaving = true
|
self.configSaving = true
|
||||||
defer { self.configSaving = false }
|
defer { self.configSaving = false }
|
||||||
|
|
||||||
let ctxTokens: Int? = Int(self.configContextTokens.trimmingCharacters(in: .whitespacesAndNewlines))
|
|
||||||
var session: [String: Any] = [:]
|
var session: [String: Any] = [:]
|
||||||
var agent: [String: Any] = [:]
|
var agent: [String: Any] = [:]
|
||||||
|
|
||||||
@@ -1575,7 +1559,6 @@ struct ConfigSettings: View {
|
|||||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
let trimmedModel = chosenModel
|
let trimmedModel = chosenModel
|
||||||
if !trimmedModel.isEmpty { agent["model"] = trimmedModel }
|
if !trimmedModel.isEmpty { agent["model"] = trimmedModel }
|
||||||
if let ctxTokens { agent["contextTokens"] = ctxTokens }
|
|
||||||
|
|
||||||
let reply: [String: Any] = [
|
let reply: [String: Any] = [
|
||||||
"session": session,
|
"session": session,
|
||||||
|
|||||||
Reference in New Issue
Block a user