diff --git a/README.md b/README.md index 3b967fea..4821779d 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,18 @@ Follow one, # Run using the staging profile docker-compose --profile=staging up ``` + + +
+Docker docker-compose (Linux/Without Nvidia GPU)   +
+ +It emulates the use of AI pipeline when you don't have a GPU available. It returns fixed fake images from the models. +This is because it is mandatory to have GPU to use Generative AI. It's a good way to test the application locally +```bash +# Run using the no-gpu profile +docker-compose --profile=local up +```
diff --git a/morpheus-client/components/CookiesConsent/CookiesConsent.module.scss b/morpheus-client/components/CookiesConsent/CookiesConsent.module.scss new file mode 100644 index 00000000..e610053d --- /dev/null +++ b/morpheus-client/components/CookiesConsent/CookiesConsent.module.scss @@ -0,0 +1,68 @@ +@use "styles/colors"; +@use "styles/media"; +@use "styles/variables"; + + +.cookiesContainer { + position: fixed; + bottom: 0; + left: 0; + width: 100vw; + min-height: 50px; + height: auto; + z-index: 999; + display: flex; + align-items: center; + justify-content: center; + background-color: rgba(0, 0, 0, 0.9); + padding: 20px; + + @include media.mobile { + flex-direction: column; + justify-content: flex-start; + } + + .textContainer { + width: 70%; + height: 100%; + display: flex; + align-items: center; + + a { + display: block; + text-decoration: underline; + } + + @include media.mobile { + width: 100%; + flex-direction: column; + align-items: flex-start; + } + } + + .buttonsSection { + width: auto; + margin-left: 24px; + display: flex; + justify-content: space-between; + min-width: 400px; + padding-right: 24px; + + @include media.mobile { + width: 100%; + flex-direction: column; + margin: 24px 0 0 0; + } + + button { + :first-child { + margin-right: 24px !important; + } + + @include media.mobile { + width: 100%; + margin: 8px !important; + } + } + } +} \ No newline at end of file diff --git a/morpheus-client/components/CookiesConsent/CookiesConsent.tsx b/morpheus-client/components/CookiesConsent/CookiesConsent.tsx new file mode 100644 index 00000000..8ca36d54 --- /dev/null +++ b/morpheus-client/components/CookiesConsent/CookiesConsent.tsx @@ -0,0 +1,66 @@ +import { useEffect, useState } from "react"; +import { useAnalytics } from "@/context/GoogleAnalyticsContext"; +import { deleteAllCookies, CookiesStatus } from "@/utils/cookies"; +import { useLocalStorage } from "@/hooks/useLocalStorage"; +import styles from "./CookiesConsent.module.scss"; + + + +const CookiesConsent = () => { + const [finalStatus, setFinalStatus] = useState(""); + const { cookiesStatus, setCookiesStatus } = useAnalytics(); + + const [localCookies, setLocalCookies] = useLocalStorage("cp:cookies", null); + + + useEffect(() => { + const newStatus = localCookies || cookiesStatus || ""; + setFinalStatus(newStatus); + if (newStatus !== "") { + if (localCookies && localCookies !== "") setCookiesStatus(localCookies); + } + }, [localCookies, setCookiesStatus, cookiesStatus]); + + const handleActionCookies = (event: any, status: string) => { + event.preventDefault(); + + if (status === CookiesStatus.Declined) { + deleteAllCookies(); + } + + setCookiesStatus(status); + setLocalCookies(status); + }; + + return finalStatus === "" ? ( +
+
+

+ This website uses cookies to ensure you get the best experience on our + website. + + Privacy Policy + +

+
+ +
+ + + +
+
+ ) : null; +}; + +export default CookiesConsent; \ No newline at end of file diff --git a/morpheus-client/context/GoogleAnalyticsContext.tsx b/morpheus-client/context/GoogleAnalyticsContext.tsx new file mode 100644 index 00000000..0174f533 --- /dev/null +++ b/morpheus-client/context/GoogleAnalyticsContext.tsx @@ -0,0 +1,74 @@ +import { createContext, ReactNode, useContext, useEffect, useState } from "react"; +import { useRouter } from "next/router"; +import { analytics } from "../lib/firebaseClient"; +import { logEvent } from "firebase/analytics"; +import { CookiesStatus } from "@/utils/cookies"; + +export interface IAnalyticsContext { + analytics: any; + cookiesStatus: string; + setCookiesStatus: (accept: string) => void; + sendAnalyticsRecord: (type: string, message: any) => void; +} + +const defaultState = { + analytics: undefined, + cookiesStatus: "", + setCookiesStatus: () => {}, + sendAnalyticsRecord: () => {}, +}; + +const AnalyticsContext = createContext(defaultState); + +const FirebaseTrackingProvider = (props: { children: ReactNode }) => { + const router = useRouter(); + const [cookiesStatus, setCookiesStatus] = useState(""); + + useEffect(() => { + const handleRouteChange = (url: string) => { + if (cookiesStatus === CookiesStatus.Accepted && analytics) { + return; + } + + logEvent(analytics, "page_view", { + page_location: url, + page_title: document?.title, + }); + }; + + router.events.on("routeChangeStart", handleRouteChange); + + return () => { + router.events.off("routeChangeStart", handleRouteChange); + }; + }, [cookiesStatus, router.events]); + + const sendAnalyticsRecord = (type: string, parameters: object) => { + if (cookiesStatus === CookiesStatus.Accepted && analytics) { + logEvent(analytics, type, parameters); + } + }; + + return ( + + {props.children} + + ); +}; + +const useAnalytics = () => { + const context = useContext(AnalyticsContext); + if (context === undefined) { + throw new Error("useAnalytics must be used within a AnalyticsProvider"); + } + return context; +}; + +export { FirebaseTrackingProvider, useAnalytics }; diff --git a/morpheus-client/pages/404.tsx b/morpheus-client/pages/404.tsx index 64ca9772..91c62c93 100644 --- a/morpheus-client/pages/404.tsx +++ b/morpheus-client/pages/404.tsx @@ -1,15 +1,28 @@ -import { useCallback } from "react"; +import { useCallback, useEffect } from "react"; import { useRouter } from "next/router"; + +import { CookiesStatus } from "@/utils/cookies"; +import { useAnalytics } from "@/context/GoogleAnalyticsContext"; import MainContainer from "../layout/MainContainer/MainContainer"; import styles from "../styles/pages/Error.module.scss"; const Page400 = () => { + const { cookiesStatus, sendAnalyticsRecord } = useAnalytics(); const router = useRouter(); - const handleClickToAction = useCallback(async () => { await router.push("/"); }, [router]); + useEffect(() => { + if (cookiesStatus === CookiesStatus.Accepted) { + sendAnalyticsRecord("page_view", { + page_location: window.location.href, + page_title: document?.title, + page_name: "Error", + }); + } + }, [cookiesStatus, sendAnalyticsRecord]); + return (
diff --git a/morpheus-client/pages/_app.tsx b/morpheus-client/pages/_app.tsx index 8775f860..fddb751d 100644 --- a/morpheus-client/pages/_app.tsx +++ b/morpheus-client/pages/_app.tsx @@ -8,7 +8,9 @@ import { AuthProvider } from "@/context/AuthContext"; import { DiffusionProvider } from "@/context/SDContext"; import { ControlNetProvider } from "@/context/CNContext"; import { ImagineProvider } from "@/context/ImagineContext"; +import { FirebaseTrackingProvider } from "@/context/GoogleAnalyticsContext"; import { Toaster } from "@/components/ui/toaster"; +import CookiesConsent from "@/components/CookiesConsent/CookiesConsent"; import "../App.scss"; import "../styles/globals.css"; @@ -123,18 +125,21 @@ const App: FC = ({ Component, pageProps }) => { - - - - - - - - - - - - + + + + + + + + + + + + + + + ); }; diff --git a/morpheus-client/pages/about.tsx b/morpheus-client/pages/about.tsx index 59ecc7af..4f7cdbdc 100644 --- a/morpheus-client/pages/about.tsx +++ b/morpheus-client/pages/about.tsx @@ -1,3 +1,7 @@ +import { useEffect } from "react"; + +import { CookiesStatus } from "@/utils/cookies"; +import { useAnalytics } from "@/context/GoogleAnalyticsContext"; import MainContainer from "../layout/MainContainer/MainContainer"; import FAQ from "../components/FAQ/FAQ"; import { AppLink } from "@/components/AppLink/AppLink"; @@ -12,6 +16,18 @@ import { import styles from "../styles/pages/About.module.scss"; const About = () => { + const { cookiesStatus, sendAnalyticsRecord } = useAnalytics(); + + useEffect(() => { + if (cookiesStatus === CookiesStatus.Accepted) { + sendAnalyticsRecord("page_view", { + page_location: window.location.href, + page_title: document?.title, + page_name: "About", + }); + } + }, [cookiesStatus, sendAnalyticsRecord]); + return (
@@ -57,13 +73,13 @@ const About = () => {

We’re hoping to get some feedback from users like you! Do you find this useful? Are there features missing from our{" "} - + roadmap {" "} that you would like to see? Run into any problems or bugs? We want to hear about it! Contact us via{" "} email diff --git a/morpheus-client/pages/gallery/[collectionId].tsx b/morpheus-client/pages/gallery/[collectionId].tsx index 722b1fd2..2c700c94 100644 --- a/morpheus-client/pages/gallery/[collectionId].tsx +++ b/morpheus-client/pages/gallery/[collectionId].tsx @@ -1,6 +1,8 @@ import React, { Fragment, useEffect, useState } from "react"; import { NextPage } from "next"; import { useRouter } from "next/router"; + +import { CookiesStatus } from "@/utils/cookies"; import PrivateRoute from "@/components/Auth/PrivateRoute/PrivateRoute"; import Loader from "@/components/Loaders/LoaderCircle/Loader"; import CollectionForm from "@/components/CollectionForm/CollectionForm"; @@ -9,6 +11,7 @@ import ArtWorkList from "@/components/ArtWorkList/ArtWorkList"; import { getCollectionArtWorks } from "@/services/artworks"; import { deleteCollection, getCollectionDetails } from "@/services/collection"; import { useToastContext } from "@/context/ToastContext"; +import { useAnalytics } from "@/context/GoogleAnalyticsContext"; import { ArtWork, Collection } from "@/models/models"; import styles from "@/styles/pages/CollectionDetails.module.scss"; @@ -22,6 +25,7 @@ const CollectionDetail: NextPage = () => { const [isLoading, setIsLoading] = useState(false); const [collection, setCollection] = useState(); const [artWorks, setArtWorks] = useState([]); + const { cookiesStatus, sendAnalyticsRecord } = useAnalytics(); useEffect(() => { if (collectionId) { @@ -52,6 +56,16 @@ const CollectionDetail: NextPage = () => { } }, [collectionId]); + useEffect(() => { + if (cookiesStatus === CookiesStatus.Accepted && collection) { + sendAnalyticsRecord("page_view", { + page_location: window.location.href, + page_title: document?.title, + page_name: `Collection ${collection?.name} detail` + }); + } + }, [cookiesStatus, sendAnalyticsRecord, collection]); + const handleEdit = () => { setShowForm(true); }; diff --git a/morpheus-client/pages/gallery/index.tsx b/morpheus-client/pages/gallery/index.tsx index 44354ec9..9d9198ec 100644 --- a/morpheus-client/pages/gallery/index.tsx +++ b/morpheus-client/pages/gallery/index.tsx @@ -1,11 +1,14 @@ import { useEffect, useState } from "react"; import { NextPage } from "next"; + +import { CookiesStatus } from "@/utils/cookies"; import Loader from "@/components/Loaders/LoaderCircle/Loader"; import PrivateRoute from "@/components/Auth/PrivateRoute/PrivateRoute"; import SearchForm from "@/components/SearchForm/SearchForm"; import ArtWorkList from "@/components/ArtWorkList/ArtWorkList"; import Collections from "@/components/Collections/Collections"; import { useAuth } from "@/context/AuthContext"; +import { useAnalytics } from "@/context/GoogleAnalyticsContext"; import { getUserArtWorks } from "@/services/artworks"; import { isEmptyObject } from "@/utils/object"; import { useToastContext } from "@/context/ToastContext"; @@ -16,6 +19,7 @@ const Gallery: NextPage = () => { const { user } = useAuth(); const { showErrorAlert } = useToastContext(); const [isLoading, setIsLoading] = useState(false); + const { cookiesStatus, sendAnalyticsRecord } = useAnalytics(); const [artWorks, setArtWorks] = useState([]); useEffect(() => { @@ -23,6 +27,16 @@ const Gallery: NextPage = () => { loadUserArtWorks(); }, [user]); + useEffect(() => { + if (cookiesStatus === CookiesStatus.Accepted) { + sendAnalyticsRecord("page_view", { + page_location: window.location.href, + page_title: document?.title, + page_name: "Gallery", + }); + } + }, [cookiesStatus, sendAnalyticsRecord]); + const loadUserArtWorks = async () => { setIsLoading(true); getUserArtWorks() diff --git a/morpheus-client/pages/imagine/controlnet.tsx b/morpheus-client/pages/imagine/controlnet.tsx index 42f2b17f..c4c2c61d 100644 --- a/morpheus-client/pages/imagine/controlnet.tsx +++ b/morpheus-client/pages/imagine/controlnet.tsx @@ -1,19 +1,29 @@ import { NextPage } from "next"; + +import { CookiesStatus } from "@/utils/cookies"; import ImageGallery from "../../components/ImageGallery/ImageGallery"; import ImageDraggable from "../../components/ImageDraggable/ImageDraggable"; import ImagineInput from "../../components/ImagineInput/ImagineInput"; import PrivateRoute from "../../components/Auth/PrivateRoute/PrivateRoute"; import { useDiffusion } from "../../context/SDContext"; import { useImagine } from "../../context/ImagineContext"; +import { useAnalytics } from "../../context/GoogleAnalyticsContext"; import styles from "../../styles/pages/StableDiffusion.module.scss"; const ControlNetImg: NextPage = () => { const { prompt } = useDiffusion(); + const { cookiesStatus, sendAnalyticsRecord } = useAnalytics(); const { img2imgFile, setImg2imgFile, generateImages } = useImagine(); const isFormValid = prompt.value.length > 0 && img2imgFile !== null; const handleGenerate = async () => { generateImages("controlnet"); + if (cookiesStatus === CookiesStatus.Accepted) { + sendAnalyticsRecord("generate_images", { + prompt: prompt.value, + model: "controlnet", + }); + } }; return ( @@ -22,10 +32,7 @@ const ControlNetImg: NextPage = () => {

); diff --git a/morpheus-client/pages/imagine/help.tsx b/morpheus-client/pages/imagine/help.tsx index 4888c0f5..62e0db67 100644 --- a/morpheus-client/pages/imagine/help.tsx +++ b/morpheus-client/pages/imagine/help.tsx @@ -1,9 +1,25 @@ +import { useEffect } from "react"; import { NextPage } from "next"; + +import { CookiesStatus } from "../../utils/cookies"; import PrivateRoute from "../../components/Auth/PrivateRoute/PrivateRoute"; import FAQ from "../../components/FAQ/FAQ"; +import { useAnalytics } from "../../context/GoogleAnalyticsContext"; import styles from "../../styles/pages/Help.module.scss"; const Help: NextPage = () => { + const { cookiesStatus, sendAnalyticsRecord } = useAnalytics(); + + useEffect(() => { + if (cookiesStatus === CookiesStatus.Accepted) { + sendAnalyticsRecord("page_view", { + page_location: window.location.href, + page_title: document?.title, + page_name: "Help", + }); + } + }, [cookiesStatus, sendAnalyticsRecord]); + return (
diff --git a/morpheus-client/pages/imagine/img2img.tsx b/morpheus-client/pages/imagine/img2img.tsx index da5f90de..f8a8bc24 100644 --- a/morpheus-client/pages/imagine/img2img.tsx +++ b/morpheus-client/pages/imagine/img2img.tsx @@ -1,19 +1,29 @@ import { NextPage } from "next"; + +import { CookiesStatus } from "@/utils/cookies"; import ImageDraggable from "@/components/ImageDraggable/ImageDraggable"; import ImageGallery from "@/components/ImageGallery/ImageGallery"; import PrivateRoute from "@/components/Auth/PrivateRoute/PrivateRoute"; import ImagineInput from "@/components/ImagineInput/ImagineInput"; import { useDiffusion } from "@/context/SDContext"; import { useImagine } from "@/context/ImagineContext"; +import { useAnalytics } from "@/context/GoogleAnalyticsContext"; import styles from "@/styles/pages/StableDiffusion.module.scss"; const Img2Img: NextPage = () => { const { prompt } = useDiffusion(); + const { cookiesStatus, sendAnalyticsRecord } = useAnalytics(); const { img2imgFile, setImg2imgFile, generateImages } = useImagine(); const isFormValid = prompt.value.length > 0 && img2imgFile !== null; const handleGenerate = () => { generateImages("img2img"); + if (cookiesStatus === CookiesStatus.Accepted) { + sendAnalyticsRecord("generate_images", { + prompt: prompt.value, + model: "img2img", + }); + } }; return ( diff --git a/morpheus-client/pages/imagine/inpainting.tsx b/morpheus-client/pages/imagine/inpainting.tsx index bd02e7c3..29f1d2bb 100644 --- a/morpheus-client/pages/imagine/inpainting.tsx +++ b/morpheus-client/pages/imagine/inpainting.tsx @@ -1,4 +1,6 @@ import { NextPage } from "next"; + +import { CookiesStatus } from "@/utils/cookies"; import ImageDraggable from "@/components/ImageDraggable/ImageDraggable"; import ImageGallery from "@/components/ImageGallery/ImageGallery"; import { UploadMaskIcon } from "@/components/icons/uploadMask"; @@ -6,17 +8,25 @@ import ImagineInput from "@/components/ImagineInput/ImagineInput"; import PrivateRoute from "@/components/Auth/PrivateRoute/PrivateRoute"; import { useDiffusion } from "@/context/SDContext"; import { useImagine } from "@/context/ImagineContext"; +import { useAnalytics } from "@/context/GoogleAnalyticsContext"; import styles from "../../styles/pages/StableDiffusion.module.scss"; const Inpainting: NextPage = () => { const { prompt } = useDiffusion(); const { img2imgFile, setImg2imgFile, maskFile, setMaskFile, generateImages } = useImagine(); + const { cookiesStatus, sendAnalyticsRecord } = useAnalytics(); const isFormValid = prompt.value.length > 0 && img2imgFile !== null && maskFile !== null; const handleGenerate = async () => { generateImages("inpainting"); + if (cookiesStatus === CookiesStatus.Accepted) { + sendAnalyticsRecord("generate_images", { + prompt: prompt.value, + model: "inpainting", + }); + } }; return ( diff --git a/morpheus-client/pages/imagine/pix2pix.tsx b/morpheus-client/pages/imagine/pix2pix.tsx index f7a7d0ee..fc183102 100644 --- a/morpheus-client/pages/imagine/pix2pix.tsx +++ b/morpheus-client/pages/imagine/pix2pix.tsx @@ -1,19 +1,29 @@ import { NextPage } from "next"; + +import { CookiesStatus } from "../../utils/cookies"; import ImageGallery from "../../components/ImageGallery/ImageGallery"; import ImageDraggable from "../../components/ImageDraggable/ImageDraggable"; import ImagineInput from "../../components/ImagineInput/ImagineInput"; import PrivateRoute from "../../components/Auth/PrivateRoute/PrivateRoute"; import { useDiffusion } from "../../context/SDContext"; import { useImagine } from "../../context/ImagineContext"; +import { useAnalytics } from "../../context/GoogleAnalyticsContext"; import styles from "../../styles/pages/StableDiffusion.module.scss"; const Img2Img: NextPage = () => { const { prompt } = useDiffusion(); + const { cookiesStatus, sendAnalyticsRecord } = useAnalytics(); const { img2imgFile, setImg2imgFile, generateImages } = useImagine(); const isFormValid = prompt.value.length > 0 && img2imgFile !== null; const handleGenerate = async () => { generateImages("pix2pix"); + if (cookiesStatus === CookiesStatus.Accepted) { + sendAnalyticsRecord("generate_images", { + prompt: prompt.value, + model: "pix2pix", + }); + } }; return ( diff --git a/morpheus-client/pages/imagine/text2img.tsx b/morpheus-client/pages/imagine/text2img.tsx index a7db4587..3e329b10 100644 --- a/morpheus-client/pages/imagine/text2img.tsx +++ b/morpheus-client/pages/imagine/text2img.tsx @@ -1,18 +1,28 @@ import { NextPage } from "next"; + +import { CookiesStatus } from "../../utils/cookies"; import ImageGallery from "../../components/ImageGallery/ImageGallery"; import PrivateRoute from "../../components/Auth/PrivateRoute/PrivateRoute"; import ImagineInput from "../../components/ImagineInput/ImagineInput"; import { useDiffusion } from "../../context/SDContext"; import { useImagine } from "../../context/ImagineContext"; +import { useAnalytics } from "../../context/GoogleAnalyticsContext"; import styles from "../../styles/pages/StableDiffusion.module.scss"; const Text2img: NextPage = () => { const { prompt } = useDiffusion(); + const { cookiesStatus, sendAnalyticsRecord } = useAnalytics(); const { generateImages } = useImagine(); const isFormValid = prompt.value.length > 0; const handleGenerate = () => { generateImages("text2img"); + if (cookiesStatus === CookiesStatus.Accepted) { + sendAnalyticsRecord("generate_images", { + prompt: prompt.value, + model: "text2img", + }); + } }; return ( diff --git a/morpheus-client/pages/imagine/training.tsx b/morpheus-client/pages/imagine/training.tsx index da117e9f..0edbc48f 100644 --- a/morpheus-client/pages/imagine/training.tsx +++ b/morpheus-client/pages/imagine/training.tsx @@ -1,9 +1,25 @@ +import { useEffect } from "react"; import { NextPage } from "next"; + +import { CookiesStatus } from "../../utils/cookies"; +import { useAnalytics } from "../../context/GoogleAnalyticsContext"; import UnderConstruction from "../../components/UnderConstruction/UnderConstruction"; import PrivateRoute from "../../components/Auth/PrivateRoute/PrivateRoute"; import styles from "../../styles/pages/Training.module.scss"; const Training: NextPage = () => { + const { cookiesStatus, sendAnalyticsRecord } = useAnalytics(); + + useEffect(() => { + if (cookiesStatus === CookiesStatus.Accepted) { + sendAnalyticsRecord("page_view", { + page_location: window.location.href, + page_title: document?.title, + page_name: "Training", + }); + } + }, [cookiesStatus, sendAnalyticsRecord]); + return (
diff --git a/morpheus-client/pages/index.tsx b/morpheus-client/pages/index.tsx index 21a4a64f..1552039b 100644 --- a/morpheus-client/pages/index.tsx +++ b/morpheus-client/pages/index.tsx @@ -1,15 +1,18 @@ import { useEffect } from "react"; import { useRouter } from "next/router"; +import { CookiesStatus } from "@/utils/cookies"; import FullScreenLoader from "../components/Loaders/FullScreenLoader/Loader"; import { Auth } from "@/components/Auth/Auth"; import { isEmptyObject } from "@/utils/object"; import { useAuth } from "@/context/AuthContext"; +import { useAnalytics } from "@/context/GoogleAnalyticsContext"; import styles from "../styles/pages/Home.module.scss"; const Home = () => { const router = useRouter(); const { authLoading, user } = useAuth(); + const { cookiesStatus, sendAnalyticsRecord } = useAnalytics(); useEffect(() => { if (!isEmptyObject(user)) { @@ -17,6 +20,16 @@ const Home = () => { } }, [router, user]); + useEffect(() => { + if (cookiesStatus === CookiesStatus.Accepted) { + sendAnalyticsRecord("page_view", { + page_location: window.location.href, + page_title: document?.title, + page_name: "Home", + }); + } + }, [cookiesStatus, sendAnalyticsRecord]); + return authLoading ? ( ) : ( diff --git a/morpheus-client/pages/paint.tsx b/morpheus-client/pages/paint.tsx index 51995781..a200c1a4 100644 --- a/morpheus-client/pages/paint.tsx +++ b/morpheus-client/pages/paint.tsx @@ -1,8 +1,24 @@ +import { useEffect } from "react"; + +import { CookiesStatus } from "../utils/cookies"; import MainContainer from "../layout/MainContainer/MainContainer"; import Excalidraw from "../components/Excalidraw/Excalidraw"; +import { useAnalytics } from "../context/GoogleAnalyticsContext"; import styles from "../styles/pages/Paint.module.scss"; const Paint = () => { + const { cookiesStatus, sendAnalyticsRecord } = useAnalytics(); + + useEffect(() => { + if (cookiesStatus === CookiesStatus.Accepted) { + sendAnalyticsRecord("page_view", { + page_location: window.location.href, + page_title: document?.title, + page_name: "Paint", + }); + } + }, [cookiesStatus, sendAnalyticsRecord]); + return (
diff --git a/morpheus-client/utils/cookies.ts b/morpheus-client/utils/cookies.ts new file mode 100644 index 00000000..f0d7c95b --- /dev/null +++ b/morpheus-client/utils/cookies.ts @@ -0,0 +1,17 @@ +export enum CookiesStatus { + Accepted = "accepted", + Declined = "declined", +} + +const deleteAllCookies = () => { + const cookies = document.cookie.split(";"); + + for (let i = 0; i < cookies.length; i++) { + const cookie = cookies[i]; + const eqPos = cookie.indexOf("="); + const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; + document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; + } +}; + +export { deleteAllCookies }; diff --git a/morpheus-server/app/repository/files/s3_files_repository.py b/morpheus-server/app/repository/files/s3_files_repository.py index 49947f06..bb3c9239 100644 --- a/morpheus-server/app/repository/files/s3_files_repository.py +++ b/morpheus-server/app/repository/files/s3_files_repository.py @@ -85,7 +85,7 @@ def get_files(self, folder_name: str = settings.images_temp_bucket, max_keys: in try: params = {"Bucket": IMAGES_BUCKET, "Prefix": folder_name} if max_keys: - params.update(max_keys=max_keys) + params.update(MaxKeys=max_keys) response = self.s3.list_objects_v2(**params) images = [] diff --git a/morpheus-server/scripts/models/Dockerfile b/morpheus-server/scripts/models/Dockerfile index 69a2f72e..8d0f0e86 100644 --- a/morpheus-server/scripts/models/Dockerfile +++ b/morpheus-server/scripts/models/Dockerfile @@ -24,7 +24,6 @@ RUN dir -s # Install & use pipenv RUN pip install --upgrade pip pipenv -COPY Pipfile.lock . COPY requirements.txt . RUN pip install torch==1.13.1 && pip install -r requirements.txt COPY . .