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
intent: str = 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
recipient: 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(user_id: str, utterance: dialoguekit.core.Utterance) None

Emits agent utterance to the client.

Parameters:
  • user_id – User ID.

  • utterance – An instance of Utterance.

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

Overrides the method in Platform to avoid raising an error.

This method is not used in FlaskSocketPlatform.

Parameters:
  • user_id – User ID.

  • utterance – An instance of Utterance.

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.