feat: add image generation model and generate_image agent tool

Bots can now be configured with an image generation model (must have
image-output compatibility). When set, the agent exposes a generate_image
tool that calls the model via Twilight AI SDK, saves the result to the
bot container filesystem, and returns the file path.

- Add image_model_id column to bots table (migration 0053)
- Update settings SQL queries, service, and types
- New ImageGenProvider tool provider in internal/agent/tools/
- Wire provider in both cmd/agent and cmd/memoh entry points
- Add image model selector to frontend bot settings with compat filtering
- Regenerate swagger, SDK types, and sqlc code
This commit is contained in:
Acbox
2026-04-03 01:15:57 +08:00
parent 7ce1306505
commit a9a9f7e955
19 changed files with 294 additions and 6 deletions
+1
View File
@@ -177,6 +177,7 @@ CREATE TABLE IF NOT EXISTS bots (
compaction_ratio INTEGER NOT NULL DEFAULT 80,
compaction_model_id UUID REFERENCES models(id) ON DELETE SET NULL,
title_model_id UUID REFERENCES models(id) ON DELETE SET NULL,
image_model_id UUID REFERENCES models(id) ON DELETE SET NULL,
tts_model_id UUID REFERENCES tts_models(id) ON DELETE SET NULL,
browser_context_id UUID REFERENCES browser_contexts(id) ON DELETE SET NULL,
metadata JSONB NOT NULL DEFAULT '{}'::jsonb,
@@ -0,0 +1,3 @@
-- 0053_add_image_model (rollback)
-- Remove image_model_id column from bots table
ALTER TABLE bots DROP COLUMN IF EXISTS image_model_id;
@@ -0,0 +1,3 @@
-- 0053_add_image_model
-- Add image_model_id column to bots table for image generation model configuration
ALTER TABLE bots ADD COLUMN IF NOT EXISTS image_model_id UUID REFERENCES models(id) ON DELETE SET NULL;