paper_generate / app_com /correct_assay.py
weiwei1392
change name of app com
ab42177
raw
history blame
956 Bytes
from prompt import assay_correct_prompt
from utils import files_list_to_texts
def text_correct(chatbot, require_texts, feedback_texts, llm):
req = '写作要求为:\n' + require_texts
answer = '学生的作文内容为:\n' + feedback_texts
prompt = assay_correct_prompt + req + '\n\nstop\n\n' + answer
response = llm(prompt)
chatbot = chatbot + [[answer, response]]
return chatbot
def files_correct(chatbot, require_texts, files_list, llm):
req = '写作要求为:\n' + require_texts
try:
answers = files_list_to_texts(files_list)
for answer in answers:
prompt = assay_correct_prompt + req + '\n\nstop\n\n' + '学生的作文内容为:\n' + answer
response = llm(prompt)
chatbot = chatbot + [['学生的作文内容为:\n' + answer, response]]
except Exception as e:
chatbot = chatbot + [[None, f"任务失败,原因:{e}"]]
return chatbot