diff --git a/bun.lockb b/bun.lockb index 78e15b1c3..405f64aff 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 021970136..4a71a4515 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ }, "dependencies": { "@ant-design/cssinjs": "^1.18.4", + "@ctrl/tinycolor": "^4.2.0", "@headlessui/react": "^1.7.18", "@heroicons/react": "^2.1.1", "@langchain/community": "^0.0.41", diff --git a/src/assets/backgrounds/blob-scene.svg b/src/assets/backgrounds/blob-scene.svg new file mode 100644 index 000000000..6b4cc2ff4 --- /dev/null +++ b/src/assets/backgrounds/blob-scene.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/backgrounds/blurry-gradient.svg b/src/assets/backgrounds/blurry-gradient.svg new file mode 100644 index 000000000..becb2cc73 --- /dev/null +++ b/src/assets/backgrounds/blurry-gradient.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/backgrounds/layered-waves.svg b/src/assets/backgrounds/layered-waves.svg new file mode 100644 index 000000000..6e0b6bc0a --- /dev/null +++ b/src/assets/backgrounds/layered-waves.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/backgrounds/plain.svg b/src/assets/backgrounds/plain.svg new file mode 100644 index 000000000..16a8cf0d5 --- /dev/null +++ b/src/assets/backgrounds/plain.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/Common/Playground/DocumentChip.tsx b/src/components/Common/Playground/DocumentChip.tsx index 043b698ca..7a198adc6 100644 --- a/src/components/Common/Playground/DocumentChip.tsx +++ b/src/components/Common/Playground/DocumentChip.tsx @@ -15,7 +15,7 @@ export const DocumentChip: React.FC = ({ document }) => { href={document.url} target="_blank" rel="noreferrer" - className="inline-flex items-center gap-2 bg-surface-50 dark:bg-[#242424] border border-neutral-200 dark:border-[#2a2a2a] rounded-2xl px-3 py-1.5 mr-2 mb-2"> + className="inline-flex items-center gap-2 bg-surface-50 dark:bg-surface-900 border border-neutral-200 dark:border-[#2a2a2a] rounded-2xl px-3 py-1.5 mr-2 mb-2">
{document.favIconUrl ? ( diff --git a/src/components/Common/Playground/Message.tsx b/src/components/Common/Playground/Message.tsx index 891ca7c76..0f714e3cc 100644 --- a/src/components/Common/Playground/Message.tsx +++ b/src/components/Common/Playground/Message.tsx @@ -351,7 +351,7 @@ export const PlaygroundMessage = (props: Props) => { }) } }} - className="flex items-center justify-center w-6 h-6 rounded-full bg-surface-100 dark:bg-[#242424] border border-gray-300 dark:border-none hover:bg-surface-200 dark:hover:bg-surface-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"> + className="flex items-center justify-center w-6 h-6 rounded-full bg-surface-100 dark:bg-surface-900 border border-gray-300 dark:border-none hover:bg-surface-200 dark:hover:bg-surface-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"> {!isSpeaking ? ( ) : ( @@ -376,7 +376,7 @@ export const PlaygroundMessage = (props: Props) => { setIsBtnPressed(false) }, 2000) }} - className="flex items-center justify-center w-6 h-6 rounded-full bg-surface-100 dark:bg-[#242424] border border-gray-300 dark:border-none hover:bg-surface-200 dark:hover:bg-surface-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"> + className="flex items-center justify-center w-6 h-6 rounded-full bg-surface-100 dark:bg-surface-900 border border-gray-300 dark:border-none hover:bg-surface-200 dark:hover:bg-surface-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"> {!isBtnPressed ? ( ) : ( @@ -395,7 +395,7 @@ export const PlaygroundMessage = (props: Props) => { title={t("generationInfo")}> @@ -406,7 +406,7 @@ export const PlaygroundMessage = (props: Props) => { @@ -417,7 +417,7 @@ export const PlaygroundMessage = (props: Props) => { @@ -428,7 +428,7 @@ export const PlaygroundMessage = (props: Props) => { @@ -440,7 +440,7 @@ export const PlaygroundMessage = (props: Props) => { @@ -449,7 +449,7 @@ export const PlaygroundMessage = (props: Props) => { ) : ( // add invisible div to prevent layout shift
-
+
)}
diff --git a/src/components/Common/Playground/PlaygroundUserMessage.tsx b/src/components/Common/Playground/PlaygroundUserMessage.tsx index 4192217b7..143760154 100644 --- a/src/components/Common/Playground/PlaygroundUserMessage.tsx +++ b/src/components/Common/Playground/PlaygroundUserMessage.tsx @@ -96,7 +96,7 @@ export const PlaygroundUserMessageBubble: React.FC = (props) => {
@@ -161,7 +161,7 @@ export const PlaygroundUserMessageBubble: React.FC = (props) => { }) } }} - className="flex items-center justify-center w-6 h-6 rounded-full bg-surface-100 dark:bg-[#242424] hover:bg-surface-200 dark:hover:bg-surface-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"> + className="flex items-center justify-center w-6 h-6 rounded-full bg-surface-100 dark:bg-surface-900 hover:bg-surface-200 dark:hover:bg-surface-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"> {!isSpeaking ? ( ) : ( @@ -181,7 +181,7 @@ export const PlaygroundUserMessageBubble: React.FC = (props) => { setIsBtnPressed(false) }, 2000) }} - className="flex items-center justify-center w-6 h-6 rounded-full bg-surface-50 dark:bg-[#242424] hover:bg-surface-200 dark:hover:bg-surface-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"> + className="flex items-center justify-center w-6 h-6 rounded-full bg-surface-50 dark:bg-surface-900 hover:bg-surface-200 dark:hover:bg-surface-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"> {!isBtnPressed ? ( ) : ( @@ -196,7 +196,7 @@ export const PlaygroundUserMessageBubble: React.FC = (props) => { @@ -205,7 +205,7 @@ export const PlaygroundUserMessageBubble: React.FC = (props) => { ) : ( // add invisible div to prevent layout shift
-
+
)}
diff --git a/src/components/Option/Playground/Playground.tsx b/src/components/Option/Playground/Playground.tsx index de5eb55bf..19dd558e0 100644 --- a/src/components/Option/Playground/Playground.tsx +++ b/src/components/Option/Playground/Playground.tsx @@ -1,4 +1,4 @@ -import React from "react" +import React, { useState } from "react" import { PlaygroundForm } from "./PlaygroundForm" import { PlaygroundChat } from "./PlaygroundChat" import { useMessageOption } from "@/hooks/useMessageOption" @@ -15,6 +15,9 @@ import { ChevronDown } from "lucide-react" import { useStorage } from "@plasmohq/storage/hook" import { Storage } from "@plasmohq/storage" import { otherUnsupportedTypes } from "../Knowledge/utils/unsupported-types" +import { useTheme } from "@/hooks/useTheme" + + export const Playground = () => { const drop = React.useRef(null) const [dropedFile, setDropedFile] = React.useState() @@ -25,6 +28,8 @@ export const Playground = () => { }) }) + const { themeName, getThemedSVGUri } = useTheme(); + const { selectedKnowledge, messages, @@ -38,10 +43,20 @@ export const Playground = () => { const { containerRef, isAutoScrollToBottom, autoScrollToBottom } = useSmartScroll(messages, streaming, 120) + const [backgroundImage, setBackgroundImage] = useState(null); + const [dropState, setDropState] = React.useState< "idle" | "dragging" | "error" >("idle") + React.useEffect(() => { + async function loadBackground() { + setBackgroundImage(getThemedSVGUri()); + } + loadBackground(); + }, [themeName]); + + React.useEffect(() => { if (selectedKnowledge) { return @@ -162,6 +177,12 @@ export const Playground = () => {
diff --git a/src/components/Option/Playground/PlaygroundForm.tsx b/src/components/Option/Playground/PlaygroundForm.tsx index 242d57fdd..a6dca8bba 100644 --- a/src/components/Option/Playground/PlaygroundForm.tsx +++ b/src/components/Option/Playground/PlaygroundForm.tsx @@ -348,7 +348,7 @@ export const PlaygroundForm = ({ dropedFile }: Props) => {
+ className={`relative w-full max-w-[48rem] p-1 border rounded-t-xl backdrop-blur-lg bg-white/30 dark:bg-gray-800/30 border-gray-300 dark:border-[#404040] duration-100 data-[istemporary-chat='true']:bg-white/50 data-[istemporary-chat='true']:dark:bg-gray-900/50 data-[checkwidemode='true']:max-w-none`}>
+ Background: + + +
+ ) +} diff --git a/src/components/Option/Settings/general-settings.tsx b/src/components/Option/Settings/general-settings.tsx index 5cf4bdaca..9856ee8dd 100644 --- a/src/components/Option/Settings/general-settings.tsx +++ b/src/components/Option/Settings/general-settings.tsx @@ -11,6 +11,7 @@ import { SSTSettings } from "./sst-settings" import { BetaTag } from "@/components/Common/Beta" import { getDefaultOcrLanguage, ocrLanguages } from "@/data/ocr-language" import { ThemeSwitcher } from "./theme-switcher" +import { BackgroundSwitcher } from "./background-switcher" export const GeneralSettings = () => { const [userChatBubble, setUserChatBubble] = useStorage("userChatBubble", true) @@ -373,9 +374,10 @@ export const GeneralSettings = () => {
+