Skip to content

Commit

Permalink
feat: add petercat assistant (#375)
Browse files Browse the repository at this point in the history
* feat: add petercat assistant

* chore: fix ci
  • Loading branch information
xingwanying authored Dec 19, 2024
1 parent 4e5e828 commit a4f5fa6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .dumi/theme/common/PeterCat.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Assistant } from '@petercatai/assistant';
import React from 'react';
import '@petercatai/assistant/style';

const PeterCat: React.FC = () => {
return (
<Assistant
showBubble={true}
isVisible={false}
bottom={48}
token="e3092c32-9ed9-44c2-ad0c-7251e382c2df"
apiDomain="https://api.petercat.ai"
/>
);
};

export default PeterCat;
1 change: 1 addition & 0 deletions .dumi/theme/common/ThemeSwitch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const ThemeSwitch: React.FC<ThemeSwitchProps> = (props) => {
icon={<ThemeIcon />}
aria-label="Theme Switcher"
badge={{ dot: true }}
style={{ bottom: 120 }}
>
<Link
to={getLocalizedPathname('/theme-editor', isZhCN(pathname), search)}
Expand Down
4 changes: 4 additions & 0 deletions .dumi/theme/layouts/GlobalLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ import { DarkContext } from '../../hooks/useDark';
import useLayoutState from '../../hooks/useLayoutState';
import useLocation from '../../hooks/useLocation';
import SiteThemeProvider from '../SiteThemeProvider';
import PeterCat from '../common/PeterCat';
import type { ThemeName } from '../common/ThemeSwitch';
import type { SiteContextProps } from '../slots/SiteContext';
import SiteContext from '../slots/SiteContext';

import '@petercatai/assistant/style';

const ThemeSwitch = React.lazy(() => import('../common/ThemeSwitch'));

type Entries<T> = { [K in keyof T]: [K, T[K]] }[keyof T][];
Expand Down Expand Up @@ -203,6 +206,7 @@ const GlobalLayout: React.FC = () => {
value={theme}
onChange={(nextTheme) => updateSiteConfig({ theme: nextTheme })}
/>
<PeterCat />
</Suspense>
</App>
);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
},
"devDependencies": {
"@ant-design/tools": "^18.0.2",
"@petercatai/assistant": "^2.0.2",
"@antv/gpt-vis": "^0.3.0",
"@biomejs/biome": "^1.9.0",
"@codecov/webpack-plugin": "^1.4.0",
Expand Down

0 comments on commit a4f5fa6

Please sign in to comment.