fix: update protocol models and android parsing
This commit is contained in:
@@ -186,9 +186,10 @@ object ToolDisplayRegistry {
|
||||
if (firstLine.isEmpty()) return null
|
||||
return if (firstLine.length > 160) "${firstLine.take(157)}…" else firstLine
|
||||
}
|
||||
value.booleanOrNull?.let { return it.toString() }
|
||||
value.longOrNull?.let { return it.toString() }
|
||||
value.doubleOrNull?.let { return it.toString() }
|
||||
val raw = value.contentOrNull?.trim().orEmpty()
|
||||
raw.toBooleanStrictOrNull()?.let { return it.toString() }
|
||||
raw.toLongOrNull()?.let { return it.toString() }
|
||||
raw.toDoubleOrNull()?.let { return it.toString() }
|
||||
}
|
||||
if (value is JsonArray) {
|
||||
val items = value.mapNotNull { renderValue(it) }
|
||||
@@ -215,6 +216,7 @@ object ToolDisplayRegistry {
|
||||
|
||||
private fun JsonElement?.asNumberOrNull(): Double? {
|
||||
val primitive = this as? JsonPrimitive ?: return null
|
||||
return primitive.doubleOrNull
|
||||
val raw = primitive.contentOrNull ?: return null
|
||||
return raw.toDoubleOrNull()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -774,23 +774,27 @@ public struct ModelChoice: Codable {
|
||||
public let name: String
|
||||
public let provider: String
|
||||
public let contextwindow: Int?
|
||||
public let reasoning: Bool?
|
||||
|
||||
public init(
|
||||
id: String,
|
||||
name: String,
|
||||
provider: String,
|
||||
contextwindow: Int?
|
||||
contextwindow: Int?,
|
||||
reasoning: Bool?
|
||||
) {
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.provider = provider
|
||||
self.contextwindow = contextwindow
|
||||
self.reasoning = reasoning
|
||||
}
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case id
|
||||
case name
|
||||
case provider
|
||||
case contextwindow = "contextWindow"
|
||||
case reasoning
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user