File size: 956 Bytes
691ae91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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