dialoguekit.platforms.flask_socket_platform

The Platform facilitates displaying of the conversation.

Attributes

logger

Classes

SocketIORequest

A request that contains a sid attribute.

Message

Response

FlaskSocketPlatform

Represents a platform that uses Flask-SocketIO.

ChatNamespace

Represents a namespace.

Module Contents

dialoguekit.platforms.flask_socket_platform.logger
class dialoguekit.platforms.flask_socket_platform.SocketIORequest(environ: _typeshed.wsgi.WSGIEnvironment, populate_request: bool = True, shallow: bool = False)

Bases: flask.Request

A request that contains a sid attribute.

sid: str
class dialoguekit.platforms.flask_socket_platform.Message
text: str
dialogue_acts: List[Dict[str, Any]] = None
classmethod from_utterance(utterance: dialoguekit.core.Utterance) Message

Converts an utterance to a message.

Parameters:

utterance – An instance of Utterance.

Returns:

An instance of Message.

class dialoguekit.platforms.flask_socket_platform.Response
sender: str
message: Message
class dialoguekit.platforms.flask_socket_platform.FlaskSocketPlatform(agent_class: Type[dialoguekit.participant.agent.Agent])

Bases: dialoguekit.platforms.platform.Platform

Represents a platform that uses Flask-SocketIO.

Parameters:

agent_class – The class of the agent.

start(host: str = '127.0.0.1', port: str = '5000') None

Starts the platform.

Parameters:
  • host – Hostname.

  • port – Port.

display_agent_utterance(utterance: dialoguekit.core.Utterance, agent_id: str, user_id: str) None

Emits agent utterance to the client.

Parameters:
  • utterance – An instance of Utterance.

  • agent_id – Agent ID.

  • user_id – User ID of the recipient.

display_user_utterance(utterance: dialoguekit.core.Utterance, user_id: str) None

Overrides the method in Platform to avoid raising an error.

This method is not used in FlaskSocketPlatform.

Parameters:
  • utterance – An instance of Utterance.

  • user_id – User ID.

class dialoguekit.platforms.flask_socket_platform.ChatNamespace(namespace: str, platform: FlaskSocketPlatform)

Bases: flask_socketio.Namespace

Represents a namespace.

Parameters:
  • namespace – Namespace.

  • platform – An instance of FlaskSocketPlatform.

on_connect() None

Connects client to platform.

on_disconnect() None

Disconnects client from server.

on_message(data: dict) None

Receives message from client and sends response.

Parameters:

data – Data received from client.

on_feedback(data: dict) None

Receives feedback from client.

Parameters:

data – Data received from client.