mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 20:03:05 +00:00
feat(tui): add prompt history navigation with Up/Down arrows
- Browse previously submitted prompts using Up/Down arrow keys - History is session-scoped and stores up to 100 entries - Load history from session on continue/resume - Includes 15 tests for history navigation fixes #121
This commit is contained in:
parent
c550ed2bca
commit
3a5185c5fd
2 changed files with 17 additions and 1 deletions
|
|
@ -881,6 +881,22 @@ export class TuiRenderer {
|
|||
}
|
||||
// Clear pending tools after rendering initial messages
|
||||
this.pendingTools.clear();
|
||||
|
||||
// Populate editor history with user messages from the session (oldest first so newest is at index 0)
|
||||
for (const message of state.messages) {
|
||||
if (message.role === "user") {
|
||||
const textBlocks =
|
||||
typeof message.content === "string"
|
||||
? [{ type: "text", text: message.content }]
|
||||
: message.content.filter((c) => c.type === "text");
|
||||
const textContent = textBlocks.map((c) => c.text).join("");
|
||||
// Skip compaction summary messages
|
||||
if (textContent && !textContent.startsWith(SUMMARY_PREFIX)) {
|
||||
this.editor.addToHistory(textContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.ui.requestRender();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue