Skip to content

Commit 5f1e8fa

Browse files
format fixes
1 parent 6639f6d commit 5f1e8fa

File tree

5 files changed

+36
-27
lines changed

5 files changed

+36
-27
lines changed

frontend/src/components/ConnectionModal.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,22 @@ interface ConnectionModalProps {
1717
}
1818

1919
export default function ConnectionModal({ open, setOpenConnection, setConnectionStatus }: ConnectionModalProps) {
20-
2120
let prefilledconnection = localStorage.getItem('neo4j.connection');
2221
let initialuri;
2322
let initialdb;
2423
let initialusername;
2524
let initialport;
2625
let initialprotocol;
2726
if (prefilledconnection) {
28-
let parsedcontent = JSON.parse(prefilledconnection)
29-
let urisplit = parsedcontent?.uri?.split("://")
27+
let parsedcontent = JSON.parse(prefilledconnection);
28+
let urisplit = parsedcontent?.uri?.split('://');
3029
initialuri = urisplit[1];
3130
initialdb = parsedcontent?.database;
32-
initialusername = parsedcontent?.user
33-
initialport = initialuri.split(":")[1]
34-
initialprotocol = urisplit[0]
31+
initialusername = parsedcontent?.user;
32+
initialport = initialuri.split(':')[1];
33+
initialprotocol = urisplit[0];
3534
}
36-
35+
3736
const protocols = ['neo4j', 'neo4j+s', 'neo4j+ssc', 'bolt', 'bolt+s', 'bolt+ssc'];
3837
const [protocol, setProtocol] = useState<string>(initialprotocol ?? 'neo4j+s');
3938
const [URI, setURI] = useState<string>(initialuri ?? '');

frontend/src/components/Content.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const Content: React.FC<ContentProps> = ({ isExpanded, showChatBot, openChatBot
2525
const [showAlert, setShowAlert] = useState<boolean>(false);
2626
const [viewPoint, setViewPoint] = useState<'tableView' | 'showGraphView'>('tableView');
2727

28-
2928
useEffect(() => {
3029
if (!init) {
3130
let session = localStorage.getItem('neo4j.connection');
@@ -37,16 +36,19 @@ const Content: React.FC<ContentProps> = ({ isExpanded, showChatBot, openChatBot
3736
password: neo4jConnection.password,
3837
database: neo4jConnection.database,
3938
});
40-
initialiseDriver(neo4jConnection.uri, neo4jConnection.user, neo4jConnection.password, neo4jConnection.database).then(
41-
(driver: Driver) => {
42-
if (driver) {
43-
setConnectionStatus(true);
44-
setDriver(driver);
45-
} else {
46-
setConnectionStatus(false);
47-
}
39+
initialiseDriver(
40+
neo4jConnection.uri,
41+
neo4jConnection.user,
42+
neo4jConnection.password,
43+
neo4jConnection.database
44+
).then((driver: Driver) => {
45+
if (driver) {
46+
setConnectionStatus(true);
47+
setDriver(driver);
48+
} else {
49+
setConnectionStatus(false);
4850
}
49-
);
51+
});
5052
} else {
5153
setOpenConnection(true);
5254
}
@@ -189,8 +191,9 @@ const Content: React.FC<ContentProps> = ({ isExpanded, showChatBot, openChatBot
189191

190192
const handleOpenGraphClick = () => {
191193
const bloomUrl = process.env.BLOOM_URL;
192-
const connectURL = `${userCredentials?.userName}@${localStorage.getItem('URI')}%3A${localStorage.getItem('port') ?? '7687'
193-
}`;
194+
const connectURL = `${userCredentials?.userName}@${localStorage.getItem('URI')}%3A${
195+
localStorage.getItem('port') ?? '7687'
196+
}`;
194197
const encodedURL = encodeURIComponent(connectURL);
195198
const replacedUrl = bloomUrl?.replace('{CONNECT_URL}', encodedURL);
196199
window.open(replacedUrl, '_blank');
@@ -200,10 +203,10 @@ const Content: React.FC<ContentProps> = ({ isExpanded, showChatBot, openChatBot
200203
isExpanded && showChatBot
201204
? 'contentWithBothDrawers'
202205
: isExpanded
203-
? 'contentWithExpansion'
204-
: showChatBot
205-
? 'contentWithChatBot'
206-
: 'contentWithNoExpansion';
206+
? 'contentWithExpansion'
207+
: showChatBot
208+
? 'contentWithChatBot'
209+
: 'contentWithNoExpansion';
207210

208211
const handleGraphView = () => {
209212
setOpenGraphView(true);

frontend/src/context/UsersFiles.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { createContext, useContext, useState, ReactNode, Dispatch, SetStateAction } from 'react';
22
import { CustomFile } from '../types';
3-
import { defaultLLM} from '../utils/Constants';
3+
import { defaultLLM } from '../utils/Constants';
44

55
interface FileContextType {
66
files: (File | null)[] | [];

frontend/src/utils/Constants.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,12 @@ export const colors = [
4040
'#a2836e',
4141
'#674d3c',
4242
];
43-
export const llms = process.env?.LLM_MODELS?.trim() != "" ? process.env.LLM_MODELS?.split(",") : ['Diffbot', 'Gemini Pro', 'OpenAI GPT 3.5', 'OpenAI GPT 4']
44-
export const defaultLLM = llms?.includes("OpenAI GPT 4") ? "OpenAI GPT 4" : llms?.includes("Gemini Pro") ? "Gemini Pro" : 'Diffbot'
43+
export const llms =
44+
process.env?.LLM_MODELS?.trim() != ''
45+
? process.env.LLM_MODELS?.split(',')
46+
: ['Diffbot', 'Gemini Pro', 'OpenAI GPT 3.5', 'OpenAI GPT 4'];
47+
export const defaultLLM = llms?.includes('OpenAI GPT 4')
48+
? 'OpenAI GPT 4'
49+
: llms?.includes('Gemini Pro')
50+
? 'Gemini Pro'
51+
: 'Diffbot';

frontend/src/utils/Driver.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import neo4j, { Driver } from 'neo4j-driver';
22

3-
export const initialiseDriver = async (connectionURI: string, username: string, password: string, database:string) => {
3+
export const initialiseDriver = async (connectionURI: string, username: string, password: string, database: string) => {
44
try {
55
const driver: Driver = neo4j.driver(connectionURI, neo4j.auth.basic(username, password));
66
const serverInfo = await driver.getServerInfo();

0 commit comments

Comments
 (0)