Skip to content

Commit c8ccec4

Browse files
committed
Revert "Merge pull request #281 from Leadernelson/main"
This reverts commit 36c24d7, reversing changes made to fc7b0fe.
1 parent 36c24d7 commit c8ccec4

4 files changed

Lines changed: 3 additions & 42 deletions

File tree

deeptutor/agents/question/agents/generator.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,28 +120,14 @@ async def _generate_payload(
120120
"Template: {template}\n"
121121
"User topic: {user_topic}\n"
122122
"Preference: {preference}\n"
123-
"Previously generated questions (do not repeat):\n{history_context}\n"
123+
"Conversation context: {history_context}\n"
124124
"Knowledge context: {knowledge_context}\n"
125125
"Enabled tools: {available_tools}\n\n"
126126
'Return JSON {{"question_type":"","question":"","options":{{}},"correct_answer":"","explanation":""}}'
127127
)
128128

129-
# Serialize the template without the bulky knowledge_context in metadata —
130-
# it is already included via the dedicated {knowledge_context} placeholder
131-
# and its presence inside the template JSON would cause it to appear twice,
132-
# dominating the prompt and making the LLM generate identical questions for
133-
# every template regardless of their individual concentrations.
134-
template_dict = template.__dict__.copy()
135-
if isinstance(template_dict.get("metadata"), dict):
136-
stripped_metadata = {
137-
k: v
138-
for k, v in template_dict["metadata"].items()
139-
if k != "knowledge_context"
140-
}
141-
template_dict["metadata"] = stripped_metadata
142-
143129
user_prompt = user_prompt_template.format(
144-
template=json.dumps(template_dict, ensure_ascii=False, indent=2),
130+
template=json.dumps(template.__dict__, ensure_ascii=False, indent=2),
145131
user_topic=user_topic,
146132
preference=preference or "(none)",
147133
history_context=history_context or "(none)",

deeptutor/agents/question/coordinator.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ async def _generation_loop(
273273
generator = self._create_generator()
274274
results: list[dict[str, Any]] = []
275275
total = len(templates)
276-
generated_questions: list[str] = []
277276

278277
for idx, template in enumerate(templates, 1):
279278
await self._send_ws_update(
@@ -286,25 +285,13 @@ async def _generation_loop(
286285
},
287286
)
288287

289-
# Build cumulative context from questions already generated in this
290-
# session so the Generator can avoid producing duplicates.
291-
cumulative_history = history_context
292-
if generated_questions:
293-
previous = "\n".join(
294-
f"Q{i}: {q}" for i, q in enumerate(generated_questions, start=1)
295-
)
296-
if cumulative_history:
297-
cumulative_history = f"{cumulative_history}\n\nQuestions generated in this session:\n{previous}"
298-
else:
299-
cumulative_history = f"Questions generated in this session:\n{previous}"
300-
301288
success = True
302289
try:
303290
qa_pair = await generator.process(
304291
template=template,
305292
user_topic=user_topic,
306293
preference=preference,
307-
history_context=cumulative_history,
294+
history_context=history_context,
308295
)
309296
except Exception as exc:
310297
success = False
@@ -327,10 +314,6 @@ async def _generation_loop(
327314
}
328315
results.append(result)
329316

330-
# Track successfully generated question text for diversity enforcement
331-
if success and qa_pair.question:
332-
generated_questions.append(qa_pair.question)
333-
334317
await self._send_ws_update(
335318
"result",
336319
{

deeptutor/agents/question/prompts/en/generator.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ generate: |
1919
Tools enabled by the user:
2020
{available_tools}
2121
22-
Previously generated questions in this session (your new question MUST be different from all of these):
23-
{history_context}
24-
2522
Requirements:
2623
- Keep strict alignment with template.concentration and template.difficulty.
2724
- Respect template.question_type exactly. Do not silently change it.
@@ -36,7 +33,6 @@ generate: |
3633
- Provide a clear explanation.
3734
- Use the knowledge context when it helps ground the question.
3835
- Treat the enabled tools list as capability guidance only; do not mention tool names in the final output.
39-
- Do NOT generate a question that is identical or nearly identical to any of the previously generated questions listed above.
4036
4137
Return JSON only:
4238
{{

deeptutor/agents/question/prompts/zh/generator.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ generate: |
1919
用户当前启用的工具:
2020
{available_tools}
2121
22-
本次会话中已生成的题目(你的新题目必须与以下所有题目不同):
23-
{history_context}
24-
2522
要求:
2623
- 严格对齐 template.concentration 与 template.difficulty。
2724
- 必须严格遵循 template.question_type,不要私自改题型。
@@ -35,7 +32,6 @@ generate: |
3532
- 给出清晰解释。
3633
- 在有帮助时使用知识上下文增强题目质量。
3734
- 可将启用工具列表视为能力提示,但不要在最终题目中直接提及工具名称。
38-
- 不要生成与上面已生成题目相同或高度相似的题目。
3935
4036
仅返回 JSON:
4137
{{

0 commit comments

Comments
 (0)