-
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
Feat: Add in ability to delete a single output by prompt name in editor #1465
Changes from all commits
0c0f78d
c7c2d17
c958a1d
8b4b559
cf0cf99
c299c4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,4 +141,4 @@ dist | |
__pycache__/ | ||
models | ||
*.egg-info | ||
.hypothesis | ||
.hypothesis |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ import { memo, useContext } from "react"; | |
import AIConfigContext from "../../contexts/AIConfigContext"; | ||
import AddPromptButton from "./AddPromptButton"; | ||
import { ClientPrompt } from "../../shared/types"; | ||
import PromptMenuButton from "./PromptMenuButton"; | ||
import PromptContainer from "./PromptContainer"; | ||
import { JSONObject, PromptInput } from "aiconfig"; | ||
|
||
|
@@ -18,6 +17,7 @@ type Props = { | |
) => Promise<void>; | ||
onChangePromptName: (promptId: string, newName: string) => Promise<void>; | ||
onDeletePrompt: (promptId: string) => Promise<void>; | ||
onDeleteOutput: (promptId: string) => Promise<void>; | ||
onRunPrompt: (promptId: string) => Promise<void>; | ||
onUpdatePromptMetadata: ( | ||
promptId: string, | ||
|
@@ -58,25 +58,23 @@ export default memo(function PromptsContainer(props: Props) { | |
/> | ||
)} | ||
{props.prompts.map((prompt: ClientPrompt, i: number) => { | ||
const promptId = prompt._ui.id; | ||
const isAnotherPromptRunning = | ||
props.runningPromptId !== undefined && | ||
props.runningPromptId !== prompt._ui.id; | ||
props.runningPromptId !== promptId; | ||
|
||
return ( | ||
<Stack key={prompt._ui.id}> | ||
<Flex mt="md"> | ||
{!readOnly && ( | ||
<PromptMenuButton | ||
promptId={prompt._ui.id} | ||
onDeletePrompt={() => props.onDeletePrompt(prompt._ui.id)} | ||
/> | ||
)} | ||
Comment on lines
-67
to
-72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. omg this had me confused so hard wondering wtf was going on, but this is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this change, I feel it makes sense to put with the individual prompt component anyways |
||
<PromptContainer | ||
prompt={prompt} | ||
getModels={props.getModels} | ||
onChangePromptInput={props.onChangePromptInput} | ||
onChangePromptName={props.onChangePromptName} | ||
cancel={props.cancelRunPrompt} | ||
onRunPrompt={props.onRunPrompt} | ||
onDeletePrompt={props.onDeletePrompt} | ||
onDeleteOutput={props.onDeleteOutput} | ||
Comment on lines
+76
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice |
||
onUpdateModel={props.onUpdatePromptModel} | ||
onUpdateModelSettings={props.onUpdatePromptModelSettings} | ||
onUpdateParameters={props.onUpdatePromptParameters} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ export function aiConfigToClientConfig(aiconfig: AIConfig): ClientAIConfig { | |
export type LogEvent = | ||
| "ADD_PROMPT" | ||
| "CLEAR_OUTPUTS" | ||
| "DELETE_OUTPUT" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Would like to use wording "CLEAR_OUTPUT" to match with our UI, but again not a blocker or a big deal There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think maybe as a bigger refactor of the api? i made it clear output at first but then found that all the apis reference delete output so wanted to stay consistent there. |
||
| "DELETE_GLOBAL_MODEL_SETTINGS" | ||
| "DELETE_PROMPT" | ||
| "DOWNLOAD_BUTTON_CLICKED" | ||
|
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.
nit: feel
prompt.outputs?.length > 0
is easier to read and I don't really like JS implicitly "falsey-ness" but don't really careThere 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 actually complains if you use this syntax unelss you do a
(prompt.outputs?.length || 0) > 0
it seems, so thats why i kept it with this way