mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 08:02:17 +00:00
Add model selector TUI and update session management
This commit is contained in:
parent
bf5f4b17c0
commit
95d040195c
4 changed files with 355 additions and 23 deletions
|
|
@ -212,6 +212,29 @@ export class SessionManager {
|
|||
return lastThinkingLevel;
|
||||
}
|
||||
|
||||
loadModel(): string | null {
|
||||
if (!existsSync(this.sessionFile)) return null;
|
||||
|
||||
const lines = readFileSync(this.sessionFile, "utf8").trim().split("\n");
|
||||
|
||||
// Find the most recent model (from session header or change event)
|
||||
let lastModel: string | null = null;
|
||||
for (const line of lines) {
|
||||
try {
|
||||
const entry = JSON.parse(line);
|
||||
if (entry.type === "session" && entry.model) {
|
||||
lastModel = entry.model;
|
||||
} else if (entry.type === "model_change" && entry.model) {
|
||||
lastModel = entry.model;
|
||||
}
|
||||
} catch {
|
||||
// Skip malformed lines
|
||||
}
|
||||
}
|
||||
|
||||
return lastModel;
|
||||
}
|
||||
|
||||
getSessionId(): string {
|
||||
return this.sessionId;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue