mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 04:02:21 +00:00
Fix hook message duplication in TUI
Two bugs: 1. createCustomMessage was returning role: 'user' instead of preserving the hook message structure (role: 'hookMessage', customType, etc.) 2. rebuildChatFromMessages wasn't clearing the container before rebuilding
This commit is contained in:
parent
01c4e879a1
commit
ecef601d19
2 changed files with 6 additions and 2 deletions
|
|
@ -165,10 +165,13 @@ export function createSummaryMessage(summary: string, timestamp: string): AgentM
|
||||||
/** Convert CustomMessageEntry to AgentMessage format */
|
/** Convert CustomMessageEntry to AgentMessage format */
|
||||||
function createCustomMessage(entry: CustomMessageEntry): AgentMessage {
|
function createCustomMessage(entry: CustomMessageEntry): AgentMessage {
|
||||||
return {
|
return {
|
||||||
role: "user",
|
role: "hookMessage",
|
||||||
|
customType: entry.customType,
|
||||||
content: entry.content,
|
content: entry.content,
|
||||||
|
display: entry.display,
|
||||||
|
details: entry.details,
|
||||||
timestamp: new Date(entry.timestamp).getTime(),
|
timestamp: new Date(entry.timestamp).getTime(),
|
||||||
};
|
} as AgentMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Generate a unique short ID (8 hex chars, collision-checked) */
|
/** Generate a unique short ID (8 hex chars, collision-checked) */
|
||||||
|
|
|
||||||
|
|
@ -1208,6 +1208,7 @@ export class InteractiveMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
private rebuildChatFromMessages(): void {
|
private rebuildChatFromMessages(): void {
|
||||||
|
this.chatContainer.clear();
|
||||||
const context = this.sessionManager.buildSessionContext();
|
const context = this.sessionManager.buildSessionContext();
|
||||||
this.renderSessionContext(context);
|
this.renderSessionContext(context);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue