-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added evaluation error modal component
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
agenta-web/src/components/pages/evaluations/EvaluationErrorModal/EvaluationErrorModal.tsx
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,61 @@ | ||
import {JSSTheme} from "@/lib/Types" | ||
import {ExclamationCircleOutlined} from "@ant-design/icons" | ||
import {Modal, Typography} from "antd" | ||
import React from "react" | ||
import {createUseStyles} from "react-jss" | ||
|
||
interface EvaluationErrorModalProps { | ||
isErrorModalOpen: boolean | ||
setIsErrorModalOpen: (value: React.SetStateAction<boolean>) => void | ||
modalErrorMsg: { | ||
message: string | ||
stackTrace: string | ||
} | ||
} | ||
|
||
const useStyles = createUseStyles((theme: JSSTheme) => ({ | ||
errModalStackTrace: { | ||
"& code": { | ||
display: "block", | ||
}, | ||
}, | ||
})) | ||
|
||
const EvaluationErrorModal = ({ | ||
isErrorModalOpen, | ||
setIsErrorModalOpen, | ||
modalErrorMsg, | ||
}: EvaluationErrorModalProps) => { | ||
const classes = useStyles() | ||
|
||
return ( | ||
<Modal | ||
open={isErrorModalOpen} | ||
footer={null} | ||
destroyOnClose | ||
title={ | ||
<> | ||
<ExclamationCircleOutlined className="text-red-500 mr-2 mb-3" /> | ||
Error | ||
</> | ||
} | ||
onCancel={() => setIsErrorModalOpen(false)} | ||
> | ||
<Typography.Paragraph> | ||
Failed to invoke the LLM application with the following exception: | ||
</Typography.Paragraph> | ||
{modalErrorMsg.message && ( | ||
<Typography.Paragraph type="danger" strong> | ||
{modalErrorMsg.message} | ||
</Typography.Paragraph> | ||
)} | ||
{modalErrorMsg.stackTrace && ( | ||
<Typography.Paragraph code className={classes.errModalStackTrace}> | ||
{modalErrorMsg.stackTrace} | ||
</Typography.Paragraph> | ||
)} | ||
</Modal> | ||
) | ||
} | ||
|
||
export default EvaluationErrorModal |