feat: Generate problem support for title variable (#2310)

This commit is contained in:
shaohuzhang1 2025-02-18 14:30:18 +08:00 committed by GitHub
parent a16968d6e5
commit 08c734b242
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,7 +29,8 @@ def generate_problem_by_paragraph(paragraph, llm_model, prompt):
try:
ListenerManagement.update_status(QuerySet(Paragraph).filter(id=paragraph.id), TaskType.GENERATE_PROBLEM,
State.STARTED)
res = llm_model.invoke([HumanMessage(content=prompt.replace('{data}', paragraph.content))])
res = llm_model.invoke(
[HumanMessage(content=prompt.replace('{data}', paragraph.content).replace('{title}', paragraph.title))])
if (res.content is None) or (len(res.content) == 0):
return
problems = res.content.split('\n')