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

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) => {