Skip to content

Commit

Permalink
Closing file context manager if upload is success
Browse files Browse the repository at this point in the history
  • Loading branch information
estohlmann authored Dec 3, 2024
2 parents c32c2f6 + 9394eeb commit 6dcb60b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
9 changes: 5 additions & 4 deletions lib/user-interface/react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/user-interface/react/src/components/chatbot/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ export default function Chat ({ sessionId }) {
new LisaChatMessage({
type: 'ai',
content: result,
metadata: metadata,
metadata: useRag ? { ...metadata, ...prev.history[prev.history.length - 1].metadata } : metadata,
}),
),
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ export function ContextUploadModal ({
<SpaceBetween direction='horizontal' size='xs'>
<Button
onClick={async () => {
await handleUpload(selectedFiles, handleError, processFile, [FileTypes.TEXT], 10240);
const successfulUploads = await handleUpload(selectedFiles, handleError, processFile, [FileTypes.TEXT], 10240);
if (successfulUploads.length > 0) {
notificationService.generateNotification(`Successfully added file(s) to context ${successfulUploads.join(', ')}`, StatusTypes.SUCCESS);
setShowContextUploadModal(false);
}
}}
disabled={selectedFiles.length === 0}
>
Expand Down

0 comments on commit 6dcb60b

Please sign in to comment.