mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-20 03:47:06 +00:00
feat(ios): switch models for every agent in session settings
The settings sheet only had model pickers for Claude and Codex; other
agents could not change models after creation. Live sessions now load
/sessions/:id/<flavor>-models. Agy uses its machine catalog, since it
has no session route. As on web, grok and copilot skip
terminal-controlled sessions.
Rows follow web getModelOptionsForFlavor:
- Copilot, dsh, grok and kimi offer a Default or Auto row that clears
the model.
- Cursor's Auto is the explicit 'auto' wire id.
- Opencode, agy and pi only switch between listed models.
- An unlisted current model stays visible.
Pi resolves provider/modelId from metadata.piSelectedModel and switches
with a {provider, modelId} reference.
Efforts:
- Grok and OpenCode options come from their *-reasoning-effort-options
routes and reload after a model switch. OpenCode options that still
describe the previous model stay hidden.
- Pi shows the current model's thinking levels.
The sheet's load-failure flag now covers every catalog, not just Codex.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d01f03eef7
commit
1efcc3183d
@@ -78,6 +78,17 @@ public struct SessionCapabilities: Codable, Equatable, Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
/// `metadata.piSelectedModel` and the Pi `{provider, modelId}` model switch.
|
||||
public struct PiModelReference: Codable, Equatable, Sendable {
|
||||
public var provider: String
|
||||
public var modelId: String
|
||||
|
||||
public init(provider: String, modelId: String) {
|
||||
self.provider = provider
|
||||
self.modelId = modelId
|
||||
}
|
||||
}
|
||||
|
||||
/// Typed subset of the session `metadata` blob (`MetadataSchema`,
|
||||
/// `shared/src/schemas.ts:54-163`) covering what the app renders.
|
||||
///
|
||||
@@ -125,6 +136,8 @@ public struct SessionMetadata: Codable, Equatable, Sendable {
|
||||
public var kimiSessionId: String?
|
||||
public var copilotSessionId: String?
|
||||
public var piSessionId: String?
|
||||
/// Pi model with its provider (`session.model` holds only the id).
|
||||
public var piSelectedModel: PiModelReference?
|
||||
|
||||
public init(
|
||||
path: String,
|
||||
@@ -151,7 +164,8 @@ public struct SessionMetadata: Codable, Equatable, Sendable {
|
||||
cursorSessionId: String? = nil,
|
||||
kimiSessionId: String? = nil,
|
||||
copilotSessionId: String? = nil,
|
||||
piSessionId: String? = nil
|
||||
piSessionId: String? = nil,
|
||||
piSelectedModel: PiModelReference? = nil
|
||||
) {
|
||||
self.path = path
|
||||
self.host = host
|
||||
@@ -178,5 +192,6 @@ public struct SessionMetadata: Codable, Equatable, Sendable {
|
||||
self.kimiSessionId = kimiSessionId
|
||||
self.copilotSessionId = copilotSessionId
|
||||
self.piSessionId = piSessionId
|
||||
self.piSelectedModel = piSelectedModel
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user