feat: update env configs and add team canvas endpoint

This commit is contained in:
2025-11-10 11:09:22 +08:00
parent b2053760be
commit 81fa34669a
19 changed files with 220 additions and 55 deletions

3
.env
View File

@@ -1,5 +1,6 @@
# VITE_API_BASE_URL
VITE_API_BASE_URL = http://154.9.253.114:9380
# VITE_API_BASE_URL = http://154.9.253.114:9380
VITE_API_BASE_URL = http://150.158.121.95
# VITE_FLASK_API_BASE_URL
VITE_FLASK_API_BASE_URL = http://150.158.121.95

View File

@@ -1,6 +1,7 @@
# VITE_API_BASE_URL = http://150.158.121.95
# FastAPI 后台服务配置(默认生产环境)
VITE_API_BASE_URL = http://154.9.253.114:9380
# 生产环境 FastAPI 后台服务配置
VITE_API_BASE_URL = http://150.158.121.95
# FastAPI 后台服务配置 154 内存不够,使用 150 作为后台
# 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

3
.npmrc
View File

@@ -4,4 +4,5 @@ engine-strict=true
registry=https://registry.npmmirror.com/
# 为 Yarn 和 pnpm 设置相同的镜像源(确保一致性)
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/
ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/
ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/
include-workspace-root=true

View File

@@ -3,39 +3,38 @@ FROM node:20-alpine AS builder
# 接受构建参数
ARG BUILD_MODE=production
ARG RAGFLOW_BASE=/ragflow/
ENV RAGFLOW_BASE=${RAGFLOW_BASE}
WORKDIR /app
# 复制包管理文件
COPY package.json pnpm-lock.yaml ./
# 安装 pnpm 和依赖
# 安装 pnpm 和依赖(工作空间)
RUN npm install -g pnpm && pnpm install
# 复制源代码
COPY . .
# 根据构建模式复制对应的环境文件
# 设置环境文件(用于根应用的构建)
RUN if [ "$BUILD_MODE" = "flask" ]; then \
cp .env.flask .env; \
else \
cp .env.production .env; \
fi
# 根据构建模式执行对应的构建命令
RUN if [ "$BUILD_MODE" = "flask" ]; then \
pnpm build:flask; \
else \
pnpm build; \
fi
# 同时构建两个前端(根 Vite 应用 + ragflow_web Umi 应用)
RUN pnpm -r --filter ./ --filter ragflow_web run build
# 生产阶段 - nginx
FROM nginx:alpine AS production
# 接受端口参数默认为5173
# 接受端口与子路径参数
ARG PORT=5173
ARG RAGFLOW_BASE=/ragflow/
# 复制自定义 nginx 配置
# 复制自定义 nginx 配置,分别部署两个前端
RUN cat > /etc/nginx/conf.d/default.conf << EOF
server {
listen ${PORT};
@@ -43,11 +42,17 @@ server {
root /usr/share/nginx/html;
index index.html;
# 处理 SPA 路由
# 根应用ViteSPA 路由
location / {
try_files \$uri \$uri/ /index.html;
}
# ragflow_webUmi部署在子路径支持 SPA 路由
location ${RAGFLOW_BASE} {
alias /usr/share/nginx/html/ragflow/;
try_files \$uri \$uri/ /index.html;
}
# 静态资源缓存
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
expires 1y;
@@ -67,10 +72,11 @@ server {
}
EOF
# 从构建阶段复制构建产物
# 从构建阶段复制构建产物:根应用与 ragflow_web
COPY --from=builder /app/dist /usr/share/nginx/html
COPY --from=builder /app/ragflow_web/dist /usr/share/nginx/html/ragflow
# 暴露端口(使用构建时指定的端口)
# 暴露端口
EXPOSE ${PORT}
# 启动 nginx

View File

@@ -5,11 +5,8 @@
"type": "module",
"scripts": {
"dev": "vite",
"dev:flask": "vite --mode flask",
"dev:both": "pnpm -r --parallel --filter teres_web_frontend --filter ragflow_web run dev",
"dev:all": "pnpm -r --parallel --filter teres_web_frontend --filter ragflow_web --filter @teres/auth-gateway run dev",
"build": "tsc -b && vite build",
"build:flask": "tsc -b && vite build --mode flask",
"lint": "eslint .",
"preview": "vite preview"
},

119
pnpm-lock.yaml generated
View File

@@ -174,6 +174,9 @@ importers:
'@ant-design/pro-layout':
specifier: ^7.17.16
version: 7.22.7(antd@5.28.0(date-fns@4.1.0)(moment@2.30.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@antv/g':
specifier: ^6.1.28
version: 6.1.28
'@antv/g2':
specifier: ^5.2.10
version: 5.4.3
@@ -186,9 +189,15 @@ importers:
'@js-preview/excel':
specifier: ^1.7.14
version: 1.7.14
'@lexical/code':
specifier: ^0.38.2
version: 0.38.2
'@lexical/react':
specifier: ^0.23.1
version: 0.23.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(yjs@13.6.27)
'@lexical/rich-text':
specifier: ^0.38.2
version: 0.38.2
'@monaco-editor/react':
specifier: ^4.6.0
version: 4.7.0(monaco-editor@0.54.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@@ -309,6 +318,9 @@ importers:
cmdk:
specifier: ^1.0.4
version: 1.1.1(@types/react-dom@18.3.7(@types/react@18.3.26))(@types/react@18.3.26)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
date-fns:
specifier: ^4.1.0
version: 4.1.0
dayjs:
specifier: ^1.11.10
version: 1.11.18
@@ -354,6 +366,9 @@ importers:
mammoth:
specifier: ^1.7.2
version: 1.11.0
monaco-editor:
specifier: ^0.54.0
version: 0.54.0
next-themes:
specifier: ^0.4.6
version: 0.4.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@@ -1896,9 +1911,15 @@ packages:
'@lexical/clipboard@0.23.1':
resolution: {integrity: sha512-MT8IXl1rhTe8VcwnkhgFtWra6sRYNsl/I7nE9aw6QxwvPReKmRDmyBmEIeXwnKSGHRe19OJhu4/A9ciKPyVdMA==}
'@lexical/clipboard@0.38.2':
resolution: {integrity: sha512-dDShUplCu8/o6BB9ousr3uFZ9bltR+HtleF/Tl8FXFNPpZ4AXhbLKUoJuucRuIr+zqT7RxEv/3M6pk/HEoE6NQ==}
'@lexical/code@0.23.1':
resolution: {integrity: sha512-TOxaFAwoewrX3rHp4Po+u1LJT8oteP/6Kn2z6j9DaynBW62gIqTuSAFcMPysVx/Puq5hhJHPRD/be9RWDteDZw==}
'@lexical/code@0.38.2':
resolution: {integrity: sha512-wpqgbmPsfi/+8SYP0zI2kml09fGPRhzO5litR9DIbbSGvcbawMbRNcKLO81DaTbsJRnBJiQvbBBBJAwZKRqgBw==}
'@lexical/devtools-core@0.23.1':
resolution: {integrity: sha512-QsgcrECy11ZHhWAfyNW/ougXFF1o0EuQnhFybgTdqQmw0rJ2ZgPLpPjD5lws3CE8mP8g5knBV4/cyxvv42fzzg==}
peerDependencies:
@@ -1908,6 +1929,12 @@ packages:
'@lexical/dragon@0.23.1':
resolution: {integrity: sha512-ZoY9VJDrTpO69sinRhIs3RlPAWviy4mwnC7lqtM77/pVK0Kaknv7z2iDqv+414PKQCgUhyoXp7PfYXu/3yb6LQ==}
'@lexical/dragon@0.38.2':
resolution: {integrity: sha512-riOhgo+l4oN50RnLGhcqeUokVlMZRc+NDrxRNs2lyKSUdC4vAhAmAVUHDqYPyb4K4ZSw4ebZ3j8hI2zO4O3BbA==}
'@lexical/extension@0.38.2':
resolution: {integrity: sha512-qbUNxEVjAC0kxp7hEMTzktj0/51SyJoIJWK6Gm790b4yNBq82fEPkksfuLkRg9VQUteD0RT1Nkjy8pho8nNamw==}
'@lexical/hashtag@0.23.1':
resolution: {integrity: sha512-EkRCHV/IQwKlggy3VQDF9b4Krc9DKNZEjXe84CkEVrRpQSOwXi0qORzuaAipARyN632WKLSXOZJmNzkUNocJ6A==}
@@ -1917,12 +1944,18 @@ packages:
'@lexical/html@0.23.1':
resolution: {integrity: sha512-kNkDUaDe/Awypaw8JZn65BzT1gwNj2bNkaGFcmIkXUrTtiqlvgYvKvJeOKLkoAb/i2xq990ZAbHOsJrJm1jMbw==}
'@lexical/html@0.38.2':
resolution: {integrity: sha512-pC5AV+07bmHistRwgG3NJzBMlIzSdxYO6rJU4eBNzyR4becdiLsI4iuv+aY7PhfSv+SCs7QJ9oc4i5caq48Pkg==}
'@lexical/link@0.23.1':
resolution: {integrity: sha512-HRaOp7prtcbHjbgq8AjJ4O02jYb8pTeS8RrGcgIRhCOq3/EcsSb1dXMwuraqmh9oxbuFyEu/JE31EFksiOW6qA==}
'@lexical/list@0.23.1':
resolution: {integrity: sha512-TI3WyWk3avv9uaJwaq8V+m9zxLRgnzXDYNS0rREafnW09rDpaFkpVmDuX+PZVR3NqPlwVt+slWVSBuyfguAFbA==}
'@lexical/list@0.38.2':
resolution: {integrity: sha512-OQm9TzatlMrDZGxMxbozZEHzMJhKxAbH1TOnOGyFfzpfjbnFK2y8oLeVsfQZfZRmiqQS4Qc/rpFnRP2Ax5dsbA==}
'@lexical/mark@0.23.1':
resolution: {integrity: sha512-E7cMOBVMrNGMw0LsyWKNFQZ5Io3bUIHCC3aCUdH24z1XWnuTmDFKMqNrphywPniO7pzSgVyGpkQBZIAIN76+YA==}
@@ -1947,18 +1980,30 @@ packages:
'@lexical/rich-text@0.23.1':
resolution: {integrity: sha512-Y77HGxdF5aemjw/H44BXETD5KNeaNdwMRu9P7IrlK7cC1dvvimzL2D6ezbub5i7F1Ef5T0quOXjwK056vrqaKQ==}
'@lexical/rich-text@0.38.2':
resolution: {integrity: sha512-eFjeOT7YnDZYpty7Zlwlct0UxUSaYu53uLYG+Prs3NoKzsfEK7e7nYsy/BbQFfk5HoM1pYuYxFR2iIX62+YHGw==}
'@lexical/selection@0.23.1':
resolution: {integrity: sha512-xoehAURMZJZYf046GHUXiv8FSv5zTobhwDD2dML4fmNHPp9NxugkWHlNUinTK/b+jGgjSYVsqpEKPBmue4ZHdQ==}
'@lexical/selection@0.38.2':
resolution: {integrity: sha512-eMFiWlBH6bEX9U9sMJ6PXPxVXTrihQfFeiIlWLuTpEIDF2HRz7Uo1KFRC/yN6q0DQaj7d9NZYA6Mei5DoQuz5w==}
'@lexical/table@0.23.1':
resolution: {integrity: sha512-Qs+iuwSVkV4OGTt+JdL9hvyl/QO3X9waH70L5Fxu9JmQk/jLl02tIGXbE38ocJkByfpyk4PrphoXt6l7CugJZA==}
'@lexical/table@0.38.2':
resolution: {integrity: sha512-uu0i7yz0nbClmHOO5ZFsinRJE6vQnFz2YPblYHAlNigiBedhqMwSv5bedrzDq8nTTHwych3mC63tcyKIrM+I1g==}
'@lexical/text@0.23.1':
resolution: {integrity: sha512-aOuuAhmc+l2iSK99uP0x/Zg9LSQswQdNG3IxzGa0rTx844mWUHuEbAUaOqqlgDA1/zZ0WjObyhPfZJL775y63g==}
'@lexical/utils@0.23.1':
resolution: {integrity: sha512-yXEkF6fj32+mJblCoP0ZT/vA0S05FA0nRUkVrvGX6sbZ9y+cIzuIbBoHi4z1ytutcWHQrwCK4TsN9hPYBIlb2w==}
'@lexical/utils@0.38.2':
resolution: {integrity: sha512-y+3rw15r4oAWIEXicUdNjfk8018dbKl7dWHqGHVEtqzAYefnEYdfD2FJ5KOTXfeoYfxi8yOW7FvzS4NZDi8Bfw==}
'@lexical/yjs@0.23.1':
resolution: {integrity: sha512-ygodSxmC65srNicMIhqBRIXI2LHhmnHcR1EO9fLO7flZWGCR1HIoeGmwhHo9FLgJoc5LHanV+dE0z1onFo1qqQ==}
peerDependencies:
@@ -2314,6 +2359,9 @@ packages:
'@popperjs/core@2.11.8':
resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==}
'@preact/signals-core@1.12.1':
resolution: {integrity: sha512-BwbTXpj+9QutoZLQvbttRg5x3l5468qaV2kufh+51yha1c53ep5dY4kTuZR35+3pAZxpfQerGJiQqg34ZNZ6uA==}
'@radix-ui/number@1.1.0':
resolution: {integrity: sha512-V3gRzhVNU1ldS5XhAPTom1fOIo4ccrjjJgmE+LI2h/WaFpHmx0MQApT+KZHnx8abG6Avtfcz4WoEciMnpFT3HQ==}
@@ -8062,6 +8110,9 @@ packages:
lexical@0.23.1:
resolution: {integrity: sha512-iuS72HcAYUemsCRQCm4XZzkGhZb8a9KagW+ee2TFfkkf9f3ZpUYSrobMpjYVZRkgMOx7Zk5VCPMxm1nouJTfnQ==}
lexical@0.38.2:
resolution: {integrity: sha512-JJmfsG3c4gwBHzUGffbV7ifMNkKAWMCnYE3xJl87gty7hjyV5f3xq7eqTjP5HFYvO4XpjJvvWO2/djHp5S10tw==}
lib0@0.2.114:
resolution: {integrity: sha512-gcxmNFzA4hv8UYi8j43uPlQ7CGcyMJ2KQb5kZASw6SnAKAf10hK12i2fjrS3Cl/ugZa5Ui6WwIu1/6MIXiHttQ==}
engines: {node: '>=16'}
@@ -13638,12 +13689,26 @@ snapshots:
'@lexical/utils': 0.23.1
lexical: 0.23.1
'@lexical/clipboard@0.38.2':
dependencies:
'@lexical/html': 0.38.2
'@lexical/list': 0.38.2
'@lexical/selection': 0.38.2
'@lexical/utils': 0.38.2
lexical: 0.38.2
'@lexical/code@0.23.1':
dependencies:
'@lexical/utils': 0.23.1
lexical: 0.23.1
prismjs: 1.30.0
'@lexical/code@0.38.2':
dependencies:
'@lexical/utils': 0.38.2
lexical: 0.38.2
prismjs: 1.30.0
'@lexical/devtools-core@0.23.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies:
'@lexical/html': 0.23.1
@@ -13659,6 +13724,17 @@ snapshots:
dependencies:
lexical: 0.23.1
'@lexical/dragon@0.38.2':
dependencies:
'@lexical/extension': 0.38.2
lexical: 0.38.2
'@lexical/extension@0.38.2':
dependencies:
'@lexical/utils': 0.38.2
'@preact/signals-core': 1.12.1
lexical: 0.38.2
'@lexical/hashtag@0.23.1':
dependencies:
'@lexical/utils': 0.23.1
@@ -13675,6 +13751,12 @@ snapshots:
'@lexical/utils': 0.23.1
lexical: 0.23.1
'@lexical/html@0.38.2':
dependencies:
'@lexical/selection': 0.38.2
'@lexical/utils': 0.38.2
lexical: 0.38.2
'@lexical/link@0.23.1':
dependencies:
'@lexical/utils': 0.23.1
@@ -13685,6 +13767,13 @@ snapshots:
'@lexical/utils': 0.23.1
lexical: 0.23.1
'@lexical/list@0.38.2':
dependencies:
'@lexical/extension': 0.38.2
'@lexical/selection': 0.38.2
'@lexical/utils': 0.38.2
lexical: 0.38.2
'@lexical/mark@0.23.1':
dependencies:
'@lexical/utils': 0.23.1
@@ -13749,16 +13838,35 @@ snapshots:
'@lexical/utils': 0.23.1
lexical: 0.23.1
'@lexical/rich-text@0.38.2':
dependencies:
'@lexical/clipboard': 0.38.2
'@lexical/dragon': 0.38.2
'@lexical/selection': 0.38.2
'@lexical/utils': 0.38.2
lexical: 0.38.2
'@lexical/selection@0.23.1':
dependencies:
lexical: 0.23.1
'@lexical/selection@0.38.2':
dependencies:
lexical: 0.38.2
'@lexical/table@0.23.1':
dependencies:
'@lexical/clipboard': 0.23.1
'@lexical/utils': 0.23.1
lexical: 0.23.1
'@lexical/table@0.38.2':
dependencies:
'@lexical/clipboard': 0.38.2
'@lexical/extension': 0.38.2
'@lexical/utils': 0.38.2
lexical: 0.38.2
'@lexical/text@0.23.1':
dependencies:
lexical: 0.23.1
@@ -13770,6 +13878,13 @@ snapshots:
'@lexical/table': 0.23.1
lexical: 0.23.1
'@lexical/utils@0.38.2':
dependencies:
'@lexical/list': 0.38.2
'@lexical/selection': 0.38.2
'@lexical/table': 0.38.2
lexical: 0.38.2
'@lexical/yjs@0.23.1(yjs@13.6.27)':
dependencies:
'@lexical/offset': 0.23.1
@@ -14086,6 +14201,8 @@ snapshots:
'@popperjs/core@2.11.8': {}
'@preact/signals-core@1.12.1': {}
'@radix-ui/number@1.1.0': {}
'@radix-ui/number@1.1.1': {}
@@ -21097,6 +21214,8 @@ snapshots:
lexical@0.23.1: {}
lexical@0.38.2: {}
lib0@0.2.114:
dependencies:
isomorphic.js: 0.2.5

View File

@@ -1 +1,3 @@
PORT=9222
PORT=9222
RAGFLOW_BASE=/ragflow/
UMI_APP_API_BASE_URL=http://150.158.121.95

View File

@@ -4,17 +4,17 @@ import { defineConfig } from 'umi';
import { appName } from './src/conf.json';
import routes from './src/routes';
const ESLintPlugin = require('eslint-webpack-plugin');
const RAGFLOW_BASE = process.env.RAGFLOW_BASE || '/';
export default defineConfig({
title: appName,
outputPath: 'dist',
alias: { '@parent': path.resolve(__dirname, '../') },
npmClient: 'pnpm',
base: '/',
base: RAGFLOW_BASE,
routes,
publicPath: '/',
publicPath: RAGFLOW_BASE,
esbuildMinifyIIFE: true,
icons: {},
hash: true,
favicons: ['/logo.svg'],
headScripts: [{ src: '/iconfont.js', defer: true }],
@@ -24,7 +24,6 @@ export default defineConfig({
},
plugins: [
'@react-dev-inspector/umi4-plugin',
'@umijs/plugins/dist/tailwindcss',
],
jsMinifier: 'none', // Fixed the issue that the page displayed an error after packaging lexical with terser
lessLoader: {
@@ -32,26 +31,32 @@ export default defineConfig({
hack: `true; @import "~@/less/index.less";`,
},
},
devtool: 'source-map',
// devtool: 'source-map',
// Speed up dev startup by using cheaper source maps
devtool: process.env.NODE_ENV === 'development'
? 'eval-cheap-module-source-map'
: 'source-map',
copy: [
{ from: 'src/conf.json', to: 'dist/conf.json' },
{ from: 'node_modules/monaco-editor/min/vs/', to: 'dist/vs/' },
],
proxy: [
{
context: ['/api', '/v1'],
target: 'http://127.0.0.1:9380/',
changeOrigin: true,
ws: true,
logger: console,
// {
// context: ['/api', '/v1'],
// target: 'http://154.9.253.114:9380',
// target: 'http://150.158.121.95',
// changeOrigin: true,
// ws: true,
// logger: console,
// pathRewrite: { '^/v1': '/v1' },
},
// },
],
chainWebpack(memo, args) {
memo.module.rule('markdown').test(/\.md$/).type('asset/source');
memo.optimization.minimizer('terser').use(TerserPlugin); // Fixed the issue that the page displayed an error after packaging lexical with terser
memo.optimization.minimizer('terser').use(TerserPlugin);
// Fixed the issue that the page displayed an error after packaging lexical with terser
// memo.plugin('eslint').use(ESLintPlugin, [
// {
@@ -61,13 +66,6 @@ export default defineConfig({
// files: ['src/**/*.{js,ts,tsx}'],
// },
// ]);
return memo;
},
tailwindcss: {
// 显式指定入口样式,避免默认路径不一致导致生成超时
cssPath: 'tailwind.css',
// 明确配置文件路径,配合 monorepo 场景更稳妥
configPath: 'tailwind.config.js',
},
});

View File

@@ -24,11 +24,14 @@
"@ant-design/icons": "^5.2.6",
"@ant-design/pro-components": "^2.6.46",
"@ant-design/pro-layout": "^7.17.16",
"@antv/g": "^6.1.28",
"@antv/g2": "^5.2.10",
"@antv/g6": "^5.0.10",
"@hookform/resolvers": "^3.9.1",
"@js-preview/excel": "^1.7.14",
"@lexical/code": "^0.38.2",
"@lexical/react": "^0.23.1",
"@lexical/rich-text": "^0.38.2",
"@monaco-editor/react": "^4.6.0",
"@radix-ui/react-accordion": "^1.2.3",
"@radix-ui/react-alert-dialog": "^1.1.4",
@@ -69,6 +72,7 @@
"classnames": "^2.5.1",
"clsx": "^2.1.1",
"cmdk": "^1.0.4",
"date-fns": "^4.1.0",
"dayjs": "^1.11.10",
"dompurify": "^3.1.6",
"eventsource-parser": "^1.1.2",
@@ -84,6 +88,7 @@
"lodash": "^4.17.21",
"lucide-react": "^0.542.0",
"mammoth": "^1.7.2",
"monaco-editor": "^0.54.0",
"next-themes": "^0.4.6",
"openai-speech-stream-player": "^1.0.8",
"pptx-preview": "^1.0.5",

View File

@@ -1,7 +1,7 @@
// postcss.config.js
module.exports = {
plugins: {
// tailwindcss: {},
tailwindcss: {},
autoprefixer: {},
},
};

View File

@@ -1,3 +1,4 @@
import '../tailwind.css';
import { Toaster as Sonner } from '@/components/ui/sonner';
import { Toaster } from '@/components/ui/toaster';
import i18n from '@/locales/config';

View File

@@ -10,6 +10,7 @@ const {
getCanvasSSE,
setCanvas,
listCanvas,
listTeamCanvas,
resetCanvas,
removeCanvas,
runCanvas,
@@ -53,7 +54,8 @@ const methods = {
method: 'get',
},
listCanvas: {
url: listCanvas,
// url: listCanvas,
url: listTeamCanvas,
method: 'get',
},
resetCanvas: {

View File

@@ -150,6 +150,7 @@ export default {
// flow
listTemplates: `${api_host}/canvas/templates`,
listCanvas: `${api_host}/canvas/list`,
listTeamCanvas: `${api_host}/canvas/listteam`,
getCanvas: `${api_host}/canvas/get`,
getCanvasSSE: `${api_host}/canvas/getsse`,
removeCanvas: `${api_host}/canvas/rm`,

View File

@@ -5,15 +5,19 @@ export type FilterType = {
};
export function groupListByType<T extends Record<string, any>>(
list: T[],
list: T[] | undefined,
idField: string,
labelField: string,
) {
const fileTypeList: FilterType[] = [];
list.forEach((x) => {
const item = fileTypeList.find((y) => y.id === x[idField]);
const safeList = Array.isArray(list) ? list : [];
safeList.forEach((x) => {
const id = x[idField];
if (id === undefined || id === null) return;
const label = x[labelField] ?? String(id);
const item = fileTypeList.find((y) => y.id === id);
if (!item) {
fileTypeList.push({ id: x[idField], label: x[labelField], count: 1 });
fileTypeList.push({ id, label, count: 1 });
} else {
item.count += 1;
}

View File

@@ -71,10 +71,15 @@ const errorHandler = (error: {
return response ?? { data: { code: 1999 } };
};
const getBaseURL = (): string => {
const url = process.env.UMI_APP_API_BASE_URL;
// 允许不配置时走同源,配置后直接走后端绝对地址
return (url || '').replace(/\/+$/, '');
};
const request = axios.create({
// errorHandler,
baseURL: getBaseURL(),
timeout: 300000,
// getResponse: true,
});
request.interceptors.request.use(

View File

@@ -71,10 +71,17 @@ const errorHandler = (error: {
return response ?? { data: { code: 1999 } };
};
const getBaseURL = (): string => {
const url = process.env.UMI_APP_API_BASE_URL;
return (url || '').replace(/\/+$/, '');
};
const request: RequestMethod = extend({
errorHandler,
timeout: 300000,
getResponse: true,
// 统一为所有 /v1/... 加上后端前缀,未配置则走同源
prefix: getBaseURL(),
});
request.interceptors.request.use((url: string, options: any) => {

View File

@@ -46,11 +46,11 @@ export const useAgentList = (initialParams?: IAgentPaginationParams) => {
try {
const envMode = import.meta.env.MODE;
let response: any = null;
if (envMode === 'flask') {
// if (envMode === 'flask') {
response = await agentService.teamlistCanvas(params);
} else {
response = await agentService.listCanvas(params);
}
// } else {
// response = await agentService.listCanvas(params);
// }
const res = response.data || {};
logger.info('useAgentList fetchAgentList', res);
const data = res.data

View File

@@ -350,7 +350,8 @@ export function PipelineSelectorItem() {
const fetchPipelines = async () => {
try {
const envMode = import.meta.env.MODE;
const service = envMode === 'flask' ? agentService.teamlistCanvas : agentService.listCanvas;
// const service = envMode === 'flask' ? agentService.teamlistCanvas : agentService.listCanvas;
const service = agentService.teamlistCanvas;
const res = await service({ canvas_category: AgentCategory.DataflowCanvas, page_size: 100 });
const data = res?.data?.data || {};
const list = data.canvas || [];

View File

@@ -46,6 +46,20 @@ export default defineConfig({
server: {
host: '0.0.0.0',
allowedHosts: ['154.9.253.114', 'localhost', 'teres.deep-pilot.chat'],
proxy: {
// 将 /ragflow 下的所有请求代理到 Umi 开发服务器(默认 9222
'/ragflow': {
target: 'http://localhost:9222',
changeOrigin: true,
ws: true,
// 不重写路径,保持 /ragflow 前缀用于 Umi base/publicPath
},
'/__umi': {
target: 'http://localhost:9222',
changeOrigin: true,
ws: true,
},
}
},
resolve: {
alias: {