mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-21 14:05:17 +02:00
feat: 删掉无用的part
This commit is contained in:
parent
8b7eddad86
commit
444b609e38
2 changed files with 102 additions and 45 deletions
94
examples/write_teaching_plan.py
Normal file
94
examples/write_teaching_plan.py
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@Modified By: mashenquan, 2023-07-27, + `industry` concept
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
import aiofiles
|
||||
import fire
|
||||
from metagpt.logs import logger
|
||||
from metagpt.actions.write_teaching_plan import TeachingPlanRequirement
|
||||
from metagpt.roles.teacher import Teacher
|
||||
from metagpt.software_company import SoftwareCompany
|
||||
|
||||
|
||||
async def startup(lesson_file: str, investment: float = 3.0, n_round: int = 1, *args, **kwargs):
|
||||
"""Run a startup. Be a teacher in education industry."""
|
||||
|
||||
demo_lesson = """
|
||||
UNIT 1 Making New Friends
|
||||
TOPIC 1 Welcome to China!
|
||||
Section A
|
||||
|
||||
1a Listen and number the following names.
|
||||
Jane Mari Kangkang Michael
|
||||
Look, listen and understand. Then practice the conversation.
|
||||
Work in groups. Introduce yourself using
|
||||
I ’m ... Then practice 1a
|
||||
with your own hometown or the following places.
|
||||
|
||||
1b Listen and number the following names
|
||||
Jane Michael Maria Kangkang
|
||||
1c Work in groups. Introduce yourself using I ’m ... Then practice 1a with your own hometown or the following places.
|
||||
China the USA the UK Hong Kong Beijing
|
||||
|
||||
2a Look, listen and understand. Then practice the conversation
|
||||
Hello!
|
||||
Hello!
|
||||
Hello!
|
||||
Hello! Are you Maria?
|
||||
No, I’m not. I’m Jane.
|
||||
Oh, nice to meet you, Jane
|
||||
Nice to meet you, too.
|
||||
Hi, Maria!
|
||||
Hi, Kangkang!
|
||||
Welcome to China!
|
||||
Thanks.
|
||||
|
||||
2b Work in groups. Make up a conversation with your own name and the
|
||||
following structures.
|
||||
A: Hello! / Good morning! / Hi! I’m ... Are you ... ?
|
||||
B: ...
|
||||
|
||||
3a Listen, say and trace
|
||||
Aa Bb Cc Dd Ee Ff Gg
|
||||
|
||||
3b Listen and number the following letters. Then circle the letters with the same sound as Bb.
|
||||
Aa Bb Cc Dd Ee Ff Gg
|
||||
|
||||
3c Match the big letters with the small ones. Then write them on the lines.
|
||||
"""
|
||||
|
||||
lesson = ""
|
||||
if lesson_file is not None and Path(lesson_file).exists():
|
||||
async with aiofiles.open(lesson_file, mode="r", encoding="utf-8") as reader:
|
||||
lesson = await reader.read()
|
||||
logger.info(f"Course content: {lesson}")
|
||||
if not lesson:
|
||||
logger.info("No course content provided, using the demo course.")
|
||||
lesson = demo_lesson
|
||||
|
||||
company = SoftwareCompany()
|
||||
company.hire([Teacher(*args, **kwargs)])
|
||||
company.invest(investment)
|
||||
company.start_project(lesson, role="Teacher", cause_by=TeachingPlanRequirement)
|
||||
await company.run(n_round=1)
|
||||
|
||||
|
||||
def main(idea: str, investment: float = 3.0, n_round: int = 5, *args, **kwargs):
|
||||
"""
|
||||
We are a software startup comprised of AI. By investing in us, you are empowering a future filled with limitless possibilities.
|
||||
:param idea: Your innovative idea for `software` industry, such as "Creating a snake game."; lesson filename for `education` industry.
|
||||
:param investment: As an investor, you have the opportunity to contribute a certain dollar amount to this AI company.
|
||||
:param n_round:
|
||||
:param args: Parameters passed in format: `python your_script.py arg1 arg2 arg3`
|
||||
:param kwargs: Parameters passed in format: `python your_script.py --param1=value1 --param2=value2`
|
||||
:return:
|
||||
"""
|
||||
asyncio.run(startup(idea, investment, n_round, *args, **kwargs))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
fire.Fire(main)
|
||||
|
|
@ -89,10 +89,10 @@ 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",
|
||||
"Vocabulary Practice", "Grammar Practice", "Reading Comprehension", "Listening Practice",
|
||||
"Writing Practice", "Speaking Practice", "Translation Practice", "Listening and Speaking Activities"]
|
||||
"Teaching Methods and Strategies", "Learning Activities",
|
||||
"Teaching Time Allocation", "Assessment and Feedback", "Teaching Summary and Improvement",
|
||||
"Vocabulary Cloze", "Grammar Questions"
|
||||
]
|
||||
|
||||
TOPIC_STATEMENTS = {
|
||||
COURSE_TITLE: ["Statement: Find and return the title of the lesson only in markdown first-level header format, "
|
||||
|
|
@ -108,52 +108,15 @@ class WriteTeachingPlanPart(Action):
|
|||
"Statement: \"Teaching Methods and Strategies\" must include teaching focus, difficulties, materials, "
|
||||
"procedures, in detail."
|
||||
],
|
||||
"Vocabulary Practice": [
|
||||
"Vocabulary Cloze": [
|
||||
"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 "
|
||||
"create vocabulary cloze. The cloze 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": [
|
||||
"Grammar Questions": [
|
||||
"Statement: Based on the content of the textbook enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\", "
|
||||
"create grammar practice exercises. "],
|
||||
"Reading Comprehension": [
|
||||
"Statement: Using 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: Using the vocabulary 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: Using the vocabulary 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: Using the vocabulary 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: Using the vocabulary 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: Using the vocabulary 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."
|
||||
]
|
||||
"create grammar questions. "]
|
||||
}
|
||||
|
||||
# Teaching plan title
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue