diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..388525b --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,24 @@ +# Use the official Nginx image based on Alpine +FROM nginx:alpine + +WORKDIR /app + +# Copy the contents of the dist directory to the Nginx html directory +COPY dist/ /default-app/ + +# 删除默认的defult.conf +RUN rm /etc/nginx/conf.d/default.conf + +COPY default.conf /etc/nginx/conf.d/default.conf + +COPY app-init.sh /app-init.sh +RUN chmod +x /app-init.sh + +# Expose port 80 +EXPOSE 80 + +# 使用启动脚本作为 ENTRYPOINT +ENTRYPOINT ["/app-init.sh"] + +# Start Nginx +# CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/docker/app-init.sh b/docker/app-init.sh new file mode 100644 index 0000000..4332494 --- /dev/null +++ b/docker/app-init.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# 宿主机挂载路径 +TARGET_DIR="/app" + +# 检查目录是否为空 +if [ -z "$(ls -A $TARGET_DIR)" ]; then + echo "Directory is empty. Copying default content..." + cp -r /default-app/* $TARGET_DIR/ +else + echo "Directory is not empty. Skipping copy." +fi + +# 启动应用或保持容器运行 +# exec "$@" + +nginx -g "daemon off;" \ No newline at end of file diff --git a/docker/default.conf b/docker/default.conf new file mode 100644 index 0000000..ed15748 --- /dev/null +++ b/docker/default.conf @@ -0,0 +1,9 @@ + +server { + listen 80; + listen [::]:80; + root /app; + location / { + try_files $uri $uri/ /index.html; + } +} \ No newline at end of file diff --git a/src/globals.css b/src/globals.css index 8e73f15..a7b1696 100644 --- a/src/globals.css +++ b/src/globals.css @@ -54,6 +54,7 @@ @layer utilities { .layout-menu { @apply bg-gray-900 p-2 text-white flex justify-between h-12; + -webkit-app-region: drag; } .bg-custom-blue { background-color: #3490dc; diff --git a/src/modules/layout/index.tsx b/src/modules/layout/index.tsx index b1a9312..ff2aa0e 100644 --- a/src/modules/layout/index.tsx +++ b/src/modules/layout/index.tsx @@ -1,4 +1,4 @@ -import { AiMoudle } from '@/pages/ai-chat'; +import { AiMoudle, useAiStore } from '@/pages/ai-chat'; import { MenuOutlined, SwapOutlined } from '@ant-design/icons'; import { Button, Tooltip } from 'antd'; import { Outlet } from 'react-router-dom'; @@ -8,6 +8,8 @@ import { useShallow } from 'zustand/react/shallow'; import { useEffect } from 'react'; import { LayoutUser } from './LayoutUser'; import PandaPNG from '@/assets/panda.png'; +import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels'; +import clsx from 'clsx'; type LayoutMainProps = { title?: React.ReactNode; @@ -26,6 +28,11 @@ export const LayoutMain = (props: LayoutMainProps) => { }; }), ); + const aiStore = useAiStore( + useShallow((state) => { + return { open: state.open }; + }), + ); useEffect(() => { menuStore.getMe(); }, []); @@ -71,12 +78,22 @@ export const LayoutMain = (props: LayoutMainProps) => { style={{ height: 'calc(100vh - 3rem)', }}> -