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

Display advice in empty editor to use Mito AI #1368

Merged
merged 5 commits into from
Nov 29, 2024

Conversation

fcollonval
Copy link
Collaborator

@fcollonval fcollonval commented Nov 14, 2024

Description

Display advice to trigger the chat panel in empty cells

Testing

Work out of the box
Added an integration test for the feature

advice_.mp4

Latest version looks like that:

image

Documentation

N/A

Copy link

vercel bot commented Nov 14, 2024

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

Name Status Preview Comments Updated (UTC)
monorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 28, 2024 11:20am

Copy link
Member

@aarondr77 aarondr77 left a comment

Choose a reason for hiding this comment

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

This is super sweet! I love this. It's a great touch.

mito-ai/src/Extensions/emptyCell/emptyCell.ts Show resolved Hide resolved
Pass custom keybinding
Place the advice after the cursor
Copy link
Member

@aarondr77 aarondr77 left a comment

Choose a reason for hiding this comment

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

Just a little bit of cleanup and then LGTM without another review. Nice work! The tests aren't going to pass on a forked PR, so we'll see them pass on the CI after merging. And in the future, now that you have write access, you can open cloned PRs and the tests should run + pass there :)

mito-ai/src/Extensions/emptyCell/index.ts Outdated Show resolved Hide resolved
mito-ai/src/Extensions/emptyCell/emptyCell.ts Outdated Show resolved Hide resolved
});

/**
* A facet that stores the chat shortcut.
Copy link
Member

Choose a reason for hiding this comment

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

My understanding is that when there are multiple code mirror extensions in one code mirror editor, this combine function is used to figure out how to reconcile them. So here, we are saying something like: If there are multiple chatShorcut decorations set, use the last one.

Is this needed in order to update the decorations displayed? ie: If instead of returning the last value, we instead returned the first one, would we always display the placeholder text?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually this apply only for the Facet that is storing configuration information. Using the latest value is usually the best option if we don't know better.

It is unlikely to happen in this case.

mito-ai/ui-tests/tests/mitoAdvice.spec.ts Outdated Show resolved Hide resolved
await page.notebook.setCell(0, 'code', 'print("Hello, World!")');

await expect
.soft((await page.notebook.getCellLocator(0))!.getByRole('textbox'))
Copy link
Member

Choose a reason for hiding this comment

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

ooo cool! I didn't know this soft assertion was a thing. This is great for letting us test each of the different permutations in one test. I like it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep and it is recommended as best practice: https://playwright.dev/docs/best-practices#use-soft-assertions

@aarondr77 aarondr77 merged commit 28835fe into mito-ds:dev Nov 29, 2024
17 of 59 checks passed
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