Skip to content

Commit

Permalink
fix gradio displaying user message twice (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiTao-Li authored Jul 1, 2024
1 parent b880f3e commit 05b8d54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/agentscope/agents/user_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@ def speak(
f"object, got {type(content)} instead.",
)

logger.chat(msg)
logger.chat(msg, disable_gradio=True)
8 changes: 4 additions & 4 deletions src/agentscope/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def _get_speaker_color(speaker: str) -> tuple[str, str]:
def _chat(
message: dict,
*args: Any,
disable_studio: bool = False,
disable_gradio: bool = False,
**kwargs: Any,
) -> None:
"""
Expand Down Expand Up @@ -142,15 +142,15 @@ def _chat(
**kwargs,
)

if hasattr(thread_local_data, "uid") and not disable_studio:
log_studio(message, thread_local_data.uid, **kwargs)
if hasattr(thread_local_data, "uid") and not disable_gradio:
log_gradio(message, thread_local_data.uid, **kwargs)
return

logger.log(LEVEL_DISPLAY_MSG, message, *args, **kwargs)
logger.log(LEVEL_SAVE_LOG, message, *args, **kwargs)


def log_studio(message: dict, uid: str, **kwargs: Any) -> None:
def log_gradio(message: dict, uid: str, **kwargs: Any) -> None:
"""Send chat message to studio.
Args:
Expand Down

0 comments on commit 05b8d54

Please sign in to comment.