Add aichat to allthethings#52538
Conversation
| elsif @type_class == Music | ||
| @game = Game.music | ||
| elsif @type_class == Aichat | ||
| @game = Aichat.music |
There was a problem hiding this comment.
This should probably be @game = Game.aichat.
There was a problem hiding this comment.
Good catch; I have no idea how I renamed it so badly!
| end | ||
|
|
||
| def self.aichat | ||
| @@game_music ||= find_by_name('Aichat') |
There was a problem hiding this comment.
This should probably be @@game_aichat ||= find_by_name('Aichat')
There was a problem hiding this comment.
We should be able to simplify this a fair bit, and hopefully not depend on the legacy studioApp.
There was a problem hiding this comment.
We should also be able to simplify this file, and not rely on legacy components such as StudioAppWrapper.
|
It would be great for @molly-moen and @sanchitmalhotra126 to take a look at this too, to suggest which new parts of our framework this code might be able to use. |
For sure, it would be great to use the new lab framework here! (this would also be a great test of how easy or hard it is to onboard a new lab to the new framework). I think all the dashboard changes are good as-is (adding a new game type, etc). For the front end, we should just need:
@breville actually has some cool stuff in the works here which would create a single common entrypoint for all "Lab2" (lab lab) labs, so we potentially wouldn't even need a separate levels-aichat-main.js entrypoint. |
fea5397 to
e8e2c20
Compare
ad086c0 to
07e1d33
Compare
| */ | ||
|
|
||
| const Aichat: React.FunctionComponent<AichatProps> = ({children}) => { | ||
| // Leave a margin to the left and the right of the video, to the edges |
There was a problem hiding this comment.
You probably won't need this layout stuff which is designed for a video which needs to maintain its aspect ratio while also filling the screen as much as possible. A simple flex layout should be enough for your app to take up the whole page in a few panels.
| import ProjectContainer from '@cdo/apps/lab2/projects/ProjectContainer'; | ||
| import ProgressContainer from '@cdo/apps/lab2/progress/ProgressContainer'; | ||
| import AichatView from '@cdo/apps/aichat/AichatView'; | ||
| import {logError} from '@cdo/apps/music/utils/MusicMetrics'; |
There was a problem hiding this comment.
@sanchitmalhotra126 Can you confirm that the desired approach is to create an AichatMetrics version of
There was a problem hiding this comment.
Actually I've removed MusicMetrics in this PR: #52714, in favor of a global Lab2MetricsReporter singleton that any lab can use directly, so we shouldn't need a specific AichatMetrics.
| }, | ||
| { | ||
| name: 'aichat', | ||
| usesChannel: false, |
There was a problem hiding this comment.
Can someone clarify the meaning of these values? usesChannel indicates a project is channel-backed, yes? I'm not sure about backgroundMode.
There was a problem hiding this comment.
usesChannel means that the level is project/channel-backed.
backgroundMode is a new concept that indicates whether the level is removed from the DOM when not active. For Music Lab, we don't yet support this removal from the DOM due to our Blockly usage not yet supporting a full teardown and subsequent recreation, and so we just make it invisible. For standalone videos, we do support removal from the DOM. You can pick based on your lab's capabilities, but it seems most likely you'd want to aim for false for this value.
| # index_levels_on_name (name) | ||
| # | ||
|
|
||
| # TODO: Update this level to account for the params we actually need. |
There was a problem hiding this comment.
Callout: I did not do much work to customize this, but I assume that's all right to be future work.
There was a problem hiding this comment.
We don't want to lock ourselves into a schema that requires a migration to address, but it's probably the contents of serialized_attrs that we might want to adjust, and those can be changed without a migration since they all serialize to the same database field.
| '@cdo/aichat/locale': path.resolve( | ||
| __dirname, | ||
| 'src', | ||
| 'aichat', | ||
| 'locale-do-not-import.js' | ||
| ), |
There was a problem hiding this comment.
I'm actually curious whether this is needed.
There was a problem hiding this comment.
I get a webpack error without it, but I am happy to dig in more.
There was a problem hiding this comment.
I think so long as we have lab-specific locale files, we will need these specific aliases.
| elsif @level.is_a? Blockly | ||
| blockly_options | ||
| elsif @level.is_a?(Weblab) || @level.is_a?(Fish) || @level.is_a?(Ailab) || @level.is_a?(Javalab) | ||
| elsif @level.is_a?(Weblab) || @level.is_a?(Fish) || @level.is_a?(Ailab) || @level.is_a?(Javalab) || @level.is_a?(Aichat) |
There was a problem hiding this comment.
Is this needed since this is a Lab2 app?
There was a problem hiding this comment.
I don't think so, thanks! I should also be able to remove the non_blockly_puzzle_level_options method from the Aichat model.
| options.freeze | ||
| end | ||
|
|
||
| def uses_lab2? |
There was a problem hiding this comment.
since uses_lab2 is true, we don't need a bunch of the boilerplate anymore. Everything gets loaded via levels-lab2-main, so you don't need the aichat version of that file, along with a bunch of other logic, you can see where I removed some of this for music in this PR. It would also be worth merging the latest changes into this branch, it doesn't look like you have the changes from that linked pr here.
| @@ -0,0 +1,12 @@ | |||
| import appMain from '@cdo/apps/appMain'; | |||
There was a problem hiding this comment.
I don't think we need this anymore either!
| }, | ||
| { | ||
| "seeding_key": { | ||
| "level.key": "AI Chat Test Level", |
There was a problem hiding this comment.
are we missing this file from this PR? I tried to pull and seed locally and it can't find the level.
There was a problem hiding this comment.
Added dashboard/config/scripts/levels/AI Chat Test Level.level and confirmed seeding that level succeeds locally.
There was a problem hiding this comment.
@molly-moen @breville double checking - do we still need this file? I know we currently do have one for music, but it seems like since we don't call appMain(), these levels files are not referenced anywhere.
There was a problem hiding this comment.
Hmm we may be able to delete it then! I may have missed that in my clean up
| '@cdo/aichat/locale': path.resolve( | ||
| __dirname, | ||
| 'src', | ||
| 'aichat', | ||
| 'locale-do-not-import.js' | ||
| ), |
There was a problem hiding this comment.
I think so long as we have lab-specific locale files, we will need these specific aliases.
|
@sanchitmalhotra126 I was assuming there would be outstanding work here to include the new |
Yep correct! This was replaced with a top-level Lab2MetricsReporter whose reporting functions can be called directly from lab code when needed. |
molly-moen
left a comment
There was a problem hiding this comment.
🎉 thanks for incorporating all the lab2 stuff as it was hot off the presses!
sanchitmalhotra126
left a comment
There was a problem hiding this comment.
🎉 awesome! Very cool to see a new app onboarded onto the Lab2 framework so quickly, and thanks for bearing with our updates!
| // TODO: Add AichatLevelData. | ||
|
|
There was a problem hiding this comment.
Note that if AichatLevelData extends ProjectLevelData, it would probably be better to define the type within the aichat directory (like MusicLevelData, defined in music/types), so that the lab-specific level data definition can be closer to the lab that's using it
There was a problem hiding this comment.
Thanks for the feedback! I'll call this out in Slack for the fast-follow PRs, but I didn't move the comment for now, because I'm eager to get this into staging.
Adds a placeholder level for
Aichatto/s/allthethingsusing the new Lab2 framework (I think 😄). S/o to Molly, Brendan, and Sanchit for their work there!aichat_allthethings.mov
I welcome a close look at the boilerplate because this is my first time adding a new app type.
Links
Jira ticket: https://codedotorg.atlassian.net/browse/SL-940
Testing story
Tested locally; see Quicktime movie above.
Deployment strategy
Follow-up work
Privacy
Security
Caching
PR Checklist: