Conversation
sanchitmalhotra126
left a comment
There was a problem hiding this comment.
So cool! The future is coming 😎
This will be a huge speedup levelbuilders and I'm excited to see us already taking advantage of the AI Gateway for internal use. Left comments as I saw them but didn't pore too deep into some of the longer files. Broadly I'd say my feedback for the next round of iteration is 1) encourage reuse of existing types and frameworks where possible (Lab2 types, HttpClient, etc) and 2) break up larger files into smaller modules.
|
|
||
| import {uploadLevelAsset} from './levelApi'; | ||
|
|
||
| // We don't import getModel from aichat/api/client/helpers/modelHelpers because |
There was a problem hiding this comment.
Huh a bit confused by this - doesn't seem like getModel should have Lab2Registry in the import path, unless I'm missing something? And even then seems like simply importing Lab2Registry shouldn't be an issue if we're not actually calling it?
If it doesn't cause issue, I would prefer to use the existing helpers in aichat/api/client since this gives us a good use case for vetting the AI Gateway client code against internal tool usage (cc @edcodedotorg you might be interested in this use case too).
| ), | ||
| layout: z | ||
| .enum([ | ||
| 'text-top-left', |
There was a problem hiding this comment.
Can we consolidate/share with the PanelLayout type?
| const prompt = [ | ||
| 'You are helping a curriculum author build a "Panels" level: a short,', | ||
| 'comic-strip-style sequence of full-width panels with overlay text.', | ||
| 'The level description follows. Plan a sequence of 3 to 6 panels that,', |
There was a problem hiding this comment.
Should the "3 to 6" be configurable?
There was a problem hiding this comment.
I think 3 is 6 is a reasonable default but the prompt writer should be able to specify their own count (or at least range) which overrides this.
There was a problem hiding this comment.
Can we break up this file 🙂 would be great to at least split the panels and weblab2 specific generation pieces into their own files, with any shared utils in a common location
| }); | ||
|
|
||
| export interface Weblab2Generation { | ||
| startSources: object; |
There was a problem hiding this comment.
Any reason this can't be MultiFileSource?
| // handle_json_params. | ||
| export async function updatePanelsLevel( | ||
| levelId: number, | ||
| panels: object[] |
There was a problem hiding this comment.
Can this be Panel[]?
| // so this is the same payload shape used by the codebridge save button. | ||
| export async function updateStartSources( | ||
| levelId: number, | ||
| startSources: object |
There was a problem hiding this comment.
Can this be MultiFileSource (presumably we do something similar when we save start sources in labs)? @molly-moen @fisher-alice might know better
| export async function updateLongInstructions( | ||
| levelId: number, | ||
| longInstructions: string | ||
| ): Promise<void> { | ||
| const form = new FormData(); | ||
| form.append('level[long_instructions]', longInstructions); |
There was a problem hiding this comment.
Wonder if there's a case for a generic updateLevelProperty API
| const blob = new Blob([data.buffer as ArrayBuffer], {type: mediaType}); | ||
| const form = new FormData(); | ||
| form.append('file', blob, filename); | ||
| const response = await fetch('/level_assets/upload', { |
There was a problem hiding this comment.
Potential future refactor - share this upload code with UploadImageDialog
| export async function loadLessonLevelProperties( | ||
| lessonId: number | ||
| ): Promise<Record<string, Record<string, unknown>>> { | ||
| const response = await fetch(`/lessons/${lessonId}/level_properties`, { |
There was a problem hiding this comment.
Potentially shareable with useLoadLevelProperties though it is just an API call. If not shared, I'd at least say let's use HttpClient and LevelPropertiesValidator.
Return type can also be LevelPropertiesMap.
This proposes a new levelbuilder feature to generate a lesson's levels using AI.
The goal is to make it faster and easier to create a lesson's levels. It's influenced by @jamjamgobambam's Levels and Slides Drafter demo.
This feature is accessed by visiting
/s/[script]/lessons/[lesson]/generate.As working right now, a levelbuilder can generate an entire lesson of panels & weblab2 levels from a single description. It's also easy to adjust the set of levels & their individual descriptions before generating them.
From a single lesson prompt
When starting, it's optional to generate a set of levels from a single lesson prompt:
If provided, this prompt is also fed to all subsequent generation operations to maintain some common context across all levels.
A set of level descriptions
Here's an example set of level descriptions generated from this prompt:
If the single lesson prompt was not used, this can all be set up manually. And even if the prompt was used, this can all be adjusted before the levels generation takes place.
Levels generation
When ready, levels generation can be initiated. A popup shows progress, with even more detail emitted to the console. The feature creates levels and their content: images & text for panels levels; instructions, HTML/CSS/JS for weblab2 levels.
The generated content of all preceding levels is provided for each new level's generation, helping it to maintain consistency.
A lesson
Once generation is complete, we have a lesson with levels. They'll include panels:
And weblab2:
Revisions
It's important to note that this is designed to be run repeatedly for the same lesson when desired. On the generate page, each level's
Generatecheckbox is checked if the description is updated, and can also be checked manually, so that the level will be updated on the next initiation of levels generation.Other labs
This feature enumerates but leaves unsupported levels intact, so that a wider variety of level types can be included in a lesson. Of course, we can add generation of additional level types in the future.