feat(industry): Phase 1 行业配置基础 — 数据模型 + 四行业内置配置 + ButlerRouter 动态关键词
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- 新增 SaaS industry 模块 (types/service/handlers/mod/builtin) - 4 行业内置配置: healthcare/education/garment/ecommerce - 数据库迁移: industries + account_industries 表 - 8 个 API 端点 (CRUD + 用户行业关联) - ButlerRouter 改造: 支持 IndustryKeywordConfig 动态注入 - 12 个测试全通过 (含动态行业分类测试)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
-- 行业配置表
|
||||
CREATE TABLE IF NOT EXISTS industries (
|
||||
id TEXT PRIMARY KEY, -- "healthcare" | "education" | "garment" | "ecommerce"
|
||||
name TEXT NOT NULL, -- "医疗行政"
|
||||
icon TEXT NOT NULL DEFAULT '', -- emoji 或图标标识
|
||||
description TEXT NOT NULL DEFAULT '', -- 行业描述
|
||||
keywords JSONB NOT NULL DEFAULT '[]', -- 行业关键词列表
|
||||
system_prompt TEXT NOT NULL DEFAULT '', -- 行业 system prompt 片段
|
||||
cold_start_template TEXT NOT NULL DEFAULT '', -- 冷启动问候模板
|
||||
pain_seed_categories JSONB NOT NULL DEFAULT '[]', -- 痛点种子类别
|
||||
skill_priorities JSONB NOT NULL DEFAULT '[]', -- 技能推荐优先级
|
||||
status TEXT NOT NULL DEFAULT 'active', -- "active" | "disabled"
|
||||
source TEXT NOT NULL DEFAULT 'builtin', -- "builtin" | "admin"
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- 用户-行业关联表(多对多)
|
||||
CREATE TABLE IF NOT EXISTS account_industries (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
account_id TEXT NOT NULL REFERENCES accounts(id) ON DELETE CASCADE,
|
||||
industry_id TEXT NOT NULL REFERENCES industries(id) ON DELETE CASCADE,
|
||||
is_primary BOOLEAN NOT NULL DEFAULT false,
|
||||
custom_config JSONB, -- Admin 可覆盖的配置
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
CONSTRAINT uq_account_industry UNIQUE (account_id, industry_id)
|
||||
);
|
||||
|
||||
-- 索引
|
||||
CREATE INDEX IF NOT EXISTS idx_account_industries_account ON account_industries(account_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_account_industries_industry ON account_industries(industry_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_industries_status ON industries(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_industries_source ON industries(source);
|
||||
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS account_industries;
|
||||
DROP TABLE IF EXISTS industries;
|
||||
Reference in New Issue
Block a user