agentscope.web.gradio.utils module

web ui utils

agentscope.web.gradio.utils.init_uid_queues() dict[源代码]

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[源代码]

Sends a message to the web UI.

agentscope.web.gradio.utils.get_chat_msg(uid: str | None = None) list[源代码]

Retrieves the next chat message from the queue, if available.

agentscope.web.gradio.utils.send_player_input(msg: str, uid: str | None = None) None[源代码]

Sends player input to the web UI.

agentscope.web.gradio.utils.get_player_input(timeout: int | None = None, uid: str | None = None) str[源代码]

Gets player input from the web UI or command line.

agentscope.web.gradio.utils.send_reset_msg(uid: str | None = None) None[源代码]

Sends a reset message to the web UI.

agentscope.web.gradio.utils.get_reset_msg(uid: str | None = None) None[源代码]

Retrieves a reset message from the queue, if available.

exception agentscope.web.gradio.utils.ResetException[源代码]

基类:Exception

Custom exception to signal a reset action in the application.

agentscope.web.gradio.utils.check_uuid(uid: str | None) str[源代码]

Checks whether a UUID is provided or generates a default one.

agentscope.web.gradio.utils.generate_image_from_name(name: str) str[源代码]

Generates an image based on the hash of the given name.

agentscope.web.gradio.utils.audio2text(audio_path: str) str[源代码]

Converts audio file at the given path to text using ASR.

agentscope.web.gradio.utils.cycle_dots(text: str, num_dots: int = 3) str[源代码]

display thinking dots before agent reply

agentscope.web.gradio.utils.user_input(prefix: str = 'User input: ', timeout: int | None = None) str[源代码]

get user input