temp: 暂存更新

This commit is contained in:
xion 2024-10-14 00:46:54 +08:00
parent ab6c4340f5
commit c0359c7998
7 changed files with 96 additions and 10 deletions

24
docker/Dockerfile Normal file
View File

@ -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;"]

17
docker/app-init.sh Normal file
View File

@ -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;"

9
docker/default.conf Normal file
View File

@ -0,0 +1,9 @@
server {
listen 80;
listen [::]:80;
root /app;
location / {
try_files $uri $uri/ /index.html;
}
}

View File

@ -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;

View File

@ -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,13 +78,23 @@ export const LayoutMain = (props: LayoutMainProps) => {
style={{
height: 'calc(100vh - 3rem)',
}}>
<div className='flex-grow overflow-hidden'>
<PanelGroup className='w-full h-full panel-layout' autoSaveId='editor-layout-main' direction='horizontal'>
<Panel style={{ height: '100%' }}>
<div className='h-full overflow-hidden'>
<div className='w-full h-full rounded-lg'>
<Outlet />
</div>
</div>
</Panel>
<PanelResizeHandle />
<Panel style={{ height: '100%' }} defaultSize={25} className={clsx(!aiStore.open && 'hidden')}>
<div className='w-full h-full'>
<AiMoudle />
</div>
</Panel>
</PanelGroup>
</div>
<LayoutUser />
</div>
);

View File

@ -343,7 +343,7 @@ export const AiMoudle = () => {
};
});
return (
<div className={clsx('w-[600px] flex-shrink-0 bg-gray-100 border-l-2 shadow-lg flex flex-col', !aiStore?.open && 'hidden')}>
<div className={clsx('w-full h-full flex-shrink-0 bg-gray-100 border-l-2 shadow-lg flex flex-col', !aiStore?.open && 'hidden')}>
<div className='flex justify-between p-2 border bg-white'>
<div className='flex gap-4'>
<Button className='position ml-4 ' onClick={() => aiStore.setOpen(false)} icon={<CloseOutlined />}></Button>

View File

@ -1,11 +1,21 @@
import { Button, Input, message, Modal, Table } from 'antd';
import { Button, Input, message, Modal, Table, Tooltip } from 'antd';
import { Fragment, useEffect, useMemo, useState } from 'react';
import { usePromptStore } from '../store/prompt';
import { useShallow } from 'zustand/react/shallow';
import { Form } from 'antd';
import copy from 'copy-to-clipboard';
import { useNewNavigate } from '@/modules';
import { EditOutlined, SettingOutlined, LinkOutlined, SaveOutlined, DeleteOutlined, LeftOutlined, CaretRightOutlined, PlusOutlined } from '@ant-design/icons';
import {
EditOutlined,
SettingOutlined,
LinkOutlined,
SaveOutlined,
DeleteOutlined,
LeftOutlined,
CaretRightOutlined,
PlusOutlined,
ExportOutlined,
} from '@ant-design/icons';
import clsx from 'clsx';
import { TextArea } from '@/pages/container/components/TextArea';
@ -256,6 +266,14 @@ export const List = () => {
message.error('Not implemented');
}}
/>
<Tooltip title='Export Config'>
<Button
icon={<ExportOutlined />}
onClick={() => {
message.error('Not implemented');
}}
/>
</Tooltip>
</Button.Group>
</div>
</div>