Skip to content

Commit d556e65

Browse files
label and checkboxes placement changes (#675)
* label and checkboxes placement changes * checkbox placement changes
1 parent 6b8b239 commit d556e65

File tree

6 files changed

+79
-87
lines changed

6 files changed

+79
-87
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,5 @@ google-cloud-cli-469.0.0-linux-x86_64.tar.gz
168168
/backend/src/chunks
169169
/backend/merged_files
170170
/backend/chunks
171-
google-cloud-cli-479.0.0-linux-x86_64.tar.gz
171+
google-cloud-cli-linux-x86_64.tar.gz
172+
.vennv

backend/score.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,20 +241,20 @@ async def post_processing(uri=Form(), userName=Form(), password=Form(), database
241241
graph = create_graph_database_connection(uri, userName, password, database)
242242
tasks = set(map(str.strip, json.loads(tasks)))
243243

244-
if "update_similarity_graph" in tasks:
244+
if "materialize_text_chunk_similarities" in tasks:
245245
await asyncio.to_thread(update_graph, graph)
246-
josn_obj = {'api_name': 'post_processing/update_similarity_graph', 'db_url': uri, 'logging_time': formatted_time(datetime.now(timezone.utc))}
246+
josn_obj = {'api_name': 'post_processing/materialize_text_chunk_similarities', 'db_url': uri, 'logging_time': formatted_time(datetime.now(timezone.utc))}
247247
logger.log_struct(josn_obj)
248248
logging.info(f'Updated KNN Graph')
249-
if "create_fulltext_index" in tasks:
249+
if "enable_hybrid_search_and_fulltext_search_in_bloom" in tasks:
250250
await asyncio.to_thread(create_fulltext, uri=uri, username=userName, password=password, database=database,type="entities")
251251
await asyncio.to_thread(create_fulltext, uri=uri, username=userName, password=password, database=database,type="keyword")
252-
josn_obj = {'api_name': 'post_processing/create_fulltext_index', 'db_url': uri, 'logging_time': formatted_time(datetime.now(timezone.utc))}
252+
josn_obj = {'api_name': 'post_processing/enable_hybrid_search_and_fulltext_search_in_bloom', 'db_url': uri, 'logging_time': formatted_time(datetime.now(timezone.utc))}
253253
logger.log_struct(josn_obj)
254254
logging.info(f'Full Text index created')
255-
if os.environ.get('ENTITY_EMBEDDING','False').upper()=="TRUE" and "create_entity_embedding" in tasks:
255+
if os.environ.get('ENTITY_EMBEDDING','False').upper()=="TRUE" and "materialize_entity_similarities" in tasks:
256256
await asyncio.to_thread(create_entity_embedding, graph)
257-
josn_obj = {'api_name': 'post_processing/create_entity_embedding', 'db_url': uri, 'logging_time': formatted_time(datetime.now(timezone.utc))}
257+
josn_obj = {'api_name': 'post_processing/materialize_entity_similarities', 'db_url': uri, 'logging_time': formatted_time(datetime.now(timezone.utc))}
258258
logger.log_struct(josn_obj)
259259
logging.info(f'Entity Embeddings created')
260260
return create_api_response('Success', message='All tasks completed successfully')

frontend/src/components/FileTable.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,9 @@ const FileTable = forwardRef<ChildRef, FileTableProps>((props, ref) => {
358358
...Array.from(new Set(filesData.map((f) => f.fileSource))).map((t) => {
359359
return {
360360
title: (
361-
<span className={`${t === fileSourceFilter ? 'n-bg-palette-primary-bg-selected' : ''} p-2`}>{t}</span>
361+
<span className={`${t === fileSourceFilter ? 'n-bg-palette-primary-bg-selected' : ''} p-2`}>
362+
{t}
363+
</span>
362364
),
363365
onClick: () => {
364366
setFileSourceFilter(t as string);
@@ -579,14 +581,14 @@ const FileTable = forwardRef<ChildRef, FileTableProps>((props, ref) => {
579581
item?.fileSource === 's3 bucket' && localStorage.getItem('accesskey') === item?.awsAccessKeyId
580582
? item?.status
581583
: item?.fileSource === 'local file'
582-
? item?.status
583-
: item?.status === 'Completed' || item.status === 'Failed'
584-
? item?.status
585-
: item?.fileSource == 'Wikipedia' ||
586-
item?.fileSource == 'youtube' ||
587-
item?.fileSource == 'gcs bucket'
588-
? item?.status
589-
: 'N/A',
584+
? item?.status
585+
: item?.status === 'Completed' || item.status === 'Failed'
586+
? item?.status
587+
: item?.fileSource == 'Wikipedia' ||
588+
item?.fileSource == 'youtube' ||
589+
item?.fileSource == 'gcs bucket'
590+
? item?.status
591+
: 'N/A',
590592
model: item?.model ?? model,
591593
id: uuidv4(),
592594
source_url: item?.url != 'None' && item?.url != '' ? item.url : '',
@@ -599,8 +601,8 @@ const FileTable = forwardRef<ChildRef, FileTableProps>((props, ref) => {
599601
language: item?.language ?? '',
600602
processingProgress:
601603
item?.processed_chunk != undefined &&
602-
item?.total_chunks != undefined &&
603-
!isNaN(Math.floor((item?.processed_chunk / item?.total_chunks) * 100))
604+
item?.total_chunks != undefined &&
605+
!isNaN(Math.floor((item?.processed_chunk / item?.total_chunks) * 100))
604606
? Math.floor((item?.processed_chunk / item?.total_chunks) * 100)
605607
: undefined,
606608
// total_pages: item?.total_pages ?? 0,
Lines changed: 25 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Box, Checkbox, Flex, Typography, useMediaQuery } from '@neo4j-ndl/react';
2-
import { taskParam } from '../../../../utils/Constants';
2+
import { POST_PROCESSING_JOBS } from '../../../../utils/Constants';
33
import { capitalize } from '../../../../utils/Utils';
44
import { useFileContext } from '../../../../context/UsersFiles';
55
import { tokens } from '@neo4j-ndl/base';
@@ -17,67 +17,33 @@ export default function PostProcessingCheckList() {
1717
These options allow you to fine-tune your knowledge graph for improved performance and deeper analysis
1818
</Typography>
1919
</Flex>
20-
<Flex justifyContent='space-between' flexDirection='column'>
21-
<Flex>
22-
<Typography variant={tablet ? 'subheading-small' : 'subheading-medium'}>
23-
Update Similarity Graph :
24-
</Typography>
25-
<Typography variant={tablet ? 'body-small' : 'body-medium'}>
26-
This option refines the connections between different pieces of information (chunks) within your
27-
knowledge graph. By leveraging a k-nearest neighbor algorithm with a similarity threshold (KNN_MIN_SCORE
28-
of 0.8), this process identifies and links chunks with high semantic similarity. This results in a more
29-
interconnected and insightful knowledge representation, enabling more accurate and relevant search
30-
results.
31-
</Typography>
32-
</Flex>
33-
<Flex>
34-
<Typography variant={tablet ? 'subheading-small' : 'subheading-medium'}>
35-
Create Fulltext Index :
36-
</Typography>
37-
<Typography variant={tablet ? 'body-small' : 'body-medium'}>
38-
This option optimizes search capabilities within your knowledge graph. It rebuilds the full-text index
39-
on database labels, ensuring faster and more efficient retrieval of information. This is particularly
40-
beneficial for large knowledge graphs, as it significantly speeds up keyword-based searches and improves
41-
overall query performance..
42-
</Typography>
43-
</Flex>
44-
<Flex>
45-
<Typography variant={tablet ? 'subheading-small' : 'subheading-medium'}>
46-
Create Entity Embeddings :
47-
</Typography>
48-
<Typography variant={tablet ? 'body-small' : 'body-medium'}>
49-
Enhances entity analysis by generating numerical representations (embeddings) that capture their
50-
semantic meaning. This facilitates tasks like clustering similar entities, identifying duplicates, and
51-
performing similarity-based searches.
52-
</Typography>
53-
</Flex>
20+
<Flex justifyContent='space-between' flexDirection='column' gap='6'>
21+
{POST_PROCESSING_JOBS.map((job, idx) => (
22+
<Flex key={`${job.title}${idx}`}>
23+
<Checkbox
24+
label={
25+
<Typography variant='label'>
26+
{job.title
27+
.split('_')
28+
.map((s) => capitalize(s))
29+
.join(' ')}
30+
</Typography>
31+
}
32+
checked={postProcessingTasks.includes(job.title)}
33+
onChange={(e) => {
34+
if (e.target.checked) {
35+
setPostProcessingTasks((prev) => [...prev, job.title]);
36+
} else {
37+
setPostProcessingTasks((prev) => prev.filter((s) => s !== job.title));
38+
}
39+
}}
40+
></Checkbox>
41+
<Typography variant={tablet ? 'body-small' : 'body-medium'}>{job.description}</Typography>
42+
</Flex>
43+
))}
5444
</Flex>
5545
</Flex>
5646
</div>
57-
<Flex flexDirection={tablet ? 'row' : 'column'}>
58-
{taskParam.map((task, index) => (
59-
<Box key={index}>
60-
<Checkbox
61-
label={
62-
<Typography variant={tablet ? 'subheading-medium' : 'subheading-large'}>
63-
{task
64-
.split('_')
65-
.map((s) => capitalize(s))
66-
.join(' ')}
67-
</Typography>
68-
}
69-
checked={postProcessingTasks.includes(task)}
70-
onChange={(e) => {
71-
if (e.target.checked) {
72-
setPostProcessingTasks((prev) => [...prev, task]);
73-
} else {
74-
setPostProcessingTasks((prev) => prev.filter((s) => s !== task));
75-
}
76-
}}
77-
></Checkbox>
78-
</Box>
79-
))}
80-
</Flex>
8147
</Flex>
8248
);
8349
}

frontend/src/utils/Constants.ts

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const defaultLLM = llms?.includes('openai-gpt-4o-mini')
5959
export const chatModes =
6060
process.env?.CHAT_MODES?.trim() != ''
6161
? process.env.CHAT_MODES?.split(',')
62-
: ['vector', 'graph', 'graph+vector', 'hybrid','hybrid+graph'];
62+
: ['vector', 'graph', 'graph+vector', 'hybrid', 'hybrid+graph'];
6363
export const chunkSize = process.env.CHUNK_SIZE ? parseInt(process.env.CHUNK_SIZE) : 1 * 1024 * 1024;
6464
export const timeperpage = process.env.TIME_PER_PAGE ? parseInt(process.env.TIME_PER_PAGE) : 50;
6565
export const timePerByte = 0.2;
@@ -160,7 +160,34 @@ export const buttonCaptions = {
160160
ask: 'Ask',
161161
};
162162

163-
export const taskParam: string[] = ['update_similarity_graph', 'create_fulltext_index', 'create_entity_embedding'];
163+
export const taskParam: string[] = [
164+
'materialize_text_chunk_similarities',
165+
'enable_hybrid_search_and_fulltext_search_in_bloom',
166+
'materialize_entity_similarities',
167+
];
168+
export const POST_PROCESSING_JOBS: { title: string; description: string }[] = [
169+
{
170+
title: 'materialize_text_chunk_similarities',
171+
description: `This option refines the connections between different pieces of information (chunks) within your
172+
knowledge graph. By leveraging a k-nearest neighbor algorithm with a similarity threshold (KNN_MIN_SCORE
173+
of 0.8), this process identifies and links chunks with high semantic similarity. This results in a more
174+
interconnected and insightful knowledge representation, enabling more accurate and relevant search
175+
results.`,
176+
},
177+
{
178+
title: 'enable_hybrid_search_and_fulltext_search_in_bloom',
179+
description: `This option optimizes search capabilities within your knowledge graph. It rebuilds the full-text index
180+
on database labels, ensuring faster and more efficient retrieval of information. This is particularly
181+
beneficial for large knowledge graphs, as it significantly speeds up keyword-based searches and improves
182+
overall query performance.`,
183+
},
184+
{
185+
title: 'materialize_entity_similarities',
186+
description: `Enhances entity analysis by generating numerical representations (embeddings) that capture their
187+
semantic meaning. This facilitates tasks like clustering similar entities, identifying duplicates, and
188+
performing similarity-based searches.`,
189+
},
190+
];
164191

165192
export const nvlOptions: NvlOptions = {
166193
allowDynamicMinZoom: true,

frontend/src/utils/Utils.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,14 @@ export const filterData = (
170170
allNodes: ExtendedNode[],
171171
allRelationships: Relationship[],
172172
scheme: Scheme
173-
) => {
173+
) => {
174174
let filteredNodes: ExtendedNode[] = [];
175175
let filteredRelations: Relationship[] = [];
176176
let filteredScheme: Scheme = {};
177177
const entityTypes = Object.keys(scheme).filter((type) => type !== 'Document' && type !== 'Chunk');
178178
if (graphType.includes('DocumentChunk') && !graphType.includes('Entities')) {
179179
// Document + Chunk
180-
filteredNodes = allNodes.filter(
181-
(node) => node.labels.includes('Document') || node.labels.includes('Chunk')
182-
);
180+
filteredNodes = allNodes.filter((node) => node.labels.includes('Document') || node.labels.includes('Chunk'));
183181
const nodeIds = new Set(filteredNodes.map((node) => node.id));
184182
filteredRelations = allRelationships.filter(
185183
(rel) =>
@@ -190,9 +188,7 @@ export const filterData = (
190188
filteredScheme = { Document: scheme.Document, Chunk: scheme.Chunk };
191189
} else if (graphType.includes('Entities') && !graphType.includes('DocumentChunk')) {
192190
// Only Entity
193-
const entityNodes = allNodes.filter(
194-
(node) => !node.labels.includes('Document') && !node.labels.includes('Chunk')
195-
);
191+
const entityNodes = allNodes.filter((node) => !node.labels.includes('Document') && !node.labels.includes('Chunk'));
196192
filteredNodes = entityNodes ? entityNodes : [];
197193
const nodeIds = new Set(filteredNodes.map((node) => node.id));
198194
filteredRelations = allRelationships.filter(
@@ -209,7 +205,7 @@ export const filterData = (
209205
filteredScheme = scheme;
210206
}
211207
return { filteredNodes, filteredRelations, filteredScheme };
212-
};
208+
};
213209

214210
export const getDateTime = () => {
215211
const date = new Date();

0 commit comments

Comments
 (0)