agentscope.web.gradio.utils module
web ui utils
- agentscope.web.gradio.utils.init_uid_queues() dict [source]
Initializes and returns a dictionary of user-specific queues.
- agentscope.web.gradio.utils.send_msg(msg: str, is_player: bool = False, role: str | None = None, uid: str | None = None, flushing: bool = False, avatar: str | None = None, msg_id: str | None = None) None [source]
Sends a message to the web UI.
- agentscope.web.gradio.utils.get_chat_msg(uid: str | None = None) list [source]
Retrieves the next chat message from the queue, if available.
- agentscope.web.gradio.utils.send_player_input(msg: str, uid: str | None = None) None [source]
Sends player input to the web UI.
- agentscope.web.gradio.utils.get_player_input(timeout: int | None = None, uid: str | None = None) str [source]
Gets player input from the web UI or command line.
- agentscope.web.gradio.utils.send_reset_msg(uid: str | None = None) None [source]
Sends a reset message to the web UI.
- agentscope.web.gradio.utils.get_reset_msg(uid: str | None = None) None [source]
Retrieves a reset message from the queue, if available.
- exception agentscope.web.gradio.utils.ResetException[source]
Bases:
Exception
Custom exception to signal a reset action in the application.
- agentscope.web.gradio.utils.check_uuid(uid: str | None) str [source]
Checks whether a UUID is provided or generates a default one.
- agentscope.web.gradio.utils.generate_image_from_name(name: str) str [source]
Generates an image based on the hash of the given name.
- agentscope.web.gradio.utils.audio2text(audio_path: str) str [source]
Converts audio file at the given path to text using ASR.