Skip to content

Commit

Permalink
fix board issue (#394)
Browse files Browse the repository at this point in the history
1. for code generator, only add context information to the last post
from the planner
2. remove duplicated message from planner to code interpreter.
  • Loading branch information
liqul authored Aug 15, 2024
1 parent 1099dbc commit 69089c7
Show file tree
Hide file tree
Showing 3 changed files with 595 additions and 595 deletions.
25 changes: 13 additions & 12 deletions taskweaver/code_interpreter/code_interpreter/code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ def compose_conversation(
add_requirements: bool = False,
summary: Optional[str] = None,
) -> List[ChatMessageType]:
cur_round = rounds[-1]
chat_history: List[ChatMessageType] = []
ignored_types = [
AttachmentType.revise_message,
Expand Down Expand Up @@ -254,17 +253,19 @@ def compose_conversation(

if post.send_from == "Planner" and post.send_to == self.alias:
# to avoid planner imitating the below handcrafted format,
# we merge plan and query message in the code generator here
user_query = conversation_round.user_query
enrichment = f"The user request is: {user_query}\n\n"

supplementary_info_dict = cur_round.read_board()
supplementary_info = "\n".join([bulletin for bulletin in supplementary_info_dict.values()])
if supplementary_info != "":
enrichment += (
f"To better understand the user request, here is some additional information:\n"
f" {supplementary_info}\n\n"
)
# we merge context information in the code generator here
enrichment = ""
if is_final_post:
user_query = conversation_round.user_query
enrichment = f"The user request is: {user_query}\n\n"

supplementary_info_dict = conversation_round.read_board()
supplementary_info = "\n\n".join([bulletin for bulletin in supplementary_info_dict.values()])
if supplementary_info != "":
enrichment += (
f"Additional context:\n"
f" {supplementary_info}\n\n"
)

user_feedback = "None"
if last_post is not None and last_post.send_from == self.alias:
Expand Down
5 changes: 3 additions & 2 deletions taskweaver/planner/planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,9 @@ def stream_filter(s: Iterable[ChatMessageType]):

plan = post_proxy.post.get_attachment(type=AttachmentType.plan)[0]
bulletin_message = (
f"I have drawn up a plan: \n{plan}\n\n"
f"Please proceed with this step of this plan: {post_proxy.post.message}"
"\n====== Plan ======\n"
f"I have drawn up a plan:\n{plan}"
"\n==================\n"
)
post_proxy.update_attachment(
message=bulletin_message,
Expand Down
Loading

0 comments on commit 69089c7

Please sign in to comment.