mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
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:
@@ -16,6 +16,7 @@ SELECT
|
||||
title_models.id AS title_model_id,
|
||||
search_providers.id AS search_provider_id,
|
||||
memory_providers.id AS memory_provider_id,
|
||||
image_models.id AS image_model_id,
|
||||
tts_models.id AS tts_model_id,
|
||||
browser_contexts.id AS browser_context_id
|
||||
FROM bots
|
||||
@@ -23,6 +24,7 @@ LEFT JOIN models AS chat_models ON chat_models.id = bots.chat_model_id
|
||||
LEFT JOIN models AS heartbeat_models ON heartbeat_models.id = bots.heartbeat_model_id
|
||||
LEFT JOIN models AS compaction_models ON compaction_models.id = bots.compaction_model_id
|
||||
LEFT JOIN models AS title_models ON title_models.id = bots.title_model_id
|
||||
LEFT JOIN models AS image_models ON image_models.id = bots.image_model_id
|
||||
LEFT JOIN search_providers ON search_providers.id = bots.search_provider_id
|
||||
LEFT JOIN memory_providers ON memory_providers.id = bots.memory_provider_id
|
||||
LEFT JOIN tts_models ON tts_models.id = bots.tts_model_id
|
||||
@@ -47,11 +49,12 @@ WITH updated AS (
|
||||
title_model_id = COALESCE(sqlc.narg(title_model_id)::uuid, bots.title_model_id),
|
||||
search_provider_id = COALESCE(sqlc.narg(search_provider_id)::uuid, bots.search_provider_id),
|
||||
memory_provider_id = COALESCE(sqlc.narg(memory_provider_id)::uuid, bots.memory_provider_id),
|
||||
image_model_id = COALESCE(sqlc.narg(image_model_id)::uuid, bots.image_model_id),
|
||||
tts_model_id = COALESCE(sqlc.narg(tts_model_id)::uuid, bots.tts_model_id),
|
||||
browser_context_id = COALESCE(sqlc.narg(browser_context_id)::uuid, bots.browser_context_id),
|
||||
updated_at = now()
|
||||
WHERE bots.id = sqlc.arg(id)
|
||||
RETURNING bots.id, bots.language, bots.reasoning_enabled, bots.reasoning_effort, bots.heartbeat_enabled, bots.heartbeat_interval, bots.heartbeat_prompt, bots.compaction_enabled, bots.compaction_threshold, bots.compaction_ratio, bots.chat_model_id, bots.heartbeat_model_id, bots.compaction_model_id, bots.title_model_id, bots.search_provider_id, bots.memory_provider_id, bots.tts_model_id, bots.browser_context_id
|
||||
RETURNING bots.id, bots.language, bots.reasoning_enabled, bots.reasoning_effort, bots.heartbeat_enabled, bots.heartbeat_interval, bots.heartbeat_prompt, bots.compaction_enabled, bots.compaction_threshold, bots.compaction_ratio, bots.chat_model_id, bots.heartbeat_model_id, bots.compaction_model_id, bots.title_model_id, bots.image_model_id, bots.search_provider_id, bots.memory_provider_id, bots.tts_model_id, bots.browser_context_id
|
||||
)
|
||||
SELECT
|
||||
updated.id AS bot_id,
|
||||
@@ -70,6 +73,7 @@ SELECT
|
||||
title_models.id AS title_model_id,
|
||||
search_providers.id AS search_provider_id,
|
||||
memory_providers.id AS memory_provider_id,
|
||||
image_models.id AS image_model_id,
|
||||
tts_models.id AS tts_model_id,
|
||||
browser_contexts.id AS browser_context_id
|
||||
FROM updated
|
||||
@@ -77,6 +81,7 @@ LEFT JOIN models AS chat_models ON chat_models.id = updated.chat_model_id
|
||||
LEFT JOIN models AS heartbeat_models ON heartbeat_models.id = updated.heartbeat_model_id
|
||||
LEFT JOIN models AS compaction_models ON compaction_models.id = updated.compaction_model_id
|
||||
LEFT JOIN models AS title_models ON title_models.id = updated.title_model_id
|
||||
LEFT JOIN models AS image_models ON image_models.id = updated.image_model_id
|
||||
LEFT JOIN search_providers ON search_providers.id = updated.search_provider_id
|
||||
LEFT JOIN memory_providers ON memory_providers.id = updated.memory_provider_id
|
||||
LEFT JOIN tts_models ON tts_models.id = updated.tts_model_id
|
||||
@@ -97,6 +102,7 @@ SET language = 'auto',
|
||||
heartbeat_model_id = NULL,
|
||||
compaction_model_id = NULL,
|
||||
title_model_id = NULL,
|
||||
image_model_id = NULL,
|
||||
search_provider_id = NULL,
|
||||
memory_provider_id = NULL,
|
||||
tts_model_id = NULL,
|
||||
|
||||
Reference in New Issue
Block a user