Skip to content

Conversation

@fisher-alice
Copy link
Contributor

@fisher-alice fisher-alice commented Dec 19, 2025

This updates how to find the first HTML file from the AI tutor code response by just checking if the file name ends with '.html' instead of using file.language which is currently not always accurate (this will be fixed soon by https://codedotorg.atlassian.net/browse/AFL-414).

I also removed the required language for the AI tutor response code since we don't currently use it to update or generate new project files. We just use the file name's file extension.

Before update

Screenshot 2025-12-19 at 10 00 48 AM

After update

Screenshot 2025-12-19 at 1 26 26 PM

Links

Testing story

Tested locally on weblab2 level '/courses/artificial-intelligence-foundations-semester2-2025/units/1/lessons/1/levels/2'

Deployment strategy

Follow-up work

Privacy

Security

Caching

PR Creation Checklist:

  • Tests provide adequate coverage
  • Privacy impacts have been documented
  • Security impacts have been documented
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Follow-up work items (including potential tech debt) are tracked and linked

@fisher-alice fisher-alice marked this pull request as ready for review December 19, 2025 19:32
@fisher-alice fisher-alice requested review from a team and molly-moen December 19, 2025 19:33
items: {
type: 'object',
properties: {
language: {type: 'string'},
Copy link
Contributor

Choose a reason for hiding this comment

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

do we rely on language when merging the generated files into the project?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No - should've included the code references in PR description!

When updating existing active file:

const aiTutorVersionFile: ProjectFile = {
...updatedSource.files[activeFile.id],
contents: aiFile.contents,
isAiTutorVersionUpdated: true,

When updating existing non-active file:

updatedSource.files[matchingFiles[0].id] = {
...matchingFiles[0],
contents: aiFile.contents,
isAiTutorVersionUpdated: true,

When generating new file:

language: aiFile.name.split('.').pop() || '',

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