Skip to content

Telegram: send image output back to users #34

@vaayne

Description

@vaayne

Summary

When tools return image content (e.g., image generation tools like DALL-E, Stable Diffusion), the generated images should be sent back to the Telegram user as photos.

Current State

The ImageEvent plumbing exists in the stream pipeline (added in #29), but nothing produces image events because:

  1. tool.Tool.Execute() returns string only
  2. engine.ToolFunc returns aitypes.TextContent only
  3. GoRunner.buildToolSet() wraps tool results as TextContent

Proposed Changes

  1. Change engine.ToolFunc to return []aitypes.ContentBlock instead of TextContent
  2. Update tool_execution.go to pass content blocks through directly
  3. Update GoRunner.buildToolSet() to wrap text tools into []ContentBlock
  4. In convertLoopEvent for ToolFinished, emit ImageEvent for ImageContent blocks
  5. Optionally add a MultimodalTool interface for tools that return []ContentBlock

The Telegram side already handles ImageEvent — it collects images during streaming and sends them as tele.Photo after the text response.

Related

Follow-up from #29 (image input support).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions