diff --git a/src/components/Common/CodeBlock.tsx b/src/components/Common/CodeBlock.tsx index af1e363..8e660c6 100644 --- a/src/components/Common/CodeBlock.tsx +++ b/src/components/Common/CodeBlock.tsx @@ -42,10 +42,36 @@ export const CodeBlock: FC = ({ language, value }) => { return ( <> -
-
- {language} +
+
+
+ {language || "text"} +
+
+
+ + + + + + +
+
+ {/*
+ {language}
+
*/} + + {value} +
- - {value} -
{previewVisible && ( { return (
{/*
*/} -
-
-
- {props.isBot ? ( - !props.botAvatar ? ( -
- ) : ( - props.botAvatar - ) - ) : !props.userAvatar ? ( -
+
+
+
+ {props.isBot ? ( + !props.botAvatar ? ( +
) : ( - props.userAvatar - )} -
-
-
- - {props.isBot - ? props.name === "chrome::gemini-nano::page-assist" - ? "Gemini Nano" - : removeModelSuffix( - props.name?.replaceAll(/accounts\/[^\/]+\/models\//g, "") - ) - : "You"} - - - {props.isBot && - props.isSearchingInternet && - props.currentMessageIndex === props.totalMessages - 1 ? ( - - ) : null} -
- {props?.message_type && ( - - {t(`copilot.${props?.message_type}`)} - - )} -
-
- {!editMode ? ( - props.isBot ? ( - <> - {parseReasoning(props.message).map((e, i) => { - if (e.type === "reasoning") { - return ( - - - {t("reasoning.thinking")} - -
- ) : ( - t("reasoning.thought", { - time: humanizeMilliseconds( - props.reasoningTimeTaken - ) - }) - ), - children: - } - ]} - /> - ) - } - - return - })} - - ) : ( -

- {props.message} -

- ) - ) : ( - setEditMode(false)} - isBot={props.isBot} - /> - )} -
- {/* source if available */} - {props.images && - props.images.filter((img) => img.length > 0).length > 0 && ( -
- {props.images - .filter((image) => image.length > 0) - .map((image, index) => ( - Uploaded Image - ))} -
- )} - - {props.isBot && props?.sources && props?.sources.length > 0 && ( - - {t("citations")} -
- ), - children: ( -
- {props?.sources?.map((source, index) => ( - - ))} -
- ) - } - ]} - /> - )} - {!props.isProcessing && !editMode && ( -
- {props.isTTSEnabled && ( - - - - )} - {props.isBot && ( - <> - {!props.hideCopy && ( - - - - )} - - {props.generationInfo && ( - - } - title={t("generationInfo")}> - - - )} - - {!props.hideEditAndRegenerate && - props.currentMessageIndex === props.totalMessages - 1 && ( - - - - )} - - )} - {!props.hideEditAndRegenerate && ( - - - - )} -
+ props.botAvatar + ) + ) : !props.userAvatar ? ( +
+ ) : ( + props.userAvatar )}
+
+ + {props.isBot + ? props.name === "chrome::gemini-nano::page-assist" + ? "Gemini Nano" + : removeModelSuffix( + props.name?.replaceAll(/accounts\/[^\/]+\/models\//g, "") + ) + : "You"} + + + {props.isBot && + props.isSearchingInternet && + props.currentMessageIndex === props.totalMessages - 1 ? ( + + ) : null} +
+ {props?.message_type && ( + + {t(`copilot.${props?.message_type}`)} + + )} +
+
+ {!editMode ? ( + props.isBot ? ( + <> + {parseReasoning(props.message).map((e, i) => { + if (e.type === "reasoning") { + return ( + + + {t("reasoning.thinking")} + +
+ ) : ( + t("reasoning.thought", { + time: humanizeMilliseconds( + props.reasoningTimeTaken + ) + }) + ), + children: + } + ]} + /> + ) + } + + return + })} + + ) : ( +

+ {props.message} +

+ ) + ) : ( + setEditMode(false)} + isBot={props.isBot} + /> + )} +
+ {/* source if available */} + {props.images && + props.images.filter((img) => img.length > 0).length > 0 && ( +
+ {props.images + .filter((image) => image.length > 0) + .map((image, index) => ( + Uploaded Image + ))} +
+ )} + + {props.isBot && props?.sources && props?.sources.length > 0 && ( + + {t("citations")} +
+ ), + children: ( +
+ {props?.sources?.map((source, index) => ( + + ))} +
+ ) + } + ]} + /> + )} + {!props.isProcessing && !editMode ? ( +
+ {props.isTTSEnabled && ( + + + + )} + {props.isBot && ( + <> + {!props.hideCopy && ( + + + + )} + + {props.generationInfo && ( + + } + title={t("generationInfo")}> + + + )} + + {!props.hideEditAndRegenerate && + props.currentMessageIndex === props.totalMessages - 1 && ( + + + + )} + + )} + {!props.hideEditAndRegenerate && ( + + + + )} +
+ ) : ( + // add invisible div to prevent layout shift +
+
+
+ )} +
+
{/*
*/}
) diff --git a/src/components/Layouts/Header.tsx b/src/components/Layouts/Header.tsx index f65946e..e4e2567 100644 --- a/src/components/Layouts/Header.tsx +++ b/src/components/Layouts/Header.tsx @@ -89,10 +89,9 @@ export const Header: React.FC = ({ } } - return (
@@ -210,12 +209,6 @@ export const Header: React.FC = ({
- {/* {pathname === "/" && - messages.length > 0 && - !streaming && - shareModeEnabled && ( - - )} */} {messages.length > 0 && !streaming && ( = ({ -
+
diff --git a/src/components/Layouts/Layout.tsx b/src/components/Layouts/Layout.tsx index 622ed6c..07aef22 100644 --- a/src/components/Layouts/Layout.tsx +++ b/src/components/Layouts/Layout.tsx @@ -39,13 +39,16 @@ export default function OptionLayout({
+
+
+
{/*
*/} - {children} + {children} {/*
*/} = ({ clearChat }) => {
) -} \ No newline at end of file +} diff --git a/src/components/Option/Playground/Playground.tsx b/src/components/Option/Playground/Playground.tsx index 371b9b5..c8251fa 100644 --- a/src/components/Option/Playground/Playground.tsx +++ b/src/components/Option/Playground/Playground.tsx @@ -145,7 +145,7 @@ export const Playground = () => {
diff --git a/src/components/Option/Playground/PlaygroundForm.tsx b/src/components/Option/Playground/PlaygroundForm.tsx index e95e766..245fd67 100644 --- a/src/components/Option/Playground/PlaygroundForm.tsx +++ b/src/components/Option/Playground/PlaygroundForm.tsx @@ -205,39 +205,35 @@ export const PlaygroundForm = ({ dropedFile }: Props) => { } return ( -
+
-
- Uploaded Image - -
+ {" "} + Uploaded Image
+ className={`flex bg-transparent `}> { stopListening() @@ -456,256 +452,4 @@ export const PlaygroundForm = ({ dropedFile }: Props) => {
) - return ( -
-
-
-
-
-
- Uploaded Image - -
-
-
-
-
{ - stopListening() - if (!selectedModel || selectedModel.length === 0) { - form.setFieldError("message", t("formError.noModel")) - return - } - if (webSearch) { - const defaultEM = await defaultEmbeddingModelForRag() - if (!defaultEM) { - form.setFieldError( - "message", - t("formError.noEmbeddingModel") - ) - return - } - } - if ( - value.message.trim().length === 0 && - value.image.length === 0 - ) { - return - } - form.reset() - textAreaFocus() - await sendMessage({ - image: value.image, - message: value.message.trim() - }) - })} - className="shrink-0 flex-grow flex flex-col items-center "> - -
-