Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

feat: merge geekan:main

莘权 马bf15613f632b
diff --git a/metagpt/actions/write_teaching_plan.py b/metagpt/actions/write_teaching_plan.py
index 529c563db..534f5ded9 100644
--- a/metagpt/actions/write_teaching_plan.py
+++ b/metagpt/actions/write_teaching_plan.py
@@ -6,9 +6,9 @@
@File : write_teaching_plan.py
"""
from metagpt.actions import Action
+from metagpt.config import CONFIG
from metagpt.logs import logger
from metagpt.schema import Message
-from metagpt.utils.common import format_value
class TeachingPlanRequirement(Action):
@@ -81,6 +81,24 @@ class WriteTeachingPlanPart(Action):
"""Show `topic` value when debug"""
return self.topic
+ @staticmethod
+ def format_value(value):
+ """Fill parameters inside `value` with `options`."""
+ if not isinstance(value, str):
+ return value
+ if "{" not in value:
+ return value
+
+ merged_opts = CONFIG.options or {}
+ try:
+ return value.format(**merged_opts)
+ except KeyError as e:
+ logger.warning(f"Parameter is missing:{e}")
+
+ for k, v in merged_opts.items():
+ value = value.replace("{" + f"{k}" + "}", str(v))
+ return value
+
FORMATION = (
'"Capacity and role" defines the role you are currently playing;\n'
'\t"[LESSON_BEGIN]" and "[LESSON_END]" tags enclose the content of textbook;\n'
diff --git a/metagpt/utils/common.py b/metagpt/utils/common.py
index a1cb71c6f..382523083 100644
--- a/metagpt/utils/common.py
+++ b/metagpt/utils/common.py
@@ -30,7 +30,6 @@ import loguru
from pydantic.json import pydantic_encoder
from tenacity import RetryCallState, _utils
-from metagpt.config import CONFIG
from metagpt.const import MESSAGE_ROUTE_TO_ALL
from metagpt.logs import logger
from metagpt.utils.exceptions import handle_exception
@@ -418,24 +417,6 @@ def any_to_name(val):
return any_to_str(val).split(".")[-1]
-def format_value(value):
- """Fill parameters inside `value` with `options`."""
- if not isinstance(value, str):
- return value
- if "{" not in value:
- return value
-
- merged_opts = CONFIG.options or {}
- try:
- return value.format(**merged_opts)
- except KeyError as e:
- logger.warning(f"Parameter is missing:{e}")
-
- for k, v in merged_opts.items():
- value = value.replace("{" + f"{k}" + "}", str(v))
- return value
-
-
def concat_namespace(*args) -> str:
return ":".join(str(value) for value in args)