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