mirror of
https://github.com/QuivrHQ/quivr.git
synced 2025-01-05 23:03:53 +03:00
803f304390
# Description
Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.
## Checklist before requesting a review
Please delete options that are not relevant.
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged
## Screenshots (if appropriate):
<!--
ELLIPSIS_HIDDEN
-->
----
| 🚀 This description was created by
[Ellipsis](https://www.ellipsis.dev) for commit
3e95f1a5aa
|
|--------|
### Summary:
This PR introduces the 'Quivr Assistants' feature with new frontend
components and pages, backend routes and DTOs changes, and a minor
update in the `processAssistant` function.
**Key points**:
- Introduced the 'Quivr Assistants' feature with new frontend components
and pages, backend routes and DTOs changes.
- Added new `AssistantModal` component in
`/frontend/app/assistants/AssistantModal/AssistantModal.tsx`.
- Added new `InputsStep` and `OutputsStep` components for handling
assistant inputs and outputs.
- Added new `AssistantModal` page in
`/frontend/app/assistants/page.tsx`.
- Added new API endpoints and types for assistants in
`/frontend/lib/api/assistants/assistants.ts` and
`/frontend/lib/api/assistants/types.ts`.
- Updated backend assistant routes and DTOs in
`backend/modules/assistant/controller/assistant_routes.py`,
`backend/modules/assistant/dto/inputs.py`,
`backend/modules/assistant/ito/difference.py`, and
`backend/modules/assistant/ito/summary.py`.
- Made a minor update in the `processAssistant` function in the
`/frontend/lib/api/assistants/assistants.ts` file.
----
Generated with ❤️ by [ellipsis.dev](https://www.ellipsis.dev)
<!--
ELLIPSIS_HIDDEN
-->
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import { createContext, useContext, useState } from "react";
|
|
|
|
import { IntegrationBrains } from "@/lib/api/brain/types";
|
|
|
|
import { StepValue } from "./types/types";
|
|
|
|
interface BrainCreationContextProps {
|
|
isBrainCreationModalOpened: boolean;
|
|
setIsBrainCreationModalOpened: React.Dispatch<React.SetStateAction<boolean>>;
|
|
creating: boolean;
|
|
setCreating: React.Dispatch<React.SetStateAction<boolean>>;
|
|
currentSelectedBrain: IntegrationBrains | undefined;
|
|
setCurrentSelectedBrain: React.Dispatch<
|
|
React.SetStateAction<IntegrationBrains | undefined>
|
|
>;
|
|
currentStep: StepValue;
|
|
setCurrentStep: React.Dispatch<React.SetStateAction<StepValue>>;
|
|
}
|
|
|
|
export const BrainCreationContext = createContext<
|
|
BrainCreationContextProps | undefined
|
|
>(undefined);
|
|
|
|
export const BrainCreationProvider = ({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}): JSX.Element => {
|
|
const [isBrainCreationModalOpened, setIsBrainCreationModalOpened] =
|
|
useState<boolean>(false);
|
|
const [currentSelectedBrain, setCurrentSelectedBrain] =
|
|
useState<IntegrationBrains>();
|
|
const [creating, setCreating] = useState<boolean>(false);
|
|
const [currentStep, setCurrentStep] = useState<StepValue>("FIRST_STEP");
|
|
|
|
return (
|
|
<BrainCreationContext.Provider
|
|
value={{
|
|
isBrainCreationModalOpened,
|
|
setIsBrainCreationModalOpened,
|
|
creating,
|
|
setCreating,
|
|
currentSelectedBrain,
|
|
setCurrentSelectedBrain,
|
|
currentStep,
|
|
setCurrentStep,
|
|
}}
|
|
>
|
|
{children}
|
|
</BrainCreationContext.Provider>
|
|
);
|
|
};
|
|
|
|
export const useBrainCreationContext = (): BrainCreationContextProps => {
|
|
const context = useContext(BrainCreationContext);
|
|
if (!context) {
|
|
throw new Error(
|
|
"useBrainCreationContext must be used within a BrainCreationProvider"
|
|
);
|
|
}
|
|
|
|
return context;
|
|
};
|