Add Agent capabilities and configurations across the application

- Extend the AssistantConfig model to include agent_interface_type, agent_values, and agent_secrets for enhanced agent management.
- Update ModelType to include "Agent" for broader capability support.
- Seed new agent models and configurations in the database for Dify, FastGPT, and OpenCode applications.
- Modify the Assistant routes to validate and handle agent capabilities.
- Implement agent resource resolution in the config resolver for runtime configuration.
- Enhance the interface catalog with agent-specific fields and definitions.
- Update frontend components to manage agent configurations, including form handling and state management for agent-related inputs.
This commit is contained in:
Xin Wang
2026-07-09 15:29:25 +08:00
parent 03478fa557
commit 54329aa516
11 changed files with 238 additions and 114 deletions

View File

@@ -39,10 +39,13 @@ VALUES
('asst_002', 'TTS', 'model_004', '{}'),
('asst_003', 'ASR', 'model_002', '{}'),
('asst_003', 'TTS', 'model_004', '{}'),
('asst_003', 'Agent', 'model_014', '{}'),
('asst_004', 'ASR', 'model_002', '{}'),
('asst_004', 'TTS', 'model_004', '{}'),
('asst_004', 'Agent', 'model_015', '{}'),
('asst_005', 'ASR', 'model_002', '{}'),
('asst_005', 'TTS', 'model_004', '{}')
('asst_005', 'TTS', 'model_004', '{}'),
('asst_005', 'Agent', 'model_016', '{}')
ON CONFLICT (assistant_id, capability) DO UPDATE SET
model_resource_id = EXCLUDED.model_resource_id,
updated_at = now();

View File

@@ -40,6 +40,22 @@ VALUES
{"key":"apiKey","label":"API Key","group":"secrets","type":"password","required":true},
{"key":"voice","label":"Voice","group":"values","type":"text","required":false}
]} $$::jsonb, TRUE, 1),
('dify', 'Dify Agent', 'Agent',
$$ {"fields":[
{"key":"apiUrl","label":"API URL","group":"values","type":"url","required":true},
{"key":"apiKey","label":"API Key","group":"secrets","type":"password","required":true}
]} $$::jsonb, TRUE, 1),
('fastgpt', 'FastGPT Agent', 'Agent',
$$ {"fields":[
{"key":"apiUrl","label":"API URL","group":"values","type":"url","required":true},
{"key":"apiKey","label":"API Key","group":"secrets","type":"password","required":true},
{"key":"appId","label":"App ID","group":"values","type":"text","required":true}
]} $$::jsonb, TRUE, 1),
('opencode', 'OpenCode Agent', 'Agent',
$$ {"fields":[
{"key":"apiUrl","label":"API URL","group":"values","type":"url","required":true},
{"key":"apiKey","label":"API Key","group":"secrets","type":"password","required":true}
]} $$::jsonb, TRUE, 1),
('stepfun-realtime', 'StepFun StepAudio Realtime', 'Realtime',
$$ {"fields":[
{"key":"modelId","label":"Model ID","group":"values","type":"text","required":true},

View File

@@ -41,6 +41,15 @@ VALUES
'{"apiKey":"replace-me"}', FALSE, TRUE, FALSE),
('model_013', 'doubao-seed-2-0-mini-260428', 'LLM', 'openai-llm',
'{"modelId":"doubao-seed-2-0-mini-260428","apiUrl":"https://ark.cn-beijing.volces.com/api/v3","temperature":0.7,"extraBody":{"thinking":{"type":"disabled"}}}',
'{"apiKey":"replace-me"}', TRUE, TRUE, FALSE)
'{"apiKey":"replace-me"}', TRUE, TRUE, FALSE),
('model_014', 'Dify 客服应用', 'Agent', 'dify',
'{"apiUrl":"https://api.dify.ai/v1/chat-messages"}',
'{"apiKey":"replace-me"}', FALSE, TRUE, FALSE),
('model_015', 'FastGPT 售后应用', 'Agent', 'fastgpt',
'{"apiUrl":"https://api.fastgpt.in/api/v1/chat/completions","appId":"app-fastgpt-001"}',
'{"apiKey":"replace-me"}', FALSE, TRUE, FALSE),
('model_016', 'OpenCode 服务', 'Agent', 'opencode',
'{"apiUrl":"http://localhost:4096"}',
'{"apiKey":"replace-me"}', FALSE, TRUE, FALSE)
-- Seed defaults must never overwrite resources configured through the UI.
ON CONFLICT (id) DO NOTHING;