Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Fix deploy error handling
Tomas Valentafddfec51c2cb
diff --git a/components/DeployAgent.tsx b/components/DeployAgent.tsxindex 943ae010c..72861a5e9 100644--- a/components/DeployAgent.tsx+++ b/components/DeployAgent.tsx@@ -7,6 +7,7 @@ import {import InstructionsEditor from 'components/InstructionsEditor'import { RepoSetup } from 'utils/repoSetup'import SpinnerIcon from 'components/Spinner'+import AlertError from './AlertError'export interface Props {selectedRepo: RepoSetup;@@ -43,7 +44,12 @@ function DeployAgent({<span className="text-gray-300">Deploying...</span></div>)}-+ {!isDeploying && error && (+ <AlertError+ title="Deploy failed"+ infoItems={[error]}+ />+ )}{!isDeploying && (<>{/* OpenAI Key */}@@ -128,10 +134,9 @@ function DeployAgent({</div></>)}-</div></div>)}-export default DeployAgent\ No newline at end of file+export default DeployAgentdiff --git a/github/pullRequest.ts b/github/pullRequest.tsindex baf3ec643..bad51f34c 100644--- a/github/pullRequest.ts+++ b/github/pullRequest.ts@@ -27,10 +27,10 @@ export async function prTitleFromInstructions(instructions: string, openAIKey?:return result.data.choices[0].message?.content} catch (error: any) {if (error.response) {- console.log(error.response.status)- console.log(error.response.data)+ console.log(error.response)+ throw new Error(error.response.data.error.message)} else {- console.log(error.message)+ throw new Error(error.message)}}}diff --git a/pages/agent/smol-developer/setup.tsx b/pages/agent/smol-developer/setup.tsxindex cbfc599e5..b7178a10e 100644--- a/pages/agent/smol-developer/setup.tsx+++ b/pages/agent/smol-developer/setup.tsx@@ -112,6 +112,7 @@ function Setup() {const [isDeploying, setIsDeploying] = useState(false)const [selectedOpenAIKeyType, setSelectedOpenAIKeyType] = useState('e2b')const [userOpenAIKey, setUserOpenAIKey] = useState('')+ const [errorMessage, setErrorMessage] = useState('')const handleMessageEvent = useCallback((event: MessageEvent) => {if (event.data.accessToken) {@@ -135,7 +136,7 @@ function Setup() {console.error('No instructions provided')return}-+ setErrorMessage('')try {setIsDeploying(true)const response = await createAgent({@@ -160,7 +161,10 @@ function Setup() {// Redirect to the dashboard.if (response) {if ((response as any).statusCode === 500) {- throw new Error((response as any).message)+ console.log('Error response', response)+ setErrorMessage((response as any).message)+ setIsDeploying(false)+ return}router.push({@@ -172,7 +176,7 @@ function Setup() {} else {console.error('No response from agent creation')}- } catch (error) {+ } catch (error: any) {setIsDeploying(false)}}@@ -271,6 +275,7 @@ function Setup() {setCurrentStepIdx(0)posthog?.capture('returned to repository selection step')}}+ error={errorMessage}onChangeTemplate={() => {setCurrentStepIdx(1)posthog?.capture('returned to the instructions step')