mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 22:03:45 +00:00
Fix web-ui and example for new agent API
- AgentInterface composes UserMessageWithAttachments for attachments - Updated example to use convertToLlm instead of transport/messageTransformer - Fixed declaration merging: target pi-agent-core, add path to example tsconfig - Fixed typo in CustomAgentMessages key (user-with-attachment -> user-with-attachments) - customMessageTransformer properly converts UserMessageWithAttachments to content blocks
This commit is contained in:
parent
6ddc7418da
commit
7a39f9eb11
6 changed files with 70 additions and 24 deletions
|
|
@ -12,6 +12,7 @@ import type { Agent, AgentEvent } from "@mariozechner/pi-agent-core";
|
|||
import type { Attachment } from "../utils/attachment-utils.js";
|
||||
import { formatUsage } from "../utils/format.js";
|
||||
import { i18n } from "../utils/i18n.js";
|
||||
import type { UserMessageWithAttachments } from "./Messages.js";
|
||||
import type { StreamingMessageContainer } from "./StreamingMessageContainer.js";
|
||||
|
||||
@customElement("agent-interface")
|
||||
|
|
@ -202,7 +203,18 @@ export class AgentInterface extends LitElement {
|
|||
this._messageEditor.attachments = [];
|
||||
this._autoScroll = true; // Enable auto-scroll when sending a message
|
||||
|
||||
await this.session?.prompt(input, attachments);
|
||||
// Compose message with attachments if any
|
||||
if (attachments && attachments.length > 0) {
|
||||
const message: UserMessageWithAttachments = {
|
||||
role: "user-with-attachments",
|
||||
content: input,
|
||||
attachments,
|
||||
timestamp: Date.now(),
|
||||
};
|
||||
await this.session?.prompt(message);
|
||||
} else {
|
||||
await this.session?.prompt(input);
|
||||
}
|
||||
}
|
||||
|
||||
private renderMessages() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue