-
Notifications
You must be signed in to change notification settings - Fork 12
Fix: Fix creation bugs to make slug unique. #149
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
Conversation
| } | ||
| } | ||
|
|
||
| export async function getNewScriptName() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic of magically delecting assistant name is removed. Right now it defaults to New Assistant where user can have multiple.
| }) | ||
| }) | ||
| const defaultName = "New Assistant"; | ||
| const slug = defaultName.toLowerCase().replace(" ", "-") + "-" + Math.random().toString(36).substring(2, 7); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic of creating a unique slug per assistant by appending random 5 charaters.
| id: scriptId, | ||
| } | ||
| // Only update slug when displayName has changed | ||
| if (existing?.displayName !== root.name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In here we only update the slug when displayName has changed.
|
|
||
| return ( | ||
| <div className={`h-full w-full ${className}`}> | ||
| {showAssistantName && <h1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…ssues Signed-off-by: Daishan Peng <daishan@acorn.io>
7dd82ec to
61c93e5
Compare

This PR fixes creating assistance where slug has to be unique. It makes sure user can create assistance with the same name.
It also fixes other bugs where page is unnecessarily rendered that causes other network traffic.
Ignore all the formatter issues, i am going to have a separate PR after conference to add prettier and eslint config to the project.
#141