diff --git a/scripts/create_prompt_config.sql b/scripts/create_prompt_config.sql index ba30d5a..1b89130 100644 --- a/scripts/create_prompt_config.sql +++ b/scripts/create_prompt_config.sql @@ -29,3 +29,62 @@ CREATE TABLE IF NOT EXISTS prompt_templates ( CREATE INDEX IF NOT EXISTS idx_prompt_templates_set_id ON prompt_templates(prompt_set_id); + +-- Seed: initial prompt set for lang_agent/graphs/routing.py +-- The pipeline_id can be used by RoutingConfig.pipeline_id to load these prompts. +INSERT INTO prompt_sets (pipeline_id, name, description, is_active, list) +SELECT + 'routing', + 'default', + 'Initial prompt set for RoutingGraph nodes', + true, + '' +WHERE NOT EXISTS ( + SELECT 1 + FROM prompt_sets + WHERE pipeline_id = 'routing' + AND name = 'default' +); + +INSERT INTO prompt_templates (prompt_set_id, prompt_key, content) +SELECT ps.id, t.prompt_key, t.content +FROM prompt_sets ps +JOIN ( + VALUES + ('route_prompt', '决定用工具或者聊天'), + ('chat_prompt', '正常聊天时说什么'), + ('tool_prompt', '如何用工具') +) AS t(prompt_key, content) + ON true +WHERE ps.pipeline_id = 'routing' + AND ps.name = 'default' +ON CONFLICT (prompt_set_id, prompt_key) +DO UPDATE SET + content = EXCLUDED.content, + updated_at = now(); + +-- Seed: initial prompt set for lang_agent/graphs/react.py +-- ReactGraph uses prompt key "sys_prompt" (see default_key in build_prompt_store). +INSERT INTO prompt_sets (pipeline_id, name, description, is_active, list) +SELECT + 'react', + 'default', + 'Initial prompt set for ReactGraph', + true, + '' +WHERE NOT EXISTS ( + SELECT 1 + FROM prompt_sets + WHERE pipeline_id = 'react' + AND name = 'default' +); + +INSERT INTO prompt_templates (prompt_set_id, prompt_key, content) +SELECT ps.id, 'sys_prompt', '如何用工具' +FROM prompt_sets ps +WHERE ps.pipeline_id = 'react' + AND ps.name = 'default' +ON CONFLICT (prompt_set_id, prompt_key) +DO UPDATE SET + content = EXCLUDED.content, + updated_at = now();