quivr/frontend/app/assistants/page.tsx

108 lines
3.4 KiB
TypeScript
Raw Normal View History

feat(frontend): Quivr Assistants (#2448) # 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 --> ---- | :rocket: This description was created by [Ellipsis](https://www.ellipsis.dev) for commit 3e95f1a5aad98f0f3f6e1e8f0a89e119ae805ce3 | |--------| ### 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 :heart: by [ellipsis.dev](https://www.ellipsis.dev) <!-- ELLIPSIS_HIDDEN -->
2024-04-19 11:36:36 +03:00
"use client";
import { usePathname } from "next/navigation";
import { useEffect, useState } from "react";
import { Assistant } from "@/lib/api/assistants/types";
import { useAssistants } from "@/lib/api/assistants/useAssistants";
import PageHeader from "@/lib/components/PageHeader/PageHeader";
import { BrainCard } from "@/lib/components/ui/BrainCard/BrainCard";
import { MessageInfoBox } from "@/lib/components/ui/MessageInfoBox/MessageInfoBox";
import { useSupabase } from "@/lib/context/SupabaseProvider";
import { redirectToLogin } from "@/lib/router/redirectToLogin";
import { AssistantModal } from "./AssistantModal/AssistantModal";
import styles from "./page.module.scss";
const Search = (): JSX.Element => {
const pathname = usePathname();
const { session } = useSupabase();
const [assistants, setAssistants] = useState<Assistant[]>([]);
const [assistantModalOpened, setAssistantModalOpened] =
useState<boolean>(false);
const [currentAssistant, setCurrentAssistant] = useState<Assistant | null>(
null
);
const { getAssistants } = useAssistants();
useEffect(() => {
if (session === null) {
redirectToLogin();
}
void (async () => {
try {
const res = await getAssistants();
if (res) {
setAssistants(res);
}
} catch (error) {
console.error(error);
}
})();
}, [pathname, session]);
return (
<>
<div className={styles.page_header}>
<PageHeader
iconName="assistant"
label="Quivr Assistants"
buttons={[]}
/>
<div className={styles.content_wrapper}>
<MessageInfoBox type="info">
<div className={styles.message_wrapper}>
feat(frontend): Quivr Assistants (#2448) # 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 --> ---- | :rocket: This description was created by [Ellipsis](https://www.ellipsis.dev) for commit 3e95f1a5aad98f0f3f6e1e8f0a89e119ae805ce3 | |--------| ### 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 :heart: by [ellipsis.dev](https://www.ellipsis.dev) <!-- ELLIPSIS_HIDDEN -->
2024-04-19 11:36:36 +03:00
<span>
A Quivr Assistant is an AI agent that apply specific processes
to an input in order to generate a usable output.
feat(frontend): Quivr Assistants (#2448) # 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 --> ---- | :rocket: This description was created by [Ellipsis](https://www.ellipsis.dev) for commit 3e95f1a5aad98f0f3f6e1e8f0a89e119ae805ce3 | |--------| ### 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 :heart: by [ellipsis.dev](https://www.ellipsis.dev) <!-- ELLIPSIS_HIDDEN -->
2024-04-19 11:36:36 +03:00
</span>
<span>
For now, you can try the summary assistant, that summarizes a
document and send the result by email or upload it in one of
your brains.
</span>
<span> But don&apos;t worry! Other assistants are cooking!</span>
</div>
</MessageInfoBox>
<MessageInfoBox type="warning">
<div className={styles.message_wrapper}>
<span>
<strong>Feature still in Beta.</strong> Please provide feedbacks
on the chat below!
</span>
</div>
</MessageInfoBox>
feat(frontend): Quivr Assistants (#2448) # 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 --> ---- | :rocket: This description was created by [Ellipsis](https://www.ellipsis.dev) for commit 3e95f1a5aad98f0f3f6e1e8f0a89e119ae805ce3 | |--------| ### 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 :heart: by [ellipsis.dev](https://www.ellipsis.dev) <!-- ELLIPSIS_HIDDEN -->
2024-04-19 11:36:36 +03:00
<div className={styles.assistants_grid}>
{assistants.map((assistant) => {
return (
<BrainCard
tooltip={assistant.description}
brainName={assistant.name}
tags={assistant.tags}
imageUrl={assistant.icon_url}
callback={() => {
setAssistantModalOpened(true);
setCurrentAssistant(assistant);
}}
key={assistant.name}
cardKey={assistant.name}
feat(frontend): Quivr Assistants (#2448) # 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 --> ---- | :rocket: This description was created by [Ellipsis](https://www.ellipsis.dev) for commit 3e95f1a5aad98f0f3f6e1e8f0a89e119ae805ce3 | |--------| ### 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 :heart: by [ellipsis.dev](https://www.ellipsis.dev) <!-- ELLIPSIS_HIDDEN -->
2024-04-19 11:36:36 +03:00
/>
);
})}
</div>
</div>
</div>
{currentAssistant && (
<AssistantModal
isOpen={assistantModalOpened}
setIsOpen={setAssistantModalOpened}
assistant={currentAssistant}
/>
)}
</>
);
};
export default Search;