forked from jupyterlab/jupyter-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error handling and messaging when the chat service doesn't work (jupy…
…terlab#88) * WIP: fix missing env * Added error handling when chat provider key is missing
- Loading branch information
Showing
6 changed files
with
63 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react'; | ||
import { ReactWidget } from '@jupyterlab/apputils'; | ||
|
||
import { chatIcon } from '../icons'; | ||
import { Alert, Box } from '@mui/material'; | ||
import { JlThemeProvider } from '../components/jl-theme-provider'; | ||
|
||
export function buildErrorWidget() { | ||
const ErrorWidget = ReactWidget.create( | ||
<JlThemeProvider> | ||
<Box | ||
sx={{ | ||
width: '100%', | ||
height: '100%', | ||
boxSizing: 'border-box', | ||
background: 'var(--jp-layout-color0)', | ||
display: 'flex', | ||
flexDirection: 'column' | ||
}} | ||
> | ||
<Box sx={{ padding: 4 }}> | ||
<Alert severity="error"> | ||
There seems to be a problem with the Chat backend, please look at the | ||
JupyterLab server logs or contact your administrator to correct this | ||
problem. | ||
</Alert> | ||
</Box> | ||
</Box> | ||
</JlThemeProvider> | ||
); | ||
ErrorWidget.id = 'jupyter-ai::chat'; | ||
ErrorWidget.title.icon = chatIcon; | ||
ErrorWidget.title.caption = 'Jupyter AI Chat'; // TODO: i18n | ||
|
||
return ErrorWidget | ||
} | ||
|