diff --git a/src/components/OllamaSetupGuide/index.tsx b/src/components/OllamaSetupGuide/index.tsx index c2a9be61d6..b139f705de 100644 --- a/src/components/OllamaSetupGuide/index.tsx +++ b/src/components/OllamaSetupGuide/index.tsx @@ -28,7 +28,17 @@ const styles = createStaticStyles(({ css, cssVar }) => ({ })); const SetupGuide = memo(() => { - const iconColor = useMemo(() => readableColor(cssVar.colorPrimary), []); + const iconColor = useMemo(() => { + if (typeof window === 'undefined') return '#fff'; + + const variableExpression = cssVar.colorPrimary; + const variableName = variableExpression.match(/var\((--[^),\s]+)/)?.[1]; + const computedColor = variableName + ? getComputedStyle(document.documentElement).getPropertyValue(variableName).trim() + : variableExpression; + + return readableColor(computedColor || '#1677ff'); + }, []); const { t } = useTranslation('components'); return ( <> @@ -51,7 +61,12 @@ const SetupGuide = memo(() => { ns={'components'} components={[ , - , + , ]} /> ), @@ -66,7 +81,7 @@ const SetupGuide = memo(() => { {t('OllamaSetupGuide.cors.macos')} - { } + {} launchctl setenv OLLAMA_ORIGINS "*" {t('OllamaSetupGuide.cors.reboot')} @@ -97,7 +112,12 @@ const SetupGuide = memo(() => { ns={'components'} components={[ , - , + , ]} /> ), @@ -162,11 +182,10 @@ const SetupGuide = memo(() => {
{t('OllamaSetupGuide.cors.description')}
{t('OllamaSetupGuide.cors.linux.systemd')}
- { } + {} sudo systemctl edit ollama.service {t('OllamaSetupGuide.cors.linux.env')} - { } + {} docker run -d --gpus=all -v ollama:/root/.ollama -e OLLAMA_ORIGINS="*" -p 11434:11434 --name ollama ollama/ollama @@ -232,6 +251,9 @@ Environment="OLLAMA_ORIGINS=*"`} label: 'Docker', }, ]} + style={{ + width: '500px', + }} /> ); diff --git a/src/components/mdx/CodeBlock.tsx b/src/components/mdx/CodeBlock.tsx index 1070b52683..6703d4762f 100644 --- a/src/components/mdx/CodeBlock.tsx +++ b/src/components/mdx/CodeBlock.tsx @@ -1,5 +1,6 @@ 'use client'; +import { Mermaid } from '@lobehub/ui'; import { Pre, PreSingleLine } from '@lobehub/ui/mdx'; import { type FC, type PropsWithChildren } from 'react'; @@ -35,7 +36,9 @@ const CodeBlock: FC = ({ children }) => { if (!code) return; if (code.isSingleLine) return {code.content}; - + if (code.lang === 'mermaid') { + return {code.content}; + } return (
       {code.content}
diff --git a/src/features/ModelSwitchPanel/components/Toolbar.tsx b/src/features/ModelSwitchPanel/components/Toolbar.tsx
index e8574bcd75..92dc27f8cb 100644
--- a/src/features/ModelSwitchPanel/components/Toolbar.tsx
+++ b/src/features/ModelSwitchPanel/components/Toolbar.tsx
@@ -1,4 +1,4 @@
-import { Flexbox, Icon, SearchBar, Segmented } from '@lobehub/ui';
+import { Flexbox, Icon, SearchBar, Segmented, stopPropagation } from '@lobehub/ui';
 import { ProviderIcon } from '@lobehub/ui/icons';
 import { Brain } from 'lucide-react';
 import { memo } from 'react';
@@ -35,6 +35,7 @@ export const Toolbar = memo(
           value={searchKeyword}
           variant="borderless"
           onChange={(e) => onSearchKeywordChange(e.target.value)}
+          onKeyDown={stopPropagation}
         />
         (
           {children}
           
             
-              
+