add revise_mode=HUMAN_REVIEW to support human_review and auto_revise

This commit is contained in:
better629 2024-01-08 17:35:28 +08:00
parent 57db3b775a
commit 32ae369c00

View file

@ -29,8 +29,9 @@ class ReviewMode(Enum):
class ReviseMode(Enum):
HUMAN = "human"
AUTO = "auto"
HUMAN = "human" # human revise
HUMAN_REVIEW = "human_review" # human-review and auto-revise
AUTO = "auto" # auto-review and auto-revise
TAG = "CONTENT"
@ -540,10 +541,16 @@ class ActionNode:
nodes_output[key] = {"value": value, "comment": review_comments[key]}
return nodes_output
async def auto_revise(self, template: str = REVISE_TEMPLATE) -> dict[str, str]:
async def auto_revise(
self, revise_mode: ReviseMode = ReviseMode.AUTO, template: str = REVISE_TEMPLATE
) -> dict[str, str]:
"""revise the value of incorrect keys"""
# generate review comments
review_comments: dict = await self.auto_review()
if revise_mode == ReviseMode.AUTO:
review_comments: dict = await self.auto_review()
elif revise_mode == ReviseMode.HUMAN_REVIEW:
review_comments: dict = await self.human_review()
include_keys = list(review_comments.keys())
# generate revise content
@ -575,7 +582,7 @@ class ActionNode:
if revise_mode == ReviseMode.HUMAN:
revise_contents = await self.human_revise()
else:
revise_contents = await self.auto_revise()
revise_contents = await self.auto_revise(revise_mode)
return revise_contents