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

fix: only categorise initial user input once #348

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

stefl
Copy link
Contributor

@stefl stefl commented Nov 7, 2024

Description

Back-end only, no user-facing change other than speeding up each message by a few seconds in the initial response time.

  • We currently have a bug where we categorise the lesson plan each time we send a message
  • This is because we were failing to call the aila.initialise() method consistently
  • This add a private boolean flag to Aila to store that it has been initialised
  • generate and generateAsync will throw if the instance has not been initialised
  • Updates tests to call the initialise method
  • Update the Aila test to ensure we only categorise empty lesson plans once
  • We have this separate initialise method because it is async and cannot be called in the constructor (unless I am mistaken!)

How to test

  • Run the dev server
  • Start a new lesson
  • See a log for aila:categorisation with the initial message as input
  • Send another message
  • No further aila:categorisation logs appear

Copy link

vercel bot commented Nov 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
oak-ai-lesson-assistant ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 7, 2024 4:10pm

Copy link

sonarqubecloud bot commented Nov 7, 2024

Copy link

github-actions bot commented Nov 7, 2024

Playwright test results

passed  14 passed
skipped  1 skipped

Details

report  Open report ↗︎
stats  15 tests across 14 suites
duration  1 minute, 59 seconds
commit  f866959

Skipped tests

No persona › tests/auth.test.ts › authenticate through Clerk UI

@codeincontext
Copy link
Collaborator

  • We have this separate initialise method because it is async and cannot be called in the constructor (unless I am mistaken!)

That's an interesting distinction between a class and using a "regular" closure I hadn't considered

Copy link
Collaborator

@codeincontext codeincontext left a comment

Choose a reason for hiding this comment

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

Great PR. I tested on the preview branch and it worked as expected

I suppose we would need to add an agent if the user wanted to change the key stage or subject later

@stefl
Copy link
Contributor Author

stefl commented Nov 7, 2024

Great PR. I tested on the preview branch and it worked as expected

I suppose we would need to add an agent if the user wanted to change the key stage or subject later

I think Aila might try to do its best if you try to change the entire title / subject / key stage but really the best approach there is to start a new lesson

@codeincontext
Copy link
Collaborator

Great PR. I tested on the preview branch and it worked as expected
I suppose we would need to add an agent if the user wanted to change the key stage or subject later

I think Aila might try to do its best if you try to change the entire title / subject / key stage but really the best approach there is to start a new lesson

I think as we change the UI around picking key stage that problem might go away anyway

@stefl stefl merged commit dd5bf71 into main Nov 8, 2024
15 checks passed
@stefl stefl deleted the fix/repeated_categorisation branch November 8, 2024 16:35
@oak-machine-user
Copy link
Collaborator

🎉 This PR is included in version 1.14.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants