refactor: update grid component props and optimize docker setup

This commit is contained in:
2025-10-20 10:34:38 +08:00
parent 3f85b0ff78
commit 91eaa37283
14 changed files with 232 additions and 62 deletions

98
.dockerignore Normal file
View File

@@ -0,0 +1,98 @@
node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Git
.git
.gitignore
# Docker
Dockerfile*
docker-compose*
.dockerignore
# Environment files (keep only production)
.env
.env.local
.env.development.local
.env.test.local
# Logs
logs
*.log
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Dependency directories
jspm_packages/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
# Storybook build outputs
.out
.storybook-out
# Temporary folders
tmp/
temp/
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Stores VSCode versions used for testing VSCode extensions
.vscode-test

6
.env.production Normal file
View File

@@ -0,0 +1,6 @@
# VITE_API_BASE_URL = http://150.158.121.95
VITE_API_BASE_URL = http://154.9.253.114:9380
VITE_RSA_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArq9XTUSeYr2+N1h3Afl/z8Dse/2yD0ZGrKwx+EEEcdsBLca9Ynmx3nIB5obmLlSfmskLpBo0UACBmB5rEjBp2Q2f3AG3Hjd4B+gNCG6BDaawuDlgANIhGnaTLrIqWrrcm4EMzJOnAOI1fgzJRsOOUEfaS318Eq9OVO3apEyCCt0lOQK6PuksduOjVxtltDav+guVAA068NrPYmRNabVKRNLJpL8w4D44sfth5RvZ3q9t+6RTArpEtc5sh5ChzvqPOzKGMXW83C95TxmXqpbK6olN4RevSfVjEAgCydH6HN6OhtOQEcnrU97r9H0iZOWwbw3pVrZiUkuRD1R56Wzs2wIDAQAB
-----END PUBLIC KEY-----"

View File

@@ -1,12 +1,60 @@
FROM node:20-alpine
# 多阶段构建 - 构建阶段
FROM node:20-alpine AS builder
WORKDIR /app
# 复制包管理文件
COPY package.json pnpm-lock.yaml ./
# 安装 pnpm 和依赖
RUN npm install -g pnpm && pnpm install
# 复制源代码
COPY . .
# 构建生产版本
RUN pnpm build
# 生产阶段 - nginx
FROM nginx:alpine AS production
# 复制自定义 nginx 配置
COPY <<EOF /etc/nginx/conf.d/default.conf
server {
listen 5173;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# 处理 SPA 路由
location / {
try_files \$uri \$uri/ /index.html;
}
# 静态资源缓存
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# 安全头
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
# Gzip 压缩
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json;
}
EOF
# 从构建阶段复制构建产物
COPY --from=builder /app/dist /usr/share/nginx/html
# 暴露端口
EXPOSE 5173
CMD ["pnpm", "dev"]
# 启动 nginx
CMD ["nginx", "-g", "daemon off;"]

28
docker-compose.yml Normal file
View File

@@ -0,0 +1,28 @@
version: '3.8'
services:
teres-frontend:
build:
context: .
dockerfile: Dockerfile
target: production
ports:
- "3000:80"
environment:
- NODE_ENV=production
restart: unless-stopped
# 开发环境服务(可选)
teres-frontend-dev:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "5173:5173"
volumes:
- .:/app
- /app/node_modules
environment:
- NODE_ENV=development
profiles:
- dev

View File

@@ -1,3 +1,7 @@
// import type { AgentCategory } from '@/constants/agent';
import type { Edge, Node } from '@xyflow/react';
import type { IReference, Message } from './chat';
export interface ICategorizeItem {
name: string;
description?: string;
@@ -30,11 +34,6 @@ export interface ISwitchForm {
no: string;
}
import type { AgentCategory } from '@/constants/agent';
import type { Edge, Node } from '@xyflow/react';
import type { IReference, Message } from './chat';
export type DSLComponents = Record<string, IOperator>;
export interface DSL {
@@ -157,7 +156,7 @@ export interface IAgentForm {
delay_after_error: number;
visual_files_var: string;
max_rounds: number;
exception_method: Nullable<'comment' | 'go'>;
// exception_method: Nullable<'comment' | 'go'>;
exception_comment: any;
exception_goto: any;
tools: Array<{
@@ -275,5 +274,5 @@ export interface IPipeLineListRequest {
keywords?: string;
orderby?: string;
desc?: boolean;
canvas_category?: AgentCategory;
// canvas_category?: AgentCategory;
}

View File

@@ -1,4 +1,4 @@
import { MessageType } from '@/constants/chat';
// import { MessageType } from '@/constants/chat';
export interface PromptConfig {
empty_response: string;
@@ -89,7 +89,7 @@ export interface IConversation {
export interface Message {
content: string;
role: MessageType;
// role: MessageType;
doc_ids?: string[];
prompt?: string;
id?: string;

View File

@@ -1,4 +1,4 @@
import { Edge, Node } from '@xyflow/react';
import type { Edge, Node } from '@xyflow/react';
import type { IReference, Message } from './chat';
export type DSLComponents = Record<string, IOperator>;

View File

@@ -1,7 +1,7 @@
export enum McpServerType {
Sse = 'sse',
StreamableHttp = 'streamable-http',
}
// export enum McpServerType {
// Sse = 'sse',
// StreamableHttp = 'streamable-http',
// }
export interface IMcpServerVariable {
key: string;
@@ -12,7 +12,7 @@ export interface IMcpServerInfo {
id: string;
name: string;
url: string;
server_type: McpServerType;
// server_type: McpServerType;
description?: string;
variables?: IMcpServerVariable[];
headers: Map<string, string>;

View File

@@ -1,4 +1,4 @@
import { IExportedMcpServer } from '@/interfaces/database/mcp';
// import { IExportedMcpServer } from '@/interfaces/database/mcp';
export interface ITestMcpRequestBody {
server_type: string;
@@ -9,8 +9,8 @@ export interface ITestMcpRequestBody {
}
export interface IImportMcpServersRequestBody {
mcpServers: Record<
string,
Pick<IExportedMcpServer, 'type' | 'url' | 'authorization_token'>
>;
// mcpServers: Record<
// string,
// Pick<IExportedMcpServer, 'type' | 'url' | 'authorization_token'>
// >;
}

View File

@@ -61,7 +61,7 @@ const MetricValue = styled(Typography)(({ theme }) => ({
lineHeight: 1.2,
}));
const TrendIndicator = styled(Box)<{ trend: 'up' | 'down' }>(({ trend, theme }) => ({
const TrendIndicator = styled(Box)<{ trend: string }>(({ trend, theme }) => ({
display: 'flex',
alignItems: 'center',
gap: '0.25rem',
@@ -245,7 +245,7 @@ const Dashboard: React.FC = () => {
{/* 关键指标卡片 */}
<Grid container spacing={3} sx={{ mb: 3 }}>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<MetricCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">
@@ -270,7 +270,7 @@ const Dashboard: React.FC = () => {
</MetricCard>
</Grid>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<MetricCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">
@@ -295,7 +295,7 @@ const Dashboard: React.FC = () => {
</MetricCard>
</Grid>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<MetricCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">
@@ -320,7 +320,7 @@ const Dashboard: React.FC = () => {
</MetricCard>
</Grid>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<MetricCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">
@@ -362,7 +362,7 @@ const Dashboard: React.FC = () => {
</Button>
</Box>
<KnowledgeGridView
knowledgeBases={mockKnowledgeBases}
knowledgeBases={mockKnowledgeBases as any}
maxItems={3}
showSeeAll={true}
onSeeAll={handleSeeAllKnowledgeBases}
@@ -372,7 +372,7 @@ const Dashboard: React.FC = () => {
{/* 系统状态 */}
<Grid container spacing={3} sx={{ mb: 3 }}>
<Grid item xs={12} md={6}>
<Grid size={{xs:12,md:6}}>
<Card sx={{ border: '1px solid #E5E5E5' }}>
<CardContent>
<Typography variant="h6" fontWeight={600} mb={2}>
@@ -403,7 +403,7 @@ const Dashboard: React.FC = () => {
</Card>
</Grid>
<Grid item xs={12} md={6}>
<Grid size={{xs:12,md:6}}>
<Card sx={{ border: '1px solid #E5E5E5' }}>
<CardContent>
<Typography variant="h6" fontWeight={600} mb={2}>
@@ -479,15 +479,6 @@ const Dashboard: React.FC = () => {
</TableContainer>
</CardContent>
</Card>
{/* 用户数据调试组件 - 仅在开发环境显示 */}
{process.env.NODE_ENV === 'development' && (
<Card sx={{ border: '1px solid #E5E5E5', mt: 3 }}>
<CardContent>
<UserDataDebug />
</CardContent>
</Card>
)}
</PageContainer>
);
};

View File

@@ -193,7 +193,7 @@ const MCP: React.FC = () => {
<>
{/* 状态概览 */}
<Grid container spacing={3} sx={{ mb: 3 }}>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<StatusCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">
@@ -211,7 +211,7 @@ const MCP: React.FC = () => {
</StatusCard>
</Grid>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<StatusCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">
@@ -229,7 +229,7 @@ const MCP: React.FC = () => {
</StatusCard>
</Grid>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<StatusCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">
@@ -247,7 +247,7 @@ const MCP: React.FC = () => {
</StatusCard>
</Grid>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<StatusCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">
@@ -359,7 +359,7 @@ const MCP: React.FC = () => {
</Alert>
<Grid container spacing={2}>
{mockMCPServers.map((server) => (
<Grid item xs={12} md={6} key={server.id}>
<Grid size={{xs:12,md:6}} key={server.id}>
<Card variant="outlined">
<CardContent>
<Typography variant="subtitle1" fontWeight={600} mb={1}>
@@ -389,7 +389,7 @@ const MCP: React.FC = () => {
{tabValue === 2 && (
<Grid container spacing={3}>
<Grid item xs={12} md={6}>
<Grid size={{xs:12,md:6}}>
<Card sx={{ border: '1px solid #E5E5E5' }}>
<CardContent>
<Typography variant="h6" fontWeight={600} mb={2}>
@@ -418,7 +418,7 @@ const MCP: React.FC = () => {
</Card>
</Grid>
<Grid item xs={12} md={6}>
<Grid size={{xs:12,md:6}}>
<Card sx={{ border: '1px solid #E5E5E5' }}>
<CardContent>
<Typography variant="h6" fontWeight={600} mb={2}>

View File

@@ -226,7 +226,7 @@ const ModelsResources: React.FC = () => {
<>
{/* 模型概览卡片 */}
<Grid container spacing={3} sx={{ mb: 3 }}>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<ResourceCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">
@@ -244,7 +244,7 @@ const ModelsResources: React.FC = () => {
</ResourceCard>
</Grid>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<ResourceCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">
@@ -262,7 +262,7 @@ const ModelsResources: React.FC = () => {
</ResourceCard>
</Grid>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<ResourceCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">
@@ -280,7 +280,7 @@ const ModelsResources: React.FC = () => {
</ResourceCard>
</Grid>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<ResourceCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">
@@ -385,7 +385,7 @@ const ModelsResources: React.FC = () => {
<>
{/* 资源概览卡片 */}
<Grid container spacing={3} sx={{ mb: 3 }}>
<Grid item xs={12} sm={6} md={4}>
<Grid size={{xs:12,sm:6,md:4}}>
<ResourceCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">
@@ -403,7 +403,7 @@ const ModelsResources: React.FC = () => {
</ResourceCard>
</Grid>
<Grid item xs={12} sm={6} md={4}>
<Grid size={{xs:12,sm:6,md:4}}>
<ResourceCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">
@@ -421,7 +421,7 @@ const ModelsResources: React.FC = () => {
</ResourceCard>
</Grid>
<Grid item xs={12} sm={6} md={4}>
<Grid size={{xs:12,sm:6,md:4}}>
<ResourceCard>
<CardContent>
<Box display="flex" alignItems="center" justifyContent="space-between">

View File

@@ -155,7 +155,7 @@ const PipelineConfig: React.FC = () => {
</PageHeader>
<Grid container spacing={3}>
<Grid item xs={12} md={6}>
<Grid size={{xs:12,md:6}}>
<ConfigCard>
<CardContent>
<Typography variant="h6" fontWeight={600} mb={2}>
@@ -223,7 +223,7 @@ const PipelineConfig: React.FC = () => {
</ConfigCard>
</Grid>
<Grid item xs={12} md={6}>
<Grid size={{xs:12,md:6}}>
<ConfigCard>
<CardContent>
<Typography variant="h6" fontWeight={600} mb={2}>
@@ -283,7 +283,7 @@ const PipelineConfig: React.FC = () => {
</ConfigCard>
</Grid>
<Grid item xs={12}>
<Grid size={{xs:12,md:6}}>
<ConfigCard>
<CardContent>
<Typography variant="h6" fontWeight={600} mb={2}>
@@ -291,7 +291,7 @@ const PipelineConfig: React.FC = () => {
</Typography>
<Grid container spacing={2}>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<Box textAlign="center" p={2} bgcolor="#F8F9FA" borderRadius="6px">
<Typography variant="h4" color="primary" fontWeight={600}>
1,234
@@ -301,7 +301,7 @@ const PipelineConfig: React.FC = () => {
</Typography>
</Box>
</Grid>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<Box textAlign="center" p={2} bgcolor="#F8F9FA" borderRadius="6px">
<Typography variant="h4" color="success.main" fontWeight={600}>
98.5%
@@ -311,7 +311,7 @@ const PipelineConfig: React.FC = () => {
</Typography>
</Box>
</Grid>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<Box textAlign="center" p={2} bgcolor="#F8F9FA" borderRadius="6px">
<Typography variant="h4" color="warning.main" fontWeight={600}>
2.3s
@@ -321,7 +321,7 @@ const PipelineConfig: React.FC = () => {
</Typography>
</Box>
</Grid>
<Grid item xs={12} sm={6} md={3}>
<Grid size={{xs:12,sm:6,md:3}}>
<Box textAlign="center" p={2} bgcolor="#F8F9FA" borderRadius="6px">
<Typography variant="h4" color="info.main" fontWeight={600}>
156

View File

@@ -18,8 +18,8 @@
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true,