mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-19 11:45:10 +08:00
Fix: Some bugs (#12441)
### What problem does this PR solve? Fix: Some bugs - In a production environment, a second-level page refresh results in a white screen. - The knowledge graph cannot be opened. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -1 +1 @@
|
||||
VITE_BASE_URL=''
|
||||
VITE_BASE_URL='/'
|
||||
@ -1 +1 @@
|
||||
VITE_BASE_URL=''
|
||||
VITE_BASE_URL='/'
|
||||
@ -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",
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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}
|
||||
/>
|
||||
));
|
||||
|
||||
@ -104,7 +104,7 @@ const ChunkCard = ({
|
||||
<TooltipContent
|
||||
className="p-0"
|
||||
align={'start'}
|
||||
side={'right'}
|
||||
side={'left'}
|
||||
sideOffset={-20}
|
||||
tabIndex={-1}
|
||||
>
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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 };
|
||||
};
|
||||
|
||||
@ -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`;
|
||||
}
|
||||
|
||||
@ -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/',
|
||||
|
||||
Reference in New Issue
Block a user