-
Notifications
You must be signed in to change notification settings - Fork 3
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: AI Chat drawer #422
feat: AI Chat drawer #422
Conversation
c14e729
to
6531a8a
Compare
will this close https://github.com/mitodl/hq/issues/6514 |
Yes, It will. I can add the issue in the PR description. |
eda4f72
to
f8383d8
Compare
78a02d6
to
3745128
Compare
2aec05b
to
3b39b6f
Compare
e4ba490
to
77ef5dc
Compare
conversationStarters: starters, | ||
}, | ||
}, | ||
"http://apps.local.openedx.io:2000", // Ensure correct parent origin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be an env var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, Let me fix this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{% elif block_type == "video" %} | ||
<p><b>Questions about this video?</b><br>AskTim</p> | ||
{% endif %} | ||
<img src="/static/images/icon.svg" alt="Chat Icon" class="chat-icon"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<img src="/static/images/icon.svg" alt="Chat Icon" class="chat-icon"> | |
<img src="/static/images/icon.svg" alt="" class="chat-icon"> |
The icon is purely decorative. Better for screenreaders to ignore it. The button text is all that screenreaders need.
I noticed this as well. I can work on this in a follow-up PR while we test it out on RC. I can create an issue for this tomorrow. |
src/ol_openedx_chat/block.py
Outdated
if getattr(block, "category", None) == "video": | ||
try: | ||
content, filename, mimetype = get_transcript_from_contentstore( | ||
block, "en", "txt", block.get_transcripts_info() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Was there any specific reason for requesting the .txt
transcripts? .srt
in my opinion is more widely used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not using the transcript for now. It's better to remove this as we will pass the block ID and the transcript will be fetched separately. I can remove this.
src/ol_openedx_chat/block.py
Outdated
ask_tim_drawer_title = String( | ||
display_name=_("Open Learning Drawer Title"), | ||
default="", | ||
scope=Scope.content, | ||
help=_("Drawer title displayed in the chat drawer"), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I have two suggestions here:
- We might want to use enforce_type to make sure it is always stored as string.
- I haven't run the block but I think we should set
about {block.display_name}
from below code as a default here. We would probably save someif
conditions.- Also, Have we tested this if the title is too long? Would that break the design?
- Should we not use settings scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have followed the existing field pattern that you added. We haven't used enforced_type + the settings scope. Looking at what it means makes me think that we should set the settings scope for all other fields as well.
Also, Have we tested this if the title is too long? Would that break the design?
This will be passed to the drawer from the smooth design. I can test it but it is not related to the current PR.
but I think we should set about {block.display_name} from below code as a default here
We don't have a block here it self, I am not sure of a way to set the default here. That is why I used the defaults when displaying in CMS/LMS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/ol_openedx_chat/block.py
Outdated
drawer_title = ( | ||
self.ask_tim_drawer_title | ||
if self.ask_tim_drawer_title | ||
else f"about {block.display_name}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related comment above
src/ol_openedx_chat/block.py
Outdated
except Exception: # noqa: BLE001 | ||
content = "" | ||
|
||
extra_context["video_transcript"] = content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we are passing the whole transcript here. I might be wrong but my understanding was that we will pass an id. Sorry, if this sounds like an unreasonable question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed as I mentioned above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just a code review from my side.
I didn't test it due to time constraints but I am ok since you and Chris have tested it. Good to go from my side. 👍
What are the relevant tickets?
Closes https://github.com/mitodl/hq/issues/6514
Description (What does it do?)
Adds chat AI button when it is enabled for a problem or a video block. Also, fixes an issue with the Aside field naming + adds a new field for the drawer title.
Screenshots (if appropriate):
How can this be tested?
pants package :: .
npm pack @mitodl/smoot-design@3.4.0
tar -xvzf mitodl-smoot-design-3.4.0.tgz
mv package mitodl-smoot-design
npm run dev
LEARN_AI_API_URL = "http://ai.open.odl.local:8002/http/recommendation_agent/"