Skip to main content

OL OpenedX Chat

An xBlock aside to add MIT Open Learning chat into xBlocks.

Purpose

MIT’s AI chatbot for Open edX

Version Compatibility

For this plugin’s compatibility with Open edX, see the Open edX Release Compatibility table.

Setup

For detailed installation instructions, please refer to the plugin installation guide.

Installation required in:

  • LMS

  • Studio (CMS)

Configuration

1. edx-platform configuration

  • Add the following configuration values to the config file in Open edX. For any release after Juniper, that config file is /edx/etc/lms.yml. If you’re using private.py, add these values to lms/envs/private.py. These should be added to the top level. Ask a fellow developer for these values.

    MIT_LEARN_AI_API_URL: <MIT_LEARN_AI_API_URL>
    MIT_LEARN_API_BASE_URL: <MIT_LEARN_API_BASE_URL>
    MIT_LEARN_SUMMARY_FLASHCARD_URL: <MIT_LEARN_SUMMARY_FLASHCARD_URL>
  • For Tutor installations, these values can also be managed through a custom Tutor plugin.

2. Add database record

  • Create a record for the XBlockAsidesConfig model (LMS admin URL: /admin/lms_xblock/xblockasidesconfig/).

  • Create a record in the StudioConfig model (CMS admin URL: /admin/xblock_config/studioconfig/).

3. In frontend-app-learning, Run the below in the shell inside the learning MFE folder:

This will download the smoot-design package and copy the pre-bundled JS file to a location loadable by OpenEdx.

npm pack @mitodl/smoot-design@^6.17.0
tar -xvzf mitodl-smoot-design*.tgz
mkdir -p public/static/smoot-design
cp package/dist/bundles/* public/static/smoot-design
  1. Create env.config.jsx in the frontend-app-learning and add the below code:

The Unit is rendered inside an Iframe and we use postMessage to communicate between the Iframe and the parent window. The below code is used to initialize the remoteAiChatDrawer.

import { getConfig } from '@edx/frontend-platform';
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';

import(
   /* webpackIgnore: true */
"/static/smoot-design/aiDrawerManager.es.js").then(module => {
   module.init({
      messageOrigin: getConfig().LMS_BASE_URL,
      transformBody: messages => ({ message: messages[messages.length - 1].content }),
      getTrackingClient: getAuthenticatedHttpClient,
   })
})

const config = {
...process.env,
};

export default config;

(Alternatively, you can import the drawer code from a CDN like kg.com/@mitodl/smoot-design@6.4.0/dist/bundles/remoteTutorDrawer.umd.js to skip Step 3. However, the steps outlined here are most similar to what we do in production.)

5. Start learning MFE by npm run dev

6. In LMS, enable the ol_openedx_chat.ol_openedx_chat_enabled waffle flag at <LMS>/admin/waffle/flag/

This will enable the ol_openedx_chat plugin for all courses. You can disable it and add a Waffle Flag Course Override at /admin/waffle_utils/waffleflagcourseoverridemodel/ to enable it for a single course.

7. Set FEATURES[“ENABLE_OTHER_COURSE_SETTINGS”] = True in your cms/envs/private.py and lms/envs/private.py files

This enables “Other Course Settings” below.

8. Go to any course in CMS > Settings > Advanced Settings and add the below in “Other Course Settings”

{"OL_OPENEDX_CHAT_VIDEO_BLOCK_ENABLED": true, "OL_OPENEDX_CHAT_PROBLEM_BLOCK_ENABLED": true}
  • OL_OPENEDX_CHAT_VIDEO_BLOCK_ENABLED is used to enable/disable the VideoGPT for all videos.

  • OL_OPENEDX_CHAT_PROBLEM_BLOCK_ENABLED is used to enable/disable the AI Chat for all problems.

  • Once these settings are enabled, you will see a checkbox Enable AI Chat Assistant below problem and video blocks in the CMS course unit.

CMS View

ol_openedx_chat/static/images/ai_chat_aside_cms_view.png
  • You will also see a Chat Button titled “AskTIM about this video/problem” in the LMS. Now AI Chat/VideoGPT is enabled for all videos and problems.

LMS View with AskTIM button

ol_openedx_chat/static/images/ai_chat_aside_lms_view.png

LMS Chat Drawer View

ol_openedx_chat/static/images/ai_chat_aside_lms_drawer_view.png

9. Disable it for a single block

If you want to disable it for a few videos/problems then you disable the Enable AI Chat Assistant checkbox against the block in CMS.

Translations

Only Ask TIM is not translated (brand). All other user-facing strings are translatable.

Translations live in the translations repo (e.g. https://github.com/mitodl/mitxonline-translations) at translations/open-edx-plugins/ol_openedx_chat/conf/locale/. For any language, run sync_and_translate_language to create or update the .po files there; then run make pull_translations in edx-platform to pull and compile them into conf/plugins-locale/plugins/ol_openedx_chat/. Until make pull_translations is run, the UI shows English (msgid fallback).

Why no conf/locale/config.yaml or Makefile (unlike edx-bulk-grades)?

Plugins like edx-bulk-grades use conf/locale/config.yaml and a Makefile (extract_translations, compile_translations, pull_translations) because that plugin repo is the source for Transifex/Atlas. For ol_openedx_chat we use a different flow: the translations repo holds the .po files; sync_and_translate_language syncs and translates there, and edx-platform’s make pull_translations pulls into conf/plugins-locale/plugins/ol_openedx_chat/. This plugin repo never runs Atlas or Transifex, so config.yaml and a Makefile here would be unused.

Documentation

License

The code in this repository is licensed under the AGPL 3.0 unless otherwise noted.

Please see LICENSE.txt for details.

Metadata

Release files for ol-openedx-chat 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ol-openedx-chat 0.6.0
File Size Uploaded Provenance Actions
ol_openedx_chat-0.6.0.tar.gz 579.1 kB Without provenance Details for ol_openedx_chat-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ol-openedx-chat 0.6.0
File Interpreter ABI Platform Actions
ol_openedx_chat-0.6.0-py3-none-any.whl Python 3 none any Details for ol_openedx_chat-0.6.0-py3-none-any.whl

Total release size: 1.2 MB

Release files / ol_openedx_chat-0.6.0.tar.gz

Download URL ol_openedx_chat-0.6.0.tar.gz
Size 579.1 kB
Tags Source
SHA-256 checksum
How to use checksums
89c6ace6f84ad284d35384d359c3203af831328cc3d65f90093e859222f852b9
BLAKE2b-256 checksum
How to use checksums
c7ea50381e1ea2bfc6a3e6421e15981e0956252d6b035a6abbcb66ca574fa2fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / ol_openedx_chat-0.6.0-py3-none-any.whl

Download URL ol_openedx_chat-0.6.0-py3-none-any.whl
Size 584.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35ec77b2c9ef4e23a0ab5ef71db6651617cdaee2e07c62e7f76f846364303292
BLAKE2b-256 checksum
How to use checksums
8998c5728a942ad32d4141df85589f27d408628384a2393ee00652bd957eb226
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for ol-openedx-chat 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page