feat: +练习题

This commit is contained in:
莘权 马 2023-07-31 15:44:12 +08:00
parent 16bad64649
commit 7cab03942e
3 changed files with 57 additions and 4 deletions

View file

@ -39,7 +39,12 @@ class WriteTeachingPlanPart(Action):
if len(args) < 1 or len(args[0]) < 1 or not isinstance(args[0][0], Message):
raise ValueError("Invalid args, a tuple of List[Message] is expected")
statements = self.TOPIC_STATEMENTS.get(self.topic, [])
statement_patterns = self.TOPIC_STATEMENTS.get(self.topic, [])
statements = []
from metagpt.roles import Role
for p in statement_patterns:
s = Role.format_value(p, kwargs)
statements.append(s)
formatter = self.PROMPT_TITLE_TEMPLATE if self.topic == self.COURSE_TITLE else self.PROMPT_TEMPLATE
prompt = formatter.format(formation=self.FORMATION,
role=self.prefix,
@ -84,7 +89,9 @@ class WriteTeachingPlanPart(Action):
COURSE_TITLE = "Title"
TOPICS = [COURSE_TITLE, "Teaching Hours", "Teaching Objectives", "Teaching Content",
"Teaching Methods and Strategies", "Learning Activities",
"Teaching Time Allocation", "Assessment and Feedback", "Teaching Summary and Improvement"]
"Teaching Time Allocation", "Assessment and Feedback", "Teaching Summary and Improvement",
"Vocabulary Practice", "Grammar Practice", "Reading Comprehension", "Listening Practice",
"Writing Practice", "Speaking Practice", "Translation Practice", "Listening and Speaking Activities"]
TOPIC_STATEMENTS = {
COURSE_TITLE: ["Statement: Find and return the title of the lesson only in markdown first-level header format, "
@ -99,6 +106,52 @@ class WriteTeachingPlanPart(Action):
"Teaching Methods and Strategies": [
"Statement: \"Teaching Methods and Strategies\" must include teaching focus, difficulties, materials, "
"procedures, in detail."
],
"Vocabulary Practice": [
"Statement: Based on the content of the textbook enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\", "
"create vocabulary practice exercises. The exercises should be in either {language} with "
"{teaching_language} answers or {teaching_language} with {language} answers. The key-related vocabulary "
"and phrases in the textbook content must all be included in the exercises."
],
"Grammar Practice": [
"Statement: Based on the content of the textbook enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\", "
"create grammar practice exercises. "],
"Reading Comprehension": [
"Statement: Based on the vocabulary of the textbook enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\", "
"create {teaching_language} reading comprehension exercises. ",
"Statement: Prohibit the use of words that are not within the scope of the \"[LESSON_BEGIN]\" "
"and \"[LESSON_END]\" tags.",
"Statement: Prohibit copy the content of the \"[LESSON_BEGIN]\" and \"[LESSON_END]\" tags.",
"Answer options: Write the story content in {teaching_language}."
],
"Listening Practice": [
"Statement: Based on the content of the textbook enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\", "
"create listening practice exercises. Each exercise should include the audio content and the "
"question-and-answer part."
],
"Writing Practice": [
"Statement: Based on the content of the textbook enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\", "
"create writing practice exercises.",
#"Statement: Prohibit using content not related to \"[LESSON_BEGIN]\" and \"[LESSON_END]\" tags.",
"Statement: Prohibit copying the content enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\" tags."
],
"Speaking Practice": [
"Statement: Based on the content of the textbook enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\", "
"create speaking practice exercises.",
#"Statement: Prohibit using content not related to \"[LESSON_BEGIN]\" and \"[LESSON_END]\" tags.",
"Statement: Prohibit copying the content enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\" tags."
],
"Translation Practice": [
"Statement: Based on the content of the textbook enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\", "
"create Translation practice exercises.",
#"Statement: Prohibit using content not related to \"[LESSON_BEGIN]\" and \"[LESSON_END]\" tags.",
"Statement: Prohibit copying the content enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\" tags."
],
"Listening and Speaking Activities": [
"Statement: Based on the content of the textbook enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\", "
"create listening and speaking activities exercises.",
#"Statement: Prohibit using content not related to \"[LESSON_BEGIN]\" and \"[LESSON_END]\" tags.",
"Statement: Prohibit copying the content enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\" tags."
]
}

View file

@ -196,7 +196,7 @@ class Role:
logger.info(f"{self._setting}: ready to {self._rc.todo}")
requirement = self._rc.important_memory
response = await self._rc.todo.run(requirement)
response = await self._rc.todo.run(requirement, **self._options)
# logger.info(response)
if isinstance(response, ActionOutput):
msg = Message(content=response.content, instruct_content=response.instruct_content,