mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 12:00:15 +00:00
Add thinking level persistence and fix UI issues
- Save and restore thinking level when continuing sessions - Fix thinking level confirmation message spacing and styling - Fix thinking text wrapping to preserve ANSI formatting across lines
This commit is contained in:
parent
159075cad7
commit
7beb354337
4 changed files with 37 additions and 7 deletions
|
|
@ -19,6 +19,7 @@ export interface SessionHeader {
|
|||
cwd: string;
|
||||
systemPrompt: string;
|
||||
model: string;
|
||||
thinkingLevel: string;
|
||||
}
|
||||
|
||||
export interface SessionMessageEntry {
|
||||
|
|
@ -115,6 +116,7 @@ export class SessionManager {
|
|||
cwd: process.cwd(),
|
||||
systemPrompt: state.systemPrompt,
|
||||
model: `${state.model.provider}/${state.model.id}`,
|
||||
thinkingLevel: state.thinkingLevel,
|
||||
};
|
||||
appendFileSync(this.sessionFile, JSON.stringify(entry) + "\n");
|
||||
}
|
||||
|
|
@ -157,6 +159,27 @@ export class SessionManager {
|
|||
return messages;
|
||||
}
|
||||
|
||||
loadThinkingLevel(): string {
|
||||
if (!existsSync(this.sessionFile)) return "off";
|
||||
|
||||
const lines = readFileSync(this.sessionFile, "utf8").trim().split("\n");
|
||||
|
||||
// Find the most recent session header with thinking level
|
||||
let lastThinkingLevel = "off";
|
||||
for (const line of lines) {
|
||||
try {
|
||||
const entry = JSON.parse(line);
|
||||
if (entry.type === "session" && entry.thinkingLevel) {
|
||||
lastThinkingLevel = entry.thinkingLevel;
|
||||
}
|
||||
} catch {
|
||||
// Skip malformed lines
|
||||
}
|
||||
}
|
||||
|
||||
return lastThinkingLevel;
|
||||
}
|
||||
|
||||
getSessionId(): string {
|
||||
return this.sessionId;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue