Skip to content

Commit

Permalink
Merge pull request THUDM#267 from zRzRzRzRzRzRzR/main
Browse files Browse the repository at this point in the history
Bugs fixed: duplicate prompt words after retry
  • Loading branch information
wenyihong authored Jan 2, 2024
2 parents 1920a97 + fd4351e commit 390b7c6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion composite_demo/demo_agent_cogagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ def main(
user_conversation = Conversation(
role=Role.USER,
translate=translate,
content_show=postprocess_text(template=template, text=prompt_text.strip()),
content_show=prompt_text.strip() if retry else postprocess_text(template=template,
text=prompt_text.strip()),
image=image_input
)
append_conversation(user_conversation, history)
Expand Down
3 changes: 2 additions & 1 deletion composite_demo/demo_chat_cogagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def main(
user_conversation = Conversation(
role=Role.USER,
translate=translate,
content_show=postprocess_text(template=template, text=prompt_text.strip()),
content_show=prompt_text.strip() if retry else postprocess_text(template=template,
text=prompt_text.strip()),
image=image_input
)
append_conversation(user_conversation, history)
Expand Down
3 changes: 2 additions & 1 deletion composite_demo/demo_chat_cogvlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def main(
user_conversation = Conversation(
role=Role.USER,
translate=translate,
content_show=postprocess_text(template=template, text=prompt_text.strip()),
content_show=prompt_text.strip() if retry else postprocess_text(template=template,
text=prompt_text.strip()),
image=image_input
)
append_conversation(user_conversation, history)
Expand Down
7 changes: 4 additions & 3 deletions composite_demo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ class Mode(str, Enum):
selected_template_grounding_cogvlm = ""
with st.sidebar:
grounding = st.checkbox("Grounding")
if tab == Mode.CogVLM_Chat.value or Mode.CogAgent_Chat and grounding:
selected_template_grounding_cogvlm = st.selectbox("Template For Grounding", template_grounding_cogvlm)
if tab == Mode.CogVLM_Chat or tab == Mode.CogAgent_Chat:
if grounding:
selected_template_grounding_cogvlm = st.selectbox("Template For Grounding", template_grounding_cogvlm)

if tab == Mode.CogAgent_Agent.value:
if tab == Mode.CogAgent_Agent:
with st.sidebar:
selected_template_agent_cogagent = st.selectbox("Template For Agent", templates_agent_cogagent)

Expand Down

0 comments on commit 390b7c6

Please sign in to comment.