- Introduce a new model structure for managing interface definitions and model resources, enhancing the backend's capability to handle various service integrations. - Update the Makefile to reflect changes in database seeding and resource management commands. - Remove the deprecated credentials management routes and replace them with a unified model registry API. - Modify existing routes and schemas to align with the new model structure, ensuring seamless integration with the frontend. - Enhance database seeding scripts to populate new model resources and their configurations. - Update README documentation to reflect the new architecture and usage instructions for model resources and interface definitions.
43 lines
2.2 KiB
SQL
43 lines
2.2 KiB
SQL
-- 知识库 + 助手种子数据。依赖 seed_model_resources.sql。
|
|
|
|
INSERT INTO knowledge_bases
|
|
(id, name, description, embedding_model_resource_id, status)
|
|
VALUES
|
|
('kb_001', '政务政策知识库', '政策解读 / 办事指南示例库', 'model_003', 'active')
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
INSERT INTO assistants (
|
|
id, name, type, runtime_mode, greeting, enable_interrupt,
|
|
knowledge_base_id, prompt, api_url, api_key, app_id, graph
|
|
) VALUES
|
|
('asst_001', '政务咨询助手', 'prompt', 'pipeline', '您好,我是政务助手,请问有什么可以帮您?', TRUE,
|
|
'kb_001', '你是一名专业的政务咨询助手,回答准确、简洁,不编造政策内容。', '', '', '', '{}'),
|
|
('asst_002', '热线工单助手', 'workflow', 'pipeline', '', TRUE,
|
|
NULL, '', '', '', '',
|
|
'{"nodes":[{"id":"1","type":"startCall","position":{"x":0,"y":0},"data":{"name":"开场","prompt":"你好,请问需要办理什么业务?"}}],"edges":[]}'),
|
|
('asst_003', 'Dify 客服助手', 'dify', 'pipeline', '', TRUE,
|
|
NULL, '', 'https://api.dify.ai/v1', 'app-dify-demo-key', '', '{}'),
|
|
('asst_004', 'FastGPT 售后助手', 'fastgpt', 'pipeline', '', TRUE,
|
|
NULL, '', 'https://api.fastgpt.in/api/v1/chat/completions', 'fastgpt-demo-key', 'app-fastgpt-001', '{}'),
|
|
('asst_005', 'OpenCode 代码助手', 'opencode', 'pipeline', '', TRUE,
|
|
NULL, '你是一个代码助手的语音界面,用简洁口语回答工程问题。', 'http://localhost:4096', 'opencode-demo-key', '', '{}')
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
INSERT INTO assistant_model_bindings
|
|
(assistant_id, capability, model_resource_id, config)
|
|
VALUES
|
|
('asst_001', 'LLM', 'model_001', '{}'),
|
|
('asst_001', 'ASR', 'model_002', '{}'),
|
|
('asst_001', 'TTS', 'model_004', '{}'),
|
|
('asst_002', 'ASR', 'model_002', '{}'),
|
|
('asst_002', 'TTS', 'model_004', '{}'),
|
|
('asst_003', 'ASR', 'model_002', '{}'),
|
|
('asst_003', 'TTS', 'model_004', '{}'),
|
|
('asst_004', 'ASR', 'model_002', '{}'),
|
|
('asst_004', 'TTS', 'model_004', '{}'),
|
|
('asst_005', 'ASR', 'model_002', '{}'),
|
|
('asst_005', 'TTS', 'model_004', '{}')
|
|
ON CONFLICT (assistant_id, capability) DO UPDATE SET
|
|
model_resource_id = EXCLUDED.model_resource_id,
|
|
updated_at = now();
|