Files
012-kaopeilian/backend/app/services/ai/prompts/practice_scene_prompts.py
111 442ac78b56
Some checks failed
continuous-integration/drone/push Build is failing
sync: 同步服务器最新代码 (2026-01-27)
更新内容:
- 后端 AI 服务优化(能力分析、知识点解析等)
- 前端考试和陪练界面更新
- 修复多个 prompt 和 JSON 解析问题
- 更新 Coze 语音客户端
2026-01-27 10:03:28 +08:00

198 lines
5.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
陪练场景生成提示词模板
功能:根据课程知识点生成陪练场景配置
"""
# ==================== 元数据 ====================
PROMPT_META = {
"name": "practice_scene_generation",
"display_name": "陪练场景生成",
"description": "根据课程知识点生成 AI 陪练场景配置包含场景名称、背景、AI 角色、练习目标等",
"module": "kaopeilian",
"variables": ["knowledge_points"],
"version": "1.0.0",
"author": "kaopeilian-team",
}
# ==================== 系统提示词 ====================
SYSTEM_PROMPT = """你是一个训练场景研究专家,能将用户提交的知识点,转变为一个模拟陪练的场景,并严格按照以下格式输出。
输出标准:
{
"scene": {
"name": "轻医美产品咨询陪练",
"description": "模拟客户咨询轻医美产品的场景",
"background": "客户对脸部抗衰项目感兴趣。",
"ai_role": "AI扮演一位30岁女性客户",
"objectives": ["了解客户需求", "介绍产品优势", "处理价格异议"],
"keywords": ["抗衰", "玻尿酸", "价格"],
"type": "product-intro",
"difficulty": "intermediate"
}
}
## 字段说明
- **name**: 场景名称,简洁明了,体现陪练主题
- **description**: 场景描述,说明这是什么样的模拟场景
- **background**: 场景背景设定,描述客户的情况和需求
- **ai_role**: AI 角色描述,说明 AI 扮演什么角色(通常是客户)
- **objectives**: 练习目标数组,列出学员需要达成的目标
- **keywords**: 关键词数组,从知识点中提取的核心关键词
- **type**: 场景类型,可选值:
- phone: 电话销售
- face: 面对面销售
- complaint: 客户投诉
- after-sales: 售后服务
- product-intro: 产品介绍
- **difficulty**: 难度等级,可选值:
- beginner: 入门
- junior: 初级
- intermediate: 中级
- senior: 高级
- expert: 专家
## 输出要求
1. 直接输出纯净的 JSON 对象,不要包含 Markdown 标记(如 ```json
2. 不要包含任何解释性文字
3. 根据知识点内容合理设计场景,确保场景与知识点紧密相关
4. objectives 至少包含 2-3 个具体可操作的目标
5. keywords 提取 3-5 个核心关键词
6. 根据知识点的复杂程度选择合适的 difficulty
7. 根据知识点的应用场景选择合适的 type"""
# ==================== 用户提示词模板 ====================
USER_PROMPT = """请根据以下知识点内容,生成一个模拟陪练场景:
## 知识点内容
{knowledge_points}
## 要求
- 以 JSON 格式输出
- 场景要贴合知识点的实际应用场景
- AI 角色要符合轻医美行业的客户特征
- 练习目标要具体、可评估"""
# ==================== JSON Schema ====================
PRACTICE_SCENE_SCHEMA = {
"type": "object",
"required": ["scene"],
"properties": {
"scene": {
"type": "object",
"required": ["name", "description", "background", "ai_role", "objectives", "keywords", "type", "difficulty"],
"properties": {
"name": {
"type": "string",
"description": "场景名称",
"maxLength": 100
},
"description": {
"type": "string",
"description": "场景描述",
"maxLength": 500
},
"background": {
"type": "string",
"description": "场景背景设定",
"maxLength": 500
},
"ai_role": {
"type": "string",
"description": "AI 角色描述",
"maxLength": 200
},
"objectives": {
"type": "array",
"description": "练习目标",
"items": {
"type": "string"
},
"minItems": 2,
"maxItems": 5
},
"keywords": {
"type": "array",
"description": "关键词",
"items": {
"type": "string"
},
"minItems": 2,
"maxItems": 8
},
"type": {
"type": "string",
"description": "场景类型",
"enum": [
"phone",
"face",
"complaint",
"after-sales",
"product-intro"
]
},
"difficulty": {
"type": "string",
"description": "难度等级",
"enum": [
"beginner",
"junior",
"intermediate",
"senior",
"expert"
]
}
}
}
}
}
# ==================== 场景类型常量 ====================
SCENE_TYPES = {
"phone": "电话销售",
"face": "面对面销售",
"complaint": "客户投诉",
"after-sales": "售后服务",
"product-intro": "产品介绍",
}
DIFFICULTY_LEVELS = {
"beginner": "入门",
"junior": "初级",
"intermediate": "中级",
"senior": "高级",
"expert": "专家",
}
# 默认值
DEFAULT_SCENE_TYPE = "product-intro"
DEFAULT_DIFFICULTY = "intermediate"