forked from hangshuo652/aurak
Question generation: scenario-based 3-step prompt with technique labeling, key_points constrained to KB source, temperature 0.1. Generator node: two-step extraction prompt for assessment flow.
This commit is contained in:
@@ -295,45 +295,43 @@ export class QuestionBankService {
|
||||
const model = new ChatOpenAI({
|
||||
apiKey: modelConfig.apiKey || 'ollama',
|
||||
modelName: modelConfig.modelId,
|
||||
temperature: 0.3,
|
||||
temperature: 0.1,
|
||||
configuration: {
|
||||
baseURL: modelConfig.baseUrl || 'https://api.deepseek.com/v1',
|
||||
},
|
||||
});
|
||||
|
||||
const systemPrompt = `你是一位严格的知识评估专家。你必须**仅基于**下方 Human 消息中提供的【知识库内容】来生成题目。
|
||||
const systemPrompt = `你是一个实战考核设计专家。你要做三件事(在脑中完成,不要输出中间过程)。
|
||||
|
||||
### 核心铁律(违反将导致题目无效):
|
||||
1. **所有题目必须直接来源于提供的知识库内容**,每个题目必须能找到对应的原文依据
|
||||
2. **绝对禁止**编造知识库内容中未提及的概念、术语、流程或数据
|
||||
3. **绝对禁止**使用你自身知识库中的内容来编造题目
|
||||
4. 如果知识库内容不足以生成 ${count} 道有意义的题目,可以生成少于 ${count} 道,但题目质量优先
|
||||
### 内部步骤(不要输出):
|
||||
1. 从知识库提取可考核的实战知识点
|
||||
2. 确定该知识点对应的**具体技巧或方法**,这将成为考核目标
|
||||
3. 围绕该技巧设计一个真实工作场景
|
||||
|
||||
### 格式要求:
|
||||
请以 JSON 数组格式返回题目:
|
||||
### 出题规则:
|
||||
- 题目格式:"【场景】具体场景描述 【问题】请描述你会如何处理"
|
||||
- 场景中暗示需要什么能力,但不要说破
|
||||
- **绝对禁止**概念题、选择题
|
||||
|
||||
### 评分标准来源(严格遵守):
|
||||
- key_points 必须从知识库原文中提取,不得自行编造评分标准
|
||||
- 每个 key_point 必须是知识库中明确提及的要素
|
||||
- **禁止**添加知识库中没有的方法、工具、格式(如 Markdown)
|
||||
|
||||
### 只输出 JSON:
|
||||
[
|
||||
{
|
||||
"question_text": "基于知识库内容的实际问题",
|
||||
"key_points": ["评分要点1", "评分要点2"],
|
||||
"difficulty": "STANDARD|ADVANCED|SPECIALIST",
|
||||
"knowledge_points": ["知识点原文"],
|
||||
"technique": "此题考查的具体技巧名称",
|
||||
"scenario": "实战场景",
|
||||
"question_text": "【场景】... 【问题】请描述你会如何...",
|
||||
"key_points": ["知识库中的评分要素", "知识库中的评分要素"],
|
||||
"difficulty": "STANDARD",
|
||||
"dimension": "prompt|llm|ide|devPattern|workCapability",
|
||||
"basis": "【必须填写】从知识库中引用与此题相关的原文内容,用引号标注来源段落"
|
||||
"basis": "知识库原文依据"
|
||||
}
|
||||
]
|
||||
|
||||
### 维度说明(根据题目内容归类):
|
||||
- prompt: 关于提示词设计、AI交互优化
|
||||
- llm: 关于大语言模型原理、架构、参数
|
||||
- ide: 关于开发工具使用、协作效率
|
||||
- devPattern: 关于开发方法论、工程范式
|
||||
- workCapability: 关于工作能力、综合素养
|
||||
|
||||
### 出题规范:
|
||||
1. 每个题目必须标注 basis,引用知识库中的具体原文作为依据
|
||||
2. 题目难度分布合理,覆盖 STANDARD/ADVANCED/SPECIALIST
|
||||
3. 不同维度各出一部分,不要集中在一个维度`;
|
||||
|
||||
const humanMsg = `【知识库内容 - 以下是你出题的唯一依据】\n\n--- 知识库开始 ---\n${knowledgeBaseContent}\n--- 知识库结束 ---\n\n请严格基于以上知识库内容生成题目。`;
|
||||
]`;
|
||||
const humanMsg = `【知识库内容 - 唯一来源】\n\n--- 开始 ---\n${knowledgeBaseContent}\n--- 结束 ---\n\n请按三步流程生成 ${count} 道简答题。难度以 STANDARD 为主。`;
|
||||
|
||||
try {
|
||||
const response = await model.invoke([
|
||||
@@ -369,12 +367,16 @@ export class QuestionBankService {
|
||||
for (const q of parsedQuestions) {
|
||||
const dimension = dimensionMap[q.dimension?.toLowerCase()] || 'WORK_CAPABILITY';
|
||||
const difficulty = difficultyMap[q.difficulty?.toUpperCase()] || 'STANDARD';
|
||||
const techniqueTag = q.technique ? `【考查技巧】${q.technique}` : null;
|
||||
const keyPoints = techniqueTag
|
||||
? [techniqueTag, ...(q.key_points || [])]
|
||||
: (q.key_points || []);
|
||||
|
||||
const item = this.itemRepository.create({
|
||||
bankId,
|
||||
questionText: q.question_text,
|
||||
questionType: QuestionType.SHORT_ANSWER,
|
||||
keyPoints: q.key_points || [],
|
||||
keyPoints,
|
||||
difficulty: difficulty as QuestionDifficulty,
|
||||
dimension: dimension as QuestionDimension,
|
||||
basis: q.basis,
|
||||
|
||||
Reference in New Issue
Block a user