Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: Some bugs (#12441)

chanx00f8a80ca4d8
diff --git a/web/.env.development b/web/.env.development
index e43abf9ad8..f33f3bef5c 100644
--- a/web/.env.development
+++ b/web/.env.development
@@ -1 +1 @@
-VITE_BASE_URL=''
\ No newline at end of file
+VITE_BASE_URL='/'
\ No newline at end of file
diff --git a/web/.env.production b/web/.env.production
index e43abf9ad8..f33f3bef5c 100644
--- a/web/.env.production
+++ b/web/.env.production
@@ -1 +1 @@
-VITE_BASE_URL=''
\ No newline at end of file
+VITE_BASE_URL='/'
\ No newline at end of file
diff --git a/web/package.json b/web/package.json
index 92a749743f..f54f24fffd 100644
--- a/web/package.json
+++ b/web/package.json
@@ -7,7 +7,7 @@
"scripts": {
"build": "vite build --mode production",
"build-storybook": "storybook build",
- "dev": "vite",
+ "dev": "vite --host",
"lint": "eslint src --ext .ts,.tsx --report-unused-disable-directives --max-warnings 0",
"prepare": "cd .. && husky web/.husky",
"preview": "vite preview",
diff --git a/web/src/components/document-preview/document-header.tsx b/web/src/components/document-preview/document-header.tsx
index 5ff971b3a3..f6656da86d 100644
--- a/web/src/components/document-preview/document-header.tsx
+++ b/web/src/components/document-preview/document-header.tsx
@@ -12,7 +12,7 @@ export default ({ size, name, create_date }: Props) => {
const dateStr = formatDate(create_date);
return (
<div>
- <h2 className="text-[16px]">{name}</h2>
+ <h2 className="text-[16px] truncate">{name}</h2>
<div className="text-text-secondary text-[12px] pt-[5px]">
Size:{sizeName} Uploaded Time:{dateStr}
</div>
diff --git a/web/src/components/ui/breadcrumb.tsx b/web/src/components/ui/breadcrumb.tsx
index 3043a286e9..3d2de4974a 100644
--- a/web/src/components/ui/breadcrumb.tsx
+++ b/web/src/components/ui/breadcrumb.tsx
@@ -69,7 +69,7 @@ const BreadcrumbPage = React.forwardRef<
role="link"
aria-disabled="true"
aria-current="page"
- className={cn('font-normal text-foreground', className)}
+ className={cn('font-normal text-foreground truncate max-w-40', className)}
{...props}
/>
));
diff --git a/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-card/index.tsx b/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-card/index.tsx
index 9c2ccdc647..32f7dd2ed1 100644
--- a/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-card/index.tsx
+++ b/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/components/chunk-card/index.tsx
@@ -104,7 +104,7 @@ const ChunkCard = ({
<TooltipContent
className="p-0"
align={'start'}
- side={'right'}
+ side={'left'}
sideOffset={-20}
tabIndex={-1}
>
diff --git a/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/index.tsx b/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/index.tsx
index 034869e8a0..eff80deca1 100644
--- a/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/index.tsx
+++ b/web/src/pages/chunk/parsed-result/add-knowledge/components/knowledge-chunk/index.tsx
@@ -232,7 +232,7 @@ const Chunk = () => {
<div className="h-[100px] flex flex-col justify-end pb-[5px]">
<div>
<h2 className="text-[24px]">{t('chunk.chunkResult')}</h2>
- <div className="text-[14px] text-[#979AAB]">
+ <div className="text-[14px] text-text-secondary">
{t('chunk.chunkResultTip')}
</div>
</div>
diff --git a/web/src/pages/dataset/knowledge-graph/force-graph.tsx b/web/src/pages/dataset/knowledge-graph/force-graph.tsx
index 31533d0dea..d4776b22e4 100644
--- a/web/src/pages/dataset/knowledge-graph/force-graph.tsx
+++ b/web/src/pages/dataset/knowledge-graph/force-graph.tsx
@@ -1,7 +1,7 @@
import { ElementDatum, Graph, IElementEvent } from '@antv/g6';
import isEmpty from 'lodash/isEmpty';
import { useCallback, useEffect, useMemo, useRef } from 'react';
-import { buildNodesAndCombos } from './util';
+import { buildNodesAndCombos, defaultComboLabel } from './util';
import { useIsDarkTheme } from '@/components/theme-provider';
import styles from './index.module.less';
@@ -27,7 +27,7 @@ const ForceGraph = ({ data, show }: IProps) => {
const mi = buildNodesAndCombos(graphData.nodes);
return { edges: graphData.edges, ...mi };
}
- return { nodes: [], edges: [] };
+ return { nodes: [], edges: [], combos: [] };
}, [data]);
const render = useCallback(() => {
@@ -113,6 +113,20 @@ const ForceGraph = ({ data, show }: IProps) => {
};
},
},
+ combo: {
+ style: (e) => {
+ if (e.label === defaultComboLabel) {
+ return {
+ stroke: 'rgba(0,0,0,0)',
+ fill: 'rgba(0,0,0,0)',
+ };
+ } else {
+ return {
+ stroke: isDark ? 'rgba(255,255,255,0.5)' : 'rgba(0,0,0,0.5)',
+ };
+ }
+ },
+ },
});
if (graphRef.current) {
diff --git a/web/src/pages/dataset/knowledge-graph/util.ts b/web/src/pages/dataset/knowledge-graph/util.ts
index e0be797f2e..72a3efb10c 100644
--- a/web/src/pages/dataset/knowledge-graph/util.ts
+++ b/web/src/pages/dataset/knowledge-graph/util.ts
@@ -1,6 +1,7 @@
import { isEmpty } from 'lodash';
import { v4 as uuid } from 'uuid';
+export const defaultComboLabel = 'defaultCombo';
class KeyGenerator {
idx = 0;
chars: string[] = [];
@@ -89,6 +90,18 @@ export const buildNodesAndCombos = (nodes: any[]) => {
combo: combos.find((y) => y.data.label === findCombo(x?.communities))?.id,
};
});
+ if (!combos.length) {
+ const defaultComboId = uuid();
+ const defaultCombo = {
+ id: defaultComboId,
+ label: 'defaultCombo',
+ data: {
+ label: 'defaultCombo',
+ },
+ };
+
+ combos.push(defaultCombo);
+ }
return { nodes: nextNodes, combos };
};
diff --git a/web/src/utils/authorization-util.ts b/web/src/utils/authorization-util.ts
index d2cd5b0a44..0c9118cd35 100644
--- a/web/src/utils/authorization-util.ts
+++ b/web/src/utils/authorization-util.ts
@@ -59,6 +59,6 @@ export default storage;
// Will not jump to the login page
export function redirectToLogin() {
- const env = import.meta.env;
- window.location.href = location.origin + env.VITE_BASE_URL + `/login`;
+ // const env = import.meta.env;
+ window.location.href = location.origin + `/login`;
}
diff --git a/web/vite.config.ts b/web/vite.config.ts
index ca63807cf2..92ac2bae23 100644
--- a/web/vite.config.ts
+++ b/web/vite.config.ts
@@ -60,6 +60,7 @@ export default defineConfig(({ mode, command }) => {
},
server: {
port: 9222,
+ strictPort: false,
proxy: {
'/api/v1/admin': {
target: 'http://127.0.0.1:9381/',