Skip to content

Commit ad7fb81

Browse files
all models
2 parents 0573ce2 + debcd24 commit ad7fb81

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+259
-357
lines changed

backend/example.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ CHUNKS_TO_BE_CREATED="50"
4848
BEDROCK_EMBEDDING_MODEL="model_name,aws_access_key,aws_secret_key,region_name" #model_name="amazon.titan-embed-text-v1"
4949
LLM_MODEL_CONFIG_bedrock_nova_micro_v1="model_name,aws_access_key,aws_secret_key,region_name" #model_name="amazon.nova-micro-v1:0"
5050
LLM_MODEL_CONFIG_bedrock_nova_lite_v1="model_name,aws_access_key,aws_secret_key,region_name" #model_name="amazon.nova-lite-v1:0"
51-
LLM_MODEL_CONFIG_bedrock_nova_pro_v1="model_name,aws_access_key,aws_secret_key,region_name" #model_name="amazon.nova-pro-v1:0"
51+
LLM_MODEL_CONFIG_bedrock_nova_pro_v1="model_name,aws_access_key,aws_secret_key,region_name" #model_name="amazon.nova-pro-v1:0"

backend/score.py

Lines changed: 55 additions & 51 deletions
Large diffs are not rendered by default.

backend/src/graphDB_dataAccess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,4 +561,4 @@ def get_nodelabels_relationships(self):
561561
return node_labels,relationship_types
562562
except Exception as e:
563563
print(f"Error in getting node labels/relationship types from db: {e}")
564-
return []
564+
return []

backend/src/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ async def processing_source(uri, userName, password, database, model, file_name,
361361

362362
logging.info('Update the status as Processing')
363363
update_graph_chunk_processed = int(os.environ.get('UPDATE_GRAPH_CHUNKS_PROCESSED'))
364-
365364
# selected_chunks = []
366365
is_cancelled_status = False
367366
job_status = "Completed"

backend/src/post_processing.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from src.graphDB_dataAccess import graphDBdataAccess
1212
import time
1313

14-
1514
DROP_INDEX_QUERY = "DROP INDEX entities IF EXISTS;"
1615
LABELS_QUERY = "CALL db.labels()"
1716
FULL_TEXT_QUERY = "CREATE FULLTEXT INDEX entities FOR (n{labels_str}) ON EACH [n.id, n.description];"

backend/src/shared/common_fn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def create_gcs_bucket_folder_name_hashed(uri, file_name):
133133

134134
def formatted_time(current_time):
135135
formatted_time = current_time.strftime('%Y-%m-%d %H:%M:%S %Z')
136-
return formatted_time
136+
return str(formatted_time)
137137

138138
def last_url_segment(url):
139139
parsed_url = urlparse(url)
@@ -173,4 +173,4 @@ def get_bedrock_embeddings():
173173
return bedrock_embeddings
174174
except Exception as e:
175175
print(f"An unexpected error occurred: {e}")
176-
raise
176+
raise

frontend/src/API/Index.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,45 @@
11
import axios from 'axios';
22
import { url } from '../utils/Utils';
3+
import { UserCredentials } from '../types';
34

45
const api = axios.create({
56
baseURL: url(),
7+
data: {},
68
});
9+
10+
export const createDefaultFormData = (userCredentials: UserCredentials) => {
11+
const formData = new FormData();
12+
formData.append('uri', userCredentials?.uri ?? '');
13+
formData.append('database', userCredentials?.database ?? '');
14+
formData.append('userName', userCredentials?.userName ?? '');
15+
formData.append('password', userCredentials?.password ?? '');
16+
formData.append('email', userCredentials?.email ?? '');
17+
api.interceptors.request.use(
18+
(config) => {
19+
if (config.data instanceof FormData) {
20+
for (const [key, value] of formData.entries()) {
21+
if (!config.data.has(key)) {
22+
config.data.append(key, value);
23+
}
24+
}
25+
} else {
26+
const formData = new FormData();
27+
for (const [key, value] of formData.entries()) {
28+
formData.append(key, value);
29+
}
30+
for (const [key, value] of Object.entries(config.data || {})) {
31+
formData.append(key, value as any);
32+
}
33+
config.data = formData;
34+
}
35+
36+
return config;
37+
},
38+
(error) => {
39+
return Promise.reject(error);
40+
}
41+
);
42+
return formData;
43+
};
44+
745
export default api;

frontend/src/components/ChatBot/ChatOnlyComponent.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const ChatContent: React.FC<ChatProps> = ({ chatMessages }) => {
3232
const encodedPassword = urlParams.get('password');
3333
const database = urlParams.get('database');
3434
const port = urlParams.get('port');
35+
const email = urlParams.get('email');
3536
const openModal = urlParams.get('open') === 'true';
3637
if (openModal || !(uri && user && encodedPassword && database && port)) {
3738
setOpenConnection((prev) => ({ ...prev, openPopUp: true }));
@@ -42,6 +43,7 @@ const ChatContent: React.FC<ChatProps> = ({ chatMessages }) => {
4243
password: atob(atob(encodedPassword)),
4344
database,
4445
port,
46+
email: email ?? '',
4547
};
4648
setShowBackButton();
4749
setUserCredentials(credentialsForAPI);

frontend/src/components/ChatBot/Chatbot.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ import {
2323
ExtendedRelationship,
2424
Messages,
2525
ResponseMode,
26-
UserCredentials,
2726
metricstate,
2827
multimodelmetric,
2928
nodeDetailsProps,
3029
} from '../../types';
31-
import { useCredentials } from '../../context/UserCredentials';
3230
import { chatBotAPI } from '../../services/QnaAPI';
3331
import { v4 as uuidv4 } from 'uuid';
3432
import { useFileContext } from '../../context/UsersFiles';
@@ -63,7 +61,6 @@ const Chatbot: FC<ChatbotProps> = (props) => {
6361
} = props;
6462
const [inputMessage, setInputMessage] = useState('');
6563
const [loading, setLoading] = useState<boolean>(isLoading);
66-
const { userCredentials } = useCredentials();
6764
const { model, chatModes, selectedRows, filesData } = useFileContext();
6865
const messagesEndRef = useRef<HTMLDivElement>(null);
6966
const [showInfoModal, setShowInfoModal] = useState<boolean>(false);
@@ -215,7 +212,6 @@ const Chatbot: FC<ChatbotProps> = (props) => {
215212
try {
216213
const apiCalls = chatModes.map((mode) =>
217214
chatBotAPI(
218-
userCredentials as UserCredentials,
219215
inputMessage,
220216
sessionId,
221217
model,

frontend/src/components/ChatBot/ChunkInfo.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FC, useContext, useState } from 'react';
2-
import { ChunkProps, UserCredentials } from '../../types';
2+
import { ChunkProps } from '../../types';
33
import { LoadingSpinner, TextLink, Typography } from '@neo4j-ndl/react';
44
import { DocumentTextIconOutline, GlobeAltIconOutline } from '@neo4j-ndl/react/icons';
55
import wikipedialogo from '../../assets/images/wikipedia.svg';
@@ -10,13 +10,11 @@ import ReactMarkdown from 'react-markdown';
1010
import { generateYouTubeLink, getLogo, isAllowedHost } from '../../utils/Utils';
1111
import { ThemeWrapperContext } from '../../context/ThemeWrapper';
1212
import { chatModeLables } from '../../utils/Constants';
13-
import { useCredentials } from '../../context/UserCredentials';
1413
import GraphViewModal from '../Graph/GraphViewModal';
1514
import { handleGraphNodeClick } from './chatInfo';
1615

1716
const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
1817
const themeUtils = useContext(ThemeWrapperContext);
19-
const { userCredentials } = useCredentials();
2018
const [neoNodes, setNeoNodes] = useState<any[]>([]);
2119
const [neoRels, setNeoRels] = useState<any[]>([]);
2220
const [openGraphView, setOpenGraphView] = useState(false);
@@ -25,7 +23,6 @@ const ChunkInfo: FC<ChunkProps> = ({ loading, chunks, mode }) => {
2523

2624
const handleChunkClick = (elementId: string, viewMode: string) => {
2725
handleGraphNodeClick(
28-
userCredentials as UserCredentials,
2926
elementId,
3027
viewMode,
3128
setNeoNodes,

0 commit comments

Comments
 (0)