feat(market): 采用元宝岗位/职能分类(14类)替代人群场景 + AI验证期自动归类

This commit is contained in:
QihuAI Design committed 2026-07-17 15:22:57 +08:00
1 parent 9bcf15099f
commit fe051bd9f3
3 files changed
+47 -74

No files matched your search

+18 -32
View File
@@ -210,35 +210,21 @@ def verify_agent_connectivity(platform: str, endpoint: str, api_key: str) -> dic
# ===== 业务场景分类(面向用户的技能/MCP 分类,与后端模型路由的 capability_registry 解耦) =====
# 注意:MarketApp.capability 列在此存放「业务场景 id」(见 MARKET_SCENES),不再是 text/vision 等模型能力。
MARKET_SCENES: list = [
# 自由职业者
{"id": "freelance_content", "label": "内容创作/自媒体", "color": "#F59E0B", "group": "freelance"},
{"id": "freelance_client", "label": "客户沟通/提案", "color": "#F97316", "group": "freelance"},
{"id": "freelance_finance", "label": "报价合同/记账", "color": "#FBBF24", "group": "freelance"},
# 上班从业者
{"id": "office_doc", "label": "文档/会议纪要", "color": "#3B82F6", "group": "office"},
{"id": "office_data", "label": "数据/报表分析", "color": "#6366F1", "group": "office"},
{"id": "office_email", "label": "邮件/协作", "color": "#0EA5E9", "group": "office"},
{"id": "office_pm", "label": "项目/周报", "color": "#8B5CF6", "group": "office"},
# 育人教育者
{"id": "edu_prepare", "label": "备课/课件", "color": "#10B981", "group": "educator"},
{"id": "edu_grade", "label": "作业批改/测评", "color": "#14B8A6", "group": "educator"},
{"id": "edu_tutor", "label": "学情辅导/答疑", "color": "#22C55E", "group": "educator"},
{"id": "edu_home", "label": "家校沟通", "color": "#84CC16", "group": "educator"},
# 电商创业
{"id": "biz_product", "label": "商品/营销文案", "color": "#EC4899", "group": "commerce"},
{"id": "biz_service", "label": "客服/转化", "color": "#F43F5E", "group": "commerce"},
{"id": "biz_ops", "label": "运营/投放", "color": "#D946EF", "group": "commerce"},
# 通用提效
{"id": "general_write", "label": "通用写作", "color": "#64748B", "group": "general"},
{"id": "general_research", "label": "资料/调研", "color": "#06B6D4", "group": "general"},
{"id": "general_agent", "label": "智能体/自动化", "color": "#A855F7", "group": "general"},
]
SCENE_GROUPS: list = [
{"id": "freelance", "label": "自由职业者"},
{"id": "office", "label": "上班从业者"},
{"id": "educator", "label": "育人教育者"},
{"id": "commerce", "label": "电商创业"},
{"id": "general", "label": "通用提效"},
# 元宝生成的「岗位 / 职能」分类(面向使用者视角,与后端模型路由能力解耦)
{"id": "design", "label": "🎨 做设计", "color": "#EC4899", "desc": "页面、UI、视觉"},
{"id": "frontend", "label": "💻 写前端", "color": "#3B82F6", "desc": "Web 页面、React、Next.js"},
{"id": "mobile", "label": "📱 做移动端", "color": "#06B6D4", "desc": "React Native、Expo"},
{"id": "backend", "label": "🧪 后端/全栈", "color": "#8B5CF6", "desc": "API、数据库、TypeScript"},
{"id": "qa", "label": "🧪 测试质量", "color": "#6366F1", "desc": "TDD、Playwright、验证"},
{"id": "search", "label": "🔍 搜索信息", "color": "#0EA5E9", "desc": "网页抓取、质疑、SEO"},
{"id": "docs", "label": "✍️ 写文档", "color": "#F59E0B", "desc": "Word/PPT/PDF、文案、PRD"},
{"id": "marketing", "label": "📢 推广获客", "color": "#F43F5E", "desc": "营销、社媒、邮件、定价"},
{"id": "workflow", "label": "🔄 工作流", "color": "#14B8A6", "desc": "计划、调试、分级、原型"},
{"id": "secops", "label": "🛡️ 安全运维", "color": "#EF4444", "desc": "安全审计、Azure、K8s"},
{"id": "learning", "label": "🎓 学习教学", "color": "#10B981", "desc": "教学、提问、架构改进"},
{"id": "video", "label": "🎬 视频多媒体", "color": "#D946EF", "desc": "AI视频、数字人"},
{"id": "collab", "label": "🏢 办公协作", "color": "#64748B", "desc": "飞书全家桶"},
{"id": "ai", "label": "🛠️ AI能力", "color": "#A855F7", "desc": "创建Skill、代码审查、统计"},
]
_VALID_SCENE_IDS = {s["id"] for s in MARKET_SCENES}
@@ -264,10 +250,10 @@ def _classify_scene(name: str, description: Optional[str], content: Optional[str
)
if not api_url:
return None
options = "、".join(f"{s['id']}({s['label']})" for s in MARKET_SCENES)
options = "、".join(f"{s['id']}({s['label']}:{s.get('desc','')})" for s in MARKET_SCENES)
sys_prompt = (
"你是 AI 应用市场的『业务场景分类器』。请站在使用者视角,根据应用名称、描述与内容,"
"判断它最常被哪一类【人群 / 岗位 / 业务场景】的用户使用,并归类到下列场景之一:"
"你是 AI 应用市场的『技能场景分类器』。请站在使用者视角,根据应用名称、描述与内容,"
"判断它最贴合下列哪一类【岗位 / 职能 / 业务场景】,并归类到对应 id:"
f"{options}。\n只返回一个 JSON 对象:{{\"capability\": \"<id>\"}},不要任何额外解释或 Markdown。"
)
user_text = f"名称:{name}\n描述:{description or ''}\n内容摘要:{(content or '')[:2000]}"
+18 -42
View File
@@ -183,42 +183,23 @@ const typeIcons: Record<AppType, React.ReactNode> = {
};
// ===== 业务场景分类(面向用户的技能/MCP 分类,与后端模型路由能力解耦) =====
// 两级:人群大类(SCENE_GROUPS) -> 业务场景(SCENES)。id 与后端 MARKET_SCENES 保持一致。
const SCENES: { id: string; label: string; color: string; group: string }[] = [
// 自由职业者
{ id: 'freelance_content', label: '内容创作/自媒体', color: '#F59E0B', group: 'freelance' },
{ id: 'freelance_client', label: '客户沟通/提案', color: '#F97316', group: 'freelance' },
{ id: 'freelance_finance', label: '报价合同/记账', color: '#FBBF24', group: 'freelance' },
// 上班从业者
{ id: 'office_doc', label: '文档/会议纪要', color: '#3B82F6', group: 'office' },
{ id: 'office_data', label: '数据/报表分析', color: '#6366F1', group: 'office' },
{ id: 'office_email', label: '邮件/协作', color: '#0EA5E9', group: 'office' },
{ id: 'office_pm', label: '项目/周报', color: '#8B5CF6', group: 'office' },
// 育人教育者
{ id: 'edu_prepare', label: '备课/课件', color: '#10B981', group: 'educator' },
{ id: 'edu_grade', label: '作业批改/测评', color: '#14B8A6', group: 'educator' },
{ id: 'edu_tutor', label: '学情辅导/答疑', color: '#22C55E', group: 'educator' },
{ id: 'edu_home', label: '家校沟通', color: '#84CC16', group: 'educator' },
// 电商创业
{ id: 'biz_product', label: '商品/营销文案', color: '#EC4899', group: 'commerce' },
{ id: 'biz_service', label: '客服/转化', color: '#F43F5E', group: 'commerce' },
{ id: 'biz_ops', label: '运营/投放', color: '#D946EF', group: 'commerce' },
// 通用提效
{ id: 'general_write', label: '通用写作', color: '#64748B', group: 'general' },
{ id: 'general_research', label: '资料/调研', color: '#06B6D4', group: 'general' },
{ id: 'general_agent', label: '智能体/自动化', color: '#A855F7', group: 'general' },
// 技能/MCP 场景分类(与后端 MARKET_SCENES 保持一致,元宝生成的岗位/职能视角,扁平展示)。
const SCENES: { id: string; label: string; color: string }[] = [
{ id: 'design', label: '🎨 做设计', color: '#EC4899' },
{ id: 'frontend', label: '💻 写前端', color: '#3B82F6' },
{ id: 'mobile', label: '📱 做移动端', color: '#06B6D4' },
{ id: 'backend', label: '🧪 后端/全栈', color: '#8B5CF6' },
{ id: 'qa', label: '🧪 测试质量', color: '#6366F1' },
{ id: 'search', label: '🔍 搜索信息', color: '#0EA5E9' },
{ id: 'docs', label: '✍️ 写文档', color: '#F59E0B' },
{ id: 'marketing', label: '📢 推广获客', color: '#F43F5E' },
{ id: 'workflow', label: '🔄 工作流', color: '#14B8A6' },
{ id: 'secops', label: '🛡️ 安全运维', color: '#EF4444' },
{ id: 'learning', label: '🎓 学习教学', color: '#10B981' },
{ id: 'video', label: '🎬 视频多媒体', color: '#D946EF' },
{ id: 'collab', label: '🏢 办公协作', color: '#64748B' },
{ id: 'ai', label: '🛠️ AI能力', color: '#A855F7' },
];
const SCENE_GROUPS: { id: string; label: string }[] = [
{ id: 'freelance', label: '自由职业者' },
{ id: 'office', label: '上班从业者' },
{ id: 'educator', label: '育人教育者' },
{ id: 'commerce', label: '电商创业' },
{ id: 'general', label: '通用提效' },
];
const SCENE_BY_GROUP: Record<string, typeof SCENES> = SCENE_GROUPS.reduce((acc, g) => {
acc[g.id] = SCENES.filter(s => s.group === g.id);
return acc;
}, {} as Record<string, typeof SCENES>);
function CapabilityBadge({ capability }: { capability?: string | null }) {
if (!capability) return null;
@@ -1822,16 +1803,13 @@ const MarketPage: React.FC = () => {
</div>
)}
{/* 业务场景筛选(按人群分组) */}
{/* 业务场景筛选(岗位/职能视角,扁平) */}
<div className="capability-filter">
<button
className={`cap-chip ${!capabilityFilter ? 'active' : ''}`}
onClick={() => setCapabilityFilter(null)}
>全部场景</button>
{SCENE_GROUPS.map(g => (
<React.Fragment key={g.id}>
<span className="cap-group-label">{g.label}</span>
{SCENE_BY_GROUP[g.id].map(c => (
{SCENES.map(c => (
<button
key={c.id}
className={`cap-chip ${capabilityFilter === c.id ? 'active' : ''}`}
@@ -1839,8 +1817,6 @@ const MarketPage: React.FC = () => {
onClick={() => setCapabilityFilter(capabilityFilter === c.id ? null : c.id)}
>{c.label}</button>
))}
</React.Fragment>
))}
</div>
{/* Search Bar */}
@@ -0,0 +1,11 @@
-- 019: 场景分类从「人群→场景」改为「岗位/职能」(元宝清单),清空旧 persona 取值交由 AI/重导重新归类。
-- 幂等:仅把已知旧 id 置空,重跑无害。
UPDATE market_apps
SET capability = NULL
WHERE capability IN (
'freelance_content','freelance_client','freelance_finance',
'office_doc','office_data','office_email','office_pm',
'edu_prepare','edu_grade','edu_tutor','edu_home',
'biz_product','biz_service','biz_ops',
'general_write','general_research','general_agent'
);