chat_server_extension#

Attributes#

Classes#

MDVProjectChatServerExtension

A protocol for server extensions that can be used with MDV projects.

Module Contents#

chat_server_extension.logger[source]#
class chat_server_extension.MDVProjectChatServerExtension[source]#

Bases: mdvtools.server_extension.MDVProjectServerExtension

A protocol for server extensions that can be used with MDV projects.

We might use this for blocks of other functionality that aren’t totally core mdv functionality, integrating other services/libraries/functionality. We might also re-arrange so that some things like the add_anndata routes are moved into an extension.

Maybe rather than pass a Flask app to server.py, we pass something representing MDV app configuration, including a Flask app, these extensions, auth provider etc… Flask becomes an implementation detail that we abstract away somewhat.

register_routes(project: mdvtools.mdvproject.MDVProject, project_bp: mdvtools.project_router.ProjectBlueprintProtocol)[source]#

Assign any extra /project/<project_id>/<path> routes to the blueprint for this project instance.

mutate_state_json(state_json: dict, project: mdvtools.mdvproject.MDVProject, app: flask.Flask)[source]#

Mutate the state.json before returning it as a request response, in this case to add information about the chat extension. This should also reflect what the user is authorized to do, e.g. whether they can use the chat functionality or not. Currently, all chat related routes will require the user to have ‘editable’ access level, although we don’t currently signal to the front-end whether the user has this access level or not.

chat_server_extension.chat_extension[source]#