feat: Generate problem support for title variable (#2310)
This commit is contained in:
parent
a16968d6e5
commit
08c734b242
@ -29,7 +29,8 @@ def generate_problem_by_paragraph(paragraph, llm_model, prompt):
|
|||||||
try:
|
try:
|
||||||
ListenerManagement.update_status(QuerySet(Paragraph).filter(id=paragraph.id), TaskType.GENERATE_PROBLEM,
|
ListenerManagement.update_status(QuerySet(Paragraph).filter(id=paragraph.id), TaskType.GENERATE_PROBLEM,
|
||||||
State.STARTED)
|
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):
|
if (res.content is None) or (len(res.content) == 0):
|
||||||
return
|
return
|
||||||
problems = res.content.split('\n')
|
problems = res.content.split('\n')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user