Skip to content
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
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"editor.defaultFormatter": "biomejs.biome"
},
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.workingDirectories": [{ "pattern": "app/*" }, { "pattern": "packages/*" }],
"eslint.workingDirectories": [
{ "pattern": "app/*" },
{ "pattern": "packages/*" }
],
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
// "source.organizeImports": "explicit"
Expand Down
24 changes: 15 additions & 9 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Geist, Geist_Mono } from 'next/font/google';
import { ThemeProvider } from '@/components/theme-provider';
import { SpeedInsights } from '@vercel/speed-insights/next';
import { Analytics } from '@vercel/analytics/next';
import '@ant-design/v5-patch-for-react-19';
import { AntdRegistry } from '@ant-design/nextjs-registry';

import './globals.css';
import { SessionProvider } from 'next-auth/react';
Expand Down Expand Up @@ -75,15 +77,19 @@ export default async function RootLayout({
<body className="antialiased">
<SpeedInsights />
<Analytics />
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
<Toaster position="top-center" />
<SessionProvider>{children}</SessionProvider>
</ThemeProvider>
<SessionProvider>
<AntdRegistry>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
<Toaster position="top-center" />
{children}
</ThemeProvider>
</AntdRegistry>
</SessionProvider>
</body>
</html>
);
Expand Down
11 changes: 11 additions & 0 deletions components/chat-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import {
DropdownMenuTrigger,
} from './ui/dropdown-menu';

import { Button as AntdButton, message } from 'antd';

function PureChatHeader({
chatId,
selectedModelId,
Expand All @@ -46,6 +48,8 @@ function PureChatHeader({

const { width: windowWidth } = useWindowSize();

const [messageApi, contextHolder] = message.useMessage();

return (
<header className="flex sticky top-0 bg-background py-1.5 items-center px-2 md:px-2 gap-2">
<SidebarToggle />
Expand Down Expand Up @@ -116,7 +120,14 @@ function PureChatHeader({
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
{contextHolder}
</div>
<AntdButton
className="order-4 md:order-5"
onClick={() => messageApi.info('info')}
>
测试 antd
</AntdButton>
</header>
);
}
Expand Down
2 changes: 1 addition & 1 deletion components/sidebar-history.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export function SidebarHistory({ user }: { user: User | undefined }) {

{hasReachedEnd ? (
<div className="px-2 text-zinc-500 w-full flex flex-row justify-center items-center text-sm gap-2 mt-8">
您已经到达对话历史的末尾
您已经到达对话历史的末尾
</div>
) : (
<div className="p-2 text-zinc-500 dark:text-zinc-400 flex flex-row gap-2 items-center mt-8">
Expand Down
30 changes: 28 additions & 2 deletions components/theme-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
'use client';

import { ThemeProvider as NextThemesProvider } from 'next-themes';
import { ThemeProvider as NextThemesProvider, useTheme } from 'next-themes';
import type { ThemeProviderProps } from 'next-themes/dist/types';
import { ConfigProvider as AntdConfigProvider, theme as antdTheme } from 'antd';
import zhCN from 'antd/locale/zh_CN';

// 单独的 Antd 主题提供者组件,用于处理 Antd 的主题
function AntdThemeProvider({ children }: { children: React.ReactNode }) {
const { resolvedTheme } = useTheme();

return (
<AntdConfigProvider
locale={zhCN}
theme={{
algorithm:
resolvedTheme === 'dark'
? antdTheme.darkAlgorithm
: antdTheme.defaultAlgorithm,
cssVar: true,
}}
>
{children}
</AntdConfigProvider>
);
}

export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
return (
<NextThemesProvider {...props}>
<AntdThemeProvider>{children}</AntdThemeProvider>
</NextThemesProvider>
);
}
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@
"db:pull": "drizzle-kit pull",
"db:check": "drizzle-kit check",
"db:up": "drizzle-kit up",
"test": "export PLAYWRIGHT=True && pnpm exec playwright test"
"test": "export PLAYWRIGHT=True && pnpm exec playwright test",
"preinstall": "npx only-allow pnpm"
},
"dependencies": {
"@ai-sdk/deepseek": "^0.2.14",
"@ai-sdk/react": "^1.2.11",
"@ai-sdk/xai": "^1.2.15",
"@ant-design/icons": "5.x",
"@ant-design/nextjs-registry": "^1.0.2",
"@ant-design/v5-patch-for-react-19": "^1.0.3",
"@codemirror/lang-javascript": "^6.2.2",
"@codemirror/lang-python": "^6.1.6",
"@codemirror/state": "^6.5.0",
Expand All @@ -46,6 +50,7 @@
"@vercel/postgres": "^0.10.0",
"@vercel/speed-insights": "^1.2.0",
"ai": "4.3.13",
"antd": "^5.26.3",
"bcrypt-ts": "^5.0.2",
"class-variance-authority": "^0.7.0",
"classnames": "^2.5.1",
Expand All @@ -58,6 +63,7 @@
"fast-deep-equal": "^3.1.3",
"framer-motion": "^11.3.19",
"geist": "^1.3.1",
"install": "^0.13.0",
"lucide-react": "^0.446.0",
"nanoid": "^5.0.8",
"next": "15.3.0-canary.31",
Expand Down Expand Up @@ -112,5 +118,9 @@
"tsx": "^4.19.1",
"typescript": "^5.6.3"
},
"engines": {
"node": "22.x",
"pnpm": "9.x"
},
"packageManager": "pnpm@9.12.3"
}
Loading