feat(channels): route media messages through agent
Add writeWithImages() to AsyncAgent for passing images directly to the LLM via ImageContent. Extend Agent.run() to accept optional images parameter. Update ChannelManager.routeIncoming() to download media files and forward them: images as ImageContent to the LLM, audio/video/document as file paths for agent-driven processing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
78738e89bf
commit
23da5a35ff
3 changed files with 71 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { Agent as PiAgentCore, type AgentEvent, type AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import type { ImageContent } from "@mariozechner/pi-ai";
|
||||
import { v7 as uuidv7 } from "uuid";
|
||||
import type { AgentOptions, AgentRunResult, ReasoningMode } from "./types.js";
|
||||
import type { MulticaEvent } from "./events.js";
|
||||
|
|
@ -352,7 +353,7 @@ export class Agent {
|
|||
}
|
||||
}
|
||||
|
||||
async run(prompt: string): Promise<AgentRunResult> {
|
||||
async run(prompt: string, images?: ImageContent[]): Promise<AgentRunResult> {
|
||||
await this.ensureInitialized();
|
||||
this.output.state.lastAssistantText = "";
|
||||
|
||||
|
|
@ -362,7 +363,7 @@ export class Agent {
|
|||
// Loop to exhaust all candidate profiles on rotatable errors
|
||||
while (true) {
|
||||
try {
|
||||
await this.agent.prompt(prompt);
|
||||
await this.agent.prompt(prompt, images);
|
||||
break; // success — exit loop
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue