current task might swith different sys prompt

This commit is contained in:
paulaan 2023-12-09 22:01:47 +07:00
parent 6b2fb95e66
commit 9d0f19aeee

View file

@ -4,7 +4,7 @@ import asyncio
from pydantic import BaseModel
from metagpt.actions import CollectLinks, ConductResearch, WebBrowseAndSummarize
from metagpt.actions import Action, CollectLinks, ConductResearch, WebBrowseAndSummarize
from metagpt.actions.research import get_research_system_text
from metagpt.const import RESEARCH_PATH
from metagpt.logs import logger
@ -46,7 +46,7 @@ class Researcher(Role):
else:
topic = msg.content
research_system_text = self.research_system_text(topic)
research_system_text = self.research_system_text(topic, todo)
if isinstance(todo, CollectLinks):
links = await todo.run(topic, 4, 4)
ret = Message("", Report(topic=topic, links=links), role=self.profile, cause_by=type(todo))
@ -64,7 +64,7 @@ class Researcher(Role):
self._rc.memory.add(ret)
return ret
def research_system_text(self, topic) -> str:
def research_system_text(self, topic, current_task: Action) -> str:
""" BACKWARD compatible
This allows sub-class able to define its own system prompt based on topic.
return the previous implementation to have backward compatible