Skip to content

Commit

Permalink
added evaluation error modal component
Browse files Browse the repository at this point in the history
  • Loading branch information
bekossy committed May 26, 2024
1 parent 8c363e8 commit 96f26cc
Showing 1 changed file with 61 additions and 0 deletions.
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

0 comments on commit 96f26cc

Please sign in to comment.