Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add basic lms chat #398

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

feat: add basic lms chat #398

wants to merge 5 commits into from

Conversation

asadali145
Copy link

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/6087

Description (What does it do?)

Adds a basic chat window in the LMS for the MCQ blocks.

Screenshots (if appropriate):

Screen.Recording.2024-11-21.at.5.28.18.PM.mov

How can this be tested?

  • Build it locally by pants package :: .
  • Install in LMS by going to the lms shell pip install /edx/src/open-edx-plugins/dist/ol-openedx-chat-0.1.0.tar.gz
  • Open any MCQ problem

@asadali145 asadali145 force-pushed the asad/basic-lms-chat-v2 branch from 995a4f2 to 09f8a7d Compare November 22, 2024 06:13
@asadali145 asadali145 force-pushed the asad/basic-lms-chat-v2 branch from ded723b to cb94286 Compare November 22, 2024 10:39

$.ajax({
type: "POST",
url: runtime.handlerUrl(element, 'mock_handler'),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Does tthis call the problem-specific OLChatAside mock_handler method? So the actual URL might be like problem/uuid-1234-xyz/?

And is this way, the chat API knows the context—which problem is it helping with?

Am I understanding that roughly correctly?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, You are spot on.

Comment on lines 1 to 3
function AiChatAsideView(runtime, element) {
$('.chat-button').on('click', function () {
const blockKey = $(this).data("block-key")
Copy link

@ChristopherChudzicki ChristopherChudzicki Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor question... I see the data- attribute can be used to pass serialized data from python to the JS file.

I noticed in https://docs.openedx.org/projects/xblock/en/latest/xblock-tutorial/anatomy/javascript.html the JS function had signature

function ThumbsAside(runtime, element, block_element, init_args) { /* etc */ }

Do we control the 3rd argument? Is that another way to pass data?

Copy link
Author

@asadali145 asadali145 Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we can pass the data via the 4th init_args argument.

@asadali145 asadali145 force-pushed the asad/basic-lms-chat-v2 branch from 86fb807 to 2664d33 Compare December 20, 2024 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants