Skip to content

Commit

Permalink
Feat: Add background color to GraphRag configuration #4980 (#4981)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

Feat: Add background color to GraphRag configuration #4980

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
  • Loading branch information
cike8899 authored Feb 14, 2025
1 parent b4ad565 commit f9fe6ac
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
7 changes: 3 additions & 4 deletions web/src/components/parse-configuration/graph-rag-items.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useTranslate } from '@/hooks/common-hooks';
import { Divider, Form, Select, Switch } from 'antd';
import { Form, Select, Switch } from 'antd';
import { upperFirst } from 'lodash';
import { useCallback, useMemo } from 'react';
import EntityTypesItem from '../entity-types-item';
Expand Down Expand Up @@ -50,8 +50,7 @@ const GraphRagItems = () => {
);

return (
<>
<Divider></Divider>
<div className="border p-2 rounded-lg bg-slate-50 dark:bg-gray-600">
<Form.Item
name={['parser_config', 'graphrag', 'use_graphrag']}
label={t('useGraphRag')}
Expand Down Expand Up @@ -113,7 +112,7 @@ const GraphRagItems = () => {
);
}}
</Form.Item>
</>
</div>
);
};

Expand Down
13 changes: 12 additions & 1 deletion web/src/pages/flow/canvas/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ReactFlow,
} from '@xyflow/react';
import '@xyflow/react/dist/style.css';
import { FolderInput, FolderOutput } from 'lucide-react';
import { Book, FolderInput, FolderOutput } from 'lucide-react';
import ChatDrawer from '../chat/drawer';
import FormDrawer from '../flow-drawer';
import {
Expand All @@ -23,6 +23,7 @@ import {
} from '../hooks';
import { useBeforeDelete } from '../hooks/use-before-delete';
import { useHandleExportOrImportJsonFile } from '../hooks/use-export-json';
import { useOpenDocument } from '../hooks/use-open-document';
import { useShowDrawer } from '../hooks/use-show-drawer';
import JsonUploadModal from '../json-upload-modal';
import RunDrawer from '../run-drawer';
Expand Down Expand Up @@ -97,6 +98,8 @@ function FlowCanvas({ drawerVisible, hideDrawer }: IProps) {
hideFileUploadModal,
} = useHandleExportOrImportJsonFile();

const openDocument = useOpenDocument();

const {
onNodeClick,
onPaneClick,
Expand Down Expand Up @@ -189,6 +192,14 @@ function FlowCanvas({ drawerVisible, hideDrawer }: IProps) {
<TooltipContent>Export</TooltipContent>
</Tooltip>
</ControlButton>
<ControlButton onClick={openDocument}>
<Tooltip>
<TooltipTrigger asChild>
<Book className={controlIconClassname} />
</TooltipTrigger>
<TooltipContent>Document</TooltipContent>
</Tooltip>
</ControlButton>
</Controls>
</ReactFlow>
{formDrawerVisible && (
Expand Down
12 changes: 12 additions & 0 deletions web/src/pages/flow/hooks/use-open-document.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { useCallback } from 'react';

export function useOpenDocument() {
const openDocument = useCallback(() => {
window.open(
'https://ragflow.io/docs/dev/category/agent-components',
'_blank',
);
}, []);

return openDocument;
}

0 comments on commit f9fe6ac

Please sign in to comment.