diff --git a/web/.env.development b/web/.env.development index e43abf9ad..f33f3bef5 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 e43abf9ad..f33f3bef5 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 92a749743..f54f24fff 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 5ff971b3a..f6656da86 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 (
-

{name}

+

{name}

Size:{sizeName} Uploaded Time:{dateStr}
diff --git a/web/src/components/ui/breadcrumb.tsx b/web/src/components/ui/breadcrumb.tsx index 3043a286e..3d2de4974 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 9c2ccdc64..32f7dd2ed 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 = ({ 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 034869e8a..eff80deca 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 = () => {

{t('chunk.chunkResult')}

-
+
{t('chunk.chunkResultTip')}
diff --git a/web/src/pages/dataset/knowledge-graph/force-graph.tsx b/web/src/pages/dataset/knowledge-graph/force-graph.tsx index 31533d0de..d4776b22e 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 e0be797f2..72a3efb10 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 d2cd5b0a4..0c9118cd3 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 ca63807cf..92ac2bae2 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/',