diff --git a/agenta-web/src/components/Playground/ViewNavigation.tsx b/agenta-web/src/components/Playground/ViewNavigation.tsx index 851525383a..de5d177ce7 100644 --- a/agenta-web/src/components/Playground/ViewNavigation.tsx +++ b/agenta-web/src/components/Playground/ViewNavigation.tsx @@ -9,6 +9,7 @@ import {useState} from "react" import axios from "axios" import {createUseStyles} from "react-jss" import { + fetchVariantLogs, getAppContainerURL, removeVariant, restartAppVariantContainer, @@ -36,6 +37,10 @@ const useStyles = createUseStyles({ restartBtnMargin: { marginRight: "10px", }, + errorLogs: { + whiteSpace: "pre-wrap", + wordBreak: "break-all", + }, }) const ViewNavigation: React.FC = ({ @@ -69,6 +74,7 @@ const ViewNavigation: React.FC = ({ const [retrying, setRetrying] = useState(false) const [isParamsCollapsed, setIsParamsCollapsed] = useState("1") const [containerURI, setContainerURI] = useState("") + const [variantErrorLogs, setVariantErrorLogs] = useState("") const [restarting, setRestarting] = useState(false) const {currentApp} = useAppsData() const retriedOnce = useRef(false) @@ -101,7 +107,15 @@ const ViewNavigation: React.FC = ({ setRetrying(false) }) } - }, [netWorkError]) + + if (isError) { + const getLogs = async () => { + const logs = await fetchVariantLogs(variant.variantId) + setVariantErrorLogs(logs) + } + getLogs() + } + }, [netWorkError, isError, variant.variantId]) if (retrying || (!retriedOnce.current && netWorkError)) { return ( @@ -115,7 +129,8 @@ const ViewNavigation: React.FC = ({ if (isError) { let variantDesignator = variant.templateVariantName - let imageName = `agentaai/${(currentApp?.app_name || "").toLowerCase()}_` + let appName = currentApp?.app_name || "" + let imageName = `agentaai/${appName.toLowerCase()}_` if (!variantDesignator || variantDesignator === "") { variantDesignator = variant.variantName @@ -165,31 +180,39 @@ const ViewNavigation: React.FC = ({

Error connecting to the variant {variant.variantName}.{" "} {(axios.isAxiosError(error) && error.response?.status === 404 && ( - Container is not running. + + Container is not running. See logs below: + )) || {error.message}}

-

To debug this issue, please follow the steps below:

    -
  • - Verify whether the API is up by checking if {apiAddress} is - accessible. -
  • -
  • - Check if the Docker container for the variant {variantDesignator} is - running. The image should be called {imageName}. -
  • + {isDemo() && ( +
    +
    {variantErrorLogs}
    +
    + )} + {!isDemo() && ( +
    +
    {variantErrorLogs}
    +
    + )}

- {" "} - In case the docker container is not running. Please check the logs from - docker to understand the issue. Most of the time it is a missing - requirements. Also, please attempt restarting it (using cli or docker - desktop) + Verify API accessibility at{" "} + + {apiAddress} +

{" "} - If the issue persists please file an issue in github here: - https://github.com/Agenta-AI/agenta/issues/new?title=Issue%20in%20ViewNavigation.tsx + If the issue persists please file an issue in github + + {" "} + here +