-
Notifications
You must be signed in to change notification settings - Fork 80
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
[editor] Support Deleting Prompt #665
Conversation
I thought Jonathan added the |
import { | ||
Container, | ||
Group, | ||
Button, | ||
createStyles, | ||
Stack, | ||
Flex, | ||
} from "@mantine/core"; |
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.
Based on my understanding from your response in #640 (comment), this is just fancy colors around base components right?
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.
For mantine in general? Think of it more like XDS - it's a component library that gives a lot of out-of-the-box functionality and common styles that can be easily updated across the components
id: promptId, | ||
}; | ||
|
||
dispatch(action); |
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.
why not inline action to stay consistent with #662 ?
case "DELETE_PROMPT": { | ||
return { | ||
...state, | ||
prompts: state.prompts.filter((prompt) => prompt._ui.id !== action.id), |
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.
Why do we need to nest this extra _ui.id
field instead of using id
directly in
aiconfig/python/src/aiconfig/editor/client/src/shared/types.ts
Lines 12 to 15 in ca59d2c
export type ClientPrompt = Prompt & { | |
_ui: { | |
id: string; | |
}; |
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.
I think it makes it really clear that there's a UI-only distinction between ClientPrompt and Prompt and makes it clearer to reason about for conversion between the two where needed (we should remove UI-only state like this so it's not propagated to the config on disk)
# [editor] Model Selector Implement the model selector and add a placeholder call to the future api endpoint for updating the model. https://github.com/lastmile-ai/aiconfig/assets/5060851/812f3a10-aaac-4ec3-9f1f-4d21ebc99e9f
This is also super nit and not a blocker, but noticed from the Figma file that there's no clear way of deleting a cell. I personally feel like having it on the left is unintuitive (since most systems have action menu on the top right), but yea not a blocker, just wanted to point out it seems strange to me ![]() |
<PromptMenuButton | ||
promptId={prompt._ui.id} | ||
onDeletePrompt={() => onDeletePrompt(prompt._ui.id)} | ||
/> |
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.
Oh yea left comment (#665 (comment)) how I said this feels a bit weird it being on the left instead of right, but yea not a big deal
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.
But also why not put this within the prompt container?
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.
Just a design thing, it's not in the figma designs so just went with how it is in workbooks right now. We can update later
@@ -107,7 +107,7 @@ export default memo(function PromptContainer({ | |||
const { classes } = useStyles(); | |||
|
|||
return ( | |||
<Flex justify="space-between" mt="md"> |
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.
Very quickly, what does the mt
field mean in typescript components?
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.
It's margin-top in supported mantine components
marginLeft: -8, | ||
[theme.fn.smallerThan("sm")]: { | ||
float: "left", | ||
marginTop: -2, |
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.
Feels kind of strange to use negative margins (and kind of related to my question about why not put this within the prompt container itself), but yea not a big deal
zIndex: 99, | ||
"&:hover": { | ||
backgroundColor: | ||
theme.colorScheme === "dark" |
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.
Very cool, but is this not supported automatically? Ex: at FB we have color.primary
, color.emphasized
, etc
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.
Ya, this was copied over from workbooks as well. I can double-check if it's even needed. Mantine does have auto-styling already based on theme so not sure what this was intended for there
const { classes } = useStyles(); | ||
|
||
return ( | ||
<Menu position="bottom-end"> |
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.
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.
Uh, not sure off the top of my head how to do that. But since this placement/UI isn't final anyway I'll hold off on anything for this
Ah, right, let me hook it up and update |
</Button> | ||
</Menu.Target> | ||
|
||
<Menu.Dropdown> |
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.
Just to be clear, is Menu.Dropdown
automatically maintaining it's state to be visible or not based on whether you've clicked the Menu.Target
component?
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.
yes
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.
lgtm, just some minor nits, can be fixed forward
# [editor] Support Deleting Prompt Add the UI side for deleting a prompt, with placeholder to call the server endpoint once it's implemented https://github.com/lastmile-ai/aiconfig/assets/5060851/b3e682dd-a3ed-45c1-b153-b4b6e2094616
Made changes:
|
[editor] Run Prompt (non-streaming) # [editor] Run Prompt (non-streaming) With non-streaming /run endpoint properly returning the response now, we can update the client config with the resulting output. We can also leverage the client-side `_ui` state for maintaining 'isRunning' state to show a spinner / disable the execute button for now (TODO: we may need to handle canceling execution as well). https://github.com/lastmile-ai/aiconfig/assets/5060851/67fa793a-9a60-4285-a7d1-69fff633d6a6 --- Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/lastmile-ai/aiconfig/pull/667). * __->__ #667 * #666 * #665 * #662
[editor] Support Deleting Prompt
[editor] Support Deleting Prompt
Add the UI side for deleting a prompt, with placeholder to call the server endpoint once it's implemented
Screen.Recording.2023-12-28.at.9.33.24.PM.mov
Stack created with Sapling. Best reviewed with ReviewStack.