-- 知识库 + 助手种子数据(依赖 seed_credentials.sql 先灌入 model_xxx 凭证)。 -- -- 用法(从仓库根目录): -- docker compose exec -T postgres psql -U postgres -d postgres < backend/db/seed_assistants.sql -- 或:make db-seed-assistants(凭证已就绪时);make db-seed 会按顺序全灌。 -- -- 说明: -- * id 固定(kb_001 / asst_001..005)+ ON CONFLICT 幂等,可重复执行。 -- * 引用 seed_credentials 的 model_001(LLM)/003(ASR)/005(TTS)/010(Embedding)。 -- * 宽表 STI:瘦类型用真列(prompt/api_url/api_key/app_id),workflow 用 graph 列。 -- * api_key 在库里明文(读取走 API 才打码),这里填示例占位。 -- 知识库(引用 Embedding 凭证 model_010) INSERT INTO knowledge_bases (id, name, description, embedding_credential_id, status) VALUES ('kb_001', '政务政策知识库', '政策解读 / 办事指南示例库', 'model_010', 'active') ON CONFLICT (id) DO NOTHING; -- 助手(一种类型一条) INSERT INTO assistants ( id, name, type, runtime_mode, greeting, enable_interrupt, llm_credential_id, asr_credential_id, tts_credential_id, realtime_credential_id, knowledge_base_id, prompt, api_url, api_key, app_id, graph ) VALUES -- 提示词:llm/asr/tts + 知识库,prompt 真列 ('asst_001', '政务咨询助手', 'prompt', 'pipeline', '您好,我是政务助手,请问有什么可以帮您?', TRUE, 'model_001', 'model_003', 'model_005', NULL, 'kb_001', '你是一名专业的政务咨询助手,回答准确、简洁,不编造政策内容。', '', '', '', '{}'), -- 工作流:asr/tts + graph 列(最小图) ('asst_002', '热线工单助手', 'workflow', 'pipeline', '', TRUE, NULL, 'model_003', 'model_005', NULL, NULL, '', '', '', '', '{"nodes":[{"id":"1","type":"startCall","position":{"x":0,"y":0},"data":{"name":"开场","prompt":"你好,请问需要办理什么业务?"}}],"edges":[]}'), -- Dify:asr/tts + api_url/api_key ('asst_003', 'Dify 客服助手', 'dify', 'pipeline', '', TRUE, NULL, 'model_003', 'model_005', NULL, NULL, '', 'https://api.dify.ai/v1', 'app-dify-demo-key', '', '{}'), -- FastGPT:asr/tts + app_id/api_url/api_key ('asst_004', 'FastGPT 售后助手', 'fastgpt', 'pipeline', '', TRUE, NULL, 'model_003', 'model_005', NULL, NULL, '', 'https://api.fastgpt.in/api/v1/chat/completions', 'fastgpt-demo-key', 'app-fastgpt-001', '{}'), -- OpenCode:asr/tts + prompt/api_url/api_key ('asst_005', 'OpenCode 代码助手', 'opencode', 'pipeline', '', TRUE, NULL, 'model_003', 'model_005', NULL, NULL, '你是一个代码助手的语音界面,用简洁口语回答工程问题。', 'http://localhost:4096', 'opencode-demo-key', '', '{}') ON CONFLICT (id) DO NOTHING;