-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Button to stop Agent Generation (#2018)
* Button to stop Agent Generation * Absolutely no need for that * Don't await check on redis * Stop generation for the whole convo * Stop generation for conversation, put button in FixedInputBar * Apply first feedback * New /cancel route to post cancellation * Keep provider top level component * fix bad rebase * Loading state for stop generation button
- Loading branch information
Showing
13 changed files
with
589 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
front/components/assistant/conversation/GenerationContextProvider.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { createContext, useState } from "react"; | ||
|
||
type GenerationContextType = { | ||
generatingMessageIds: string[]; | ||
setGeneratingMessageIds: React.Dispatch<React.SetStateAction<string[]>>; | ||
}; | ||
|
||
export const GenerationContext = createContext< | ||
GenerationContextType | undefined | ||
>(undefined); | ||
|
||
export const GenerationContextProvider = ({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) => { | ||
const [generatingMessageIds, setGeneratingMessageIds] = useState<string[]>( | ||
[] | ||
); | ||
return ( | ||
<GenerationContext.Provider | ||
value={{ | ||
generatingMessageIds: generatingMessageIds, | ||
setGeneratingMessageIds: setGeneratingMessageIds, | ||
}} | ||
> | ||
{children} | ||
</GenerationContext.Provider> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.