From 91eaa37283a0390033bcbaf8775206b960c47e92 Mon Sep 17 00:00:00 2001 From: "guangfei.zhao" Date: Mon, 20 Oct 2025 10:34:38 +0800 Subject: [PATCH] refactor: update grid component props and optimize docker setup --- .dockerignore | 98 +++++++++++++++++++++++++++ .env.production | 6 ++ Dockerfile | 52 +++++++++++++- docker-compose.yml | 28 ++++++++ src/interfaces/database/agent.ts | 13 ++-- src/interfaces/database/chat.ts | 4 +- src/interfaces/database/flow.ts | 2 +- src/interfaces/database/mcp-server.ts | 10 +-- src/interfaces/request/mcp.ts | 10 +-- src/pages/Dashboard.tsx | 25 +++---- src/pages/MCP.tsx | 14 ++-- src/pages/ModelsResources.tsx | 14 ++-- src/pages/PipelineConfig.tsx | 14 ++-- tsconfig.app.json | 4 +- 14 files changed, 232 insertions(+), 62 deletions(-) create mode 100644 .dockerignore create mode 100644 .env.production create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..fafba2d --- /dev/null +++ b/.dockerignore @@ -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 \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..e7fdc6e --- /dev/null +++ b/.env.production @@ -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-----" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 65d19c6..867926c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 <; 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; } diff --git a/src/interfaces/database/chat.ts b/src/interfaces/database/chat.ts index 62bcb46..ae3baba 100644 --- a/src/interfaces/database/chat.ts +++ b/src/interfaces/database/chat.ts @@ -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; diff --git a/src/interfaces/database/flow.ts b/src/interfaces/database/flow.ts index abcf060..6174ce6 100644 --- a/src/interfaces/database/flow.ts +++ b/src/interfaces/database/flow.ts @@ -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; diff --git a/src/interfaces/database/mcp-server.ts b/src/interfaces/database/mcp-server.ts index 34ed7e4..4a5bb04 100644 --- a/src/interfaces/database/mcp-server.ts +++ b/src/interfaces/database/mcp-server.ts @@ -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; diff --git a/src/interfaces/request/mcp.ts b/src/interfaces/request/mcp.ts index 96891ad..b9c7471 100644 --- a/src/interfaces/request/mcp.ts +++ b/src/interfaces/request/mcp.ts @@ -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 - >; + // mcpServers: Record< + // string, + // Pick + // >; } diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index 93eac28..6bab2a2 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -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 = () => { {/* 关键指标卡片 */} - + @@ -270,7 +270,7 @@ const Dashboard: React.FC = () => { - + @@ -295,7 +295,7 @@ const Dashboard: React.FC = () => { - + @@ -320,7 +320,7 @@ const Dashboard: React.FC = () => { - + @@ -362,7 +362,7 @@ const Dashboard: React.FC = () => { { {/* 系统状态 */} - + @@ -403,7 +403,7 @@ const Dashboard: React.FC = () => { - + @@ -479,15 +479,6 @@ const Dashboard: React.FC = () => { - - {/* 用户数据调试组件 - 仅在开发环境显示 */} - {process.env.NODE_ENV === 'development' && ( - - - - - - )} ); }; diff --git a/src/pages/MCP.tsx b/src/pages/MCP.tsx index 5e916a6..901364e 100644 --- a/src/pages/MCP.tsx +++ b/src/pages/MCP.tsx @@ -193,7 +193,7 @@ const MCP: React.FC = () => { <> {/* 状态概览 */} - + @@ -211,7 +211,7 @@ const MCP: React.FC = () => { - + @@ -229,7 +229,7 @@ const MCP: React.FC = () => { - + @@ -247,7 +247,7 @@ const MCP: React.FC = () => { - + @@ -359,7 +359,7 @@ const MCP: React.FC = () => { {mockMCPServers.map((server) => ( - + @@ -389,7 +389,7 @@ const MCP: React.FC = () => { {tabValue === 2 && ( - + @@ -418,7 +418,7 @@ const MCP: React.FC = () => { - + diff --git a/src/pages/ModelsResources.tsx b/src/pages/ModelsResources.tsx index 43889fc..8be12b2 100644 --- a/src/pages/ModelsResources.tsx +++ b/src/pages/ModelsResources.tsx @@ -226,7 +226,7 @@ const ModelsResources: React.FC = () => { <> {/* 模型概览卡片 */} - + @@ -244,7 +244,7 @@ const ModelsResources: React.FC = () => { - + @@ -262,7 +262,7 @@ const ModelsResources: React.FC = () => { - + @@ -280,7 +280,7 @@ const ModelsResources: React.FC = () => { - + @@ -385,7 +385,7 @@ const ModelsResources: React.FC = () => { <> {/* 资源概览卡片 */} - + @@ -403,7 +403,7 @@ const ModelsResources: React.FC = () => { - + @@ -421,7 +421,7 @@ const ModelsResources: React.FC = () => { - + diff --git a/src/pages/PipelineConfig.tsx b/src/pages/PipelineConfig.tsx index 27d28df..584e02f 100644 --- a/src/pages/PipelineConfig.tsx +++ b/src/pages/PipelineConfig.tsx @@ -155,7 +155,7 @@ const PipelineConfig: React.FC = () => { - + @@ -223,7 +223,7 @@ const PipelineConfig: React.FC = () => { - + @@ -283,7 +283,7 @@ const PipelineConfig: React.FC = () => { - + @@ -291,7 +291,7 @@ const PipelineConfig: React.FC = () => { - + 1,234 @@ -301,7 +301,7 @@ const PipelineConfig: React.FC = () => { - + 98.5% @@ -311,7 +311,7 @@ const PipelineConfig: React.FC = () => { - + 2.3s @@ -321,7 +321,7 @@ const PipelineConfig: React.FC = () => { - + 156 diff --git a/tsconfig.app.json b/tsconfig.app.json index 3238272..58ce92b 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -18,8 +18,8 @@ /* Linting */ "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, + "noUnusedLocals": false, + "noUnusedParameters": false, "erasableSyntaxOnly": true, "noFallthroughCasesInSwitch": true, "noUncheckedSideEffectImports": true,