Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add petercat assistant #375

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
xingwanying marked this conversation as resolved.
Show resolved Hide resolved
apiDomain="https://api.petercat.ai"
/>
);
};
xingwanying marked this conversation as resolved.
Show resolved Hide resolved

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
Loading