Skip to content

Commit 5ced0b7

Browse files
added the suggested class and css changes
1 parent 6db082c commit 5ced0b7

File tree

3 files changed

+39
-47
lines changed

3 files changed

+39
-47
lines changed

frontend/src/App.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
padding-block: 5px !important;
8686
}
8787
.ndl-drawer .ndl-drawer-close-button {
88-
background-color: rgb(245 246 246 / 1);
88+
background-color: rgb(var(--theme-palette-neutral-bg-strong));
8989
width: 40px !important;
9090
height: 40px !important;
9191
right: 10px !important;

frontend/src/components/Chatbot.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ export default function Chatbot(props: ChatbotProps) {
6565

6666
return (
6767
<div className='n-bg-palette-neutral-bg-weak flex flex-col justify-between min-h-full max-h-full overflow-hidden w-[312px]'>
68-
<div className='flex overflow-y-auto pb-12 min-w-full' style={{scrollbarWidth:"thin"}}>
68+
<div className='flex overflow-y-auto pb-12 min-w-full' style={{scrollbarWidth:"thin",overflowX:"hidden"}}>
6969
<Widget className='n-bg-palette-neutral-bg-weak' header='' isElevated={false}>
70-
<div className='flex flex-col gap-4 p-3'>
70+
<div className='flex flex-col gap-4 gap-y-4'>
7171
{listMessages.map((chat) => (
7272
<div
7373
ref={messagesEndRef}
@@ -125,7 +125,7 @@ export default function Chatbot(props: ChatbotProps) {
125125
</div>
126126
</Widget>
127127
</div>
128-
<div className='n-bg-palette-neutral-bg-default flex gap-2.5 bottom-0 p-2.5 w-full'>
128+
<div className='n-bg-palette-neutral-bg-weak flex gap-2.5 bottom-0 p-2.5 w-full'>
129129
<form onSubmit={handleSubmit} className='flex gap-2.5 w-full'>
130130
<TextInput
131131
className='n-bg-palette-neutral-bg-default flex-grow-7 w-full'

frontend/src/components/Content.tsx

Lines changed: 35 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ const Content: React.FC<ContentProps> = ({ isExpanded, showChatBot, openChatBot
5858

5959
const extractData = async (file: File, uid: number) => {
6060
if (filesData[uid]?.status == 'New') {
61-
const apirequests = [];
6261
try {
6362
setFilesData((prevfiles) =>
6463
prevfiles.map((curfile, idx) => {
@@ -81,47 +80,40 @@ const Content: React.FC<ContentProps> = ({ isExpanded, showChatBot, openChatBot
8180
filesData[uid].max_sources,
8281
filesData[uid].wiki_query ?? ''
8382
);
84-
apirequests.push(apiResponse);
85-
const results = await Promise.allSettled(apirequests);
86-
results.forEach(async (apiRes) => {
87-
if (apiRes.status === 'fulfilled' && apiRes.value) {
88-
if (apiRes?.value?.status === 'Failed') {
89-
console.log('Error', apiRes?.value);
90-
setShowAlert(true);
91-
setErrorMessage(apiRes?.value?.message);
92-
setFilesData((prevfiles) =>
93-
prevfiles.map((curfile, idx) => {
94-
if (idx == uid) {
95-
return {
96-
...curfile,
97-
status: 'Failed',
98-
};
99-
}
100-
return curfile;
101-
})
102-
);
103-
throw new Error(apiRes?.value?.message);
104-
} else {
105-
setFilesData((prevfiles) => {
106-
return prevfiles.map((curfile, idx) => {
107-
if (idx == uid) {
108-
const apiResponse = apiRes?.value?.data;
109-
return {
110-
...curfile,
111-
processing: apiResponse?.processingTime?.toFixed(2),
112-
status: apiResponse?.status,
113-
NodesCount: apiResponse?.nodeCount,
114-
relationshipCount: apiResponse?.relationshipCount,
115-
model: apiResponse?.model,
116-
};
117-
}
118-
return curfile;
119-
});
120-
});
121-
}
122-
}
123-
});
124-
83+
84+
if (apiResponse.data?.status === 'Failed') {
85+
setShowAlert(true);
86+
setErrorMessage(apiResponse?.data?.message);
87+
setFilesData((prevfiles) =>
88+
prevfiles.map((curfile, idx) => {
89+
if (idx == uid) {
90+
return {
91+
...curfile,
92+
status: 'Failed',
93+
};
94+
}
95+
return curfile;
96+
})
97+
);
98+
throw new Error(apiResponse?.data?.message);
99+
} else {
100+
setFilesData((prevfiles) => {
101+
return prevfiles.map((curfile, idx) => {
102+
if (idx == uid) {
103+
const apiRes = apiResponse?.data;
104+
return {
105+
...curfile,
106+
processing: apiRes?.processingTime?.toFixed(2),
107+
status: apiRes?.status,
108+
NodesCount: apiRes?.nodeCount,
109+
relationshipCount: apiRes?.relationshipCount,
110+
model: apiRes?.model,
111+
};
112+
}
113+
return curfile;
114+
});
115+
});
116+
}
125117
} catch (err: any) {
126118
console.log(err);
127119
setShowAlert(true);
@@ -144,7 +136,7 @@ const Content: React.FC<ContentProps> = ({ isExpanded, showChatBot, openChatBot
144136
const handleGenerateGraph = () => {
145137
if (files.length > 0) {
146138
for (let i = 0; i < files.length; i++) {
147-
if (filesData[i].status === 'New') {
139+
if (filesData[i]?.status === 'New') {
148140
extractData(files[i], i);
149141
}
150142
}

0 commit comments

Comments
 (0)