Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Inform user about missing keys in the agent tab

Tomas Valenta8baf7010c65c
diff --git a/components/Editor/Sidebar/Agent/index.tsx b/components/Editor/Sidebar/Agent/index.tsx
index 082b86bb5..bef54ed2a 100644
--- a/components/Editor/Sidebar/Agent/index.tsx
+++ b/components/Editor/Sidebar/Agent/index.tsx
@@ -2,6 +2,7 @@ import { useState } from 'react'
import { deployment_state, deployments } from '@prisma/client'
import produce from 'immer'
import { useSupabaseClient } from '@supabase/auth-helpers-react'
+import { useRouter } from 'next/router'
import Text from 'components/Text'
import { useTabs } from 'components/Tabs/useTabs'
@@ -12,6 +13,7 @@ import { deploymentsTable } from 'db/tables'
import useModelProviderCreds from 'hooks/useModelProviderCreds'
import { getMissingCreds } from 'state/model'
import { useStateStore } from 'state/StoreProvider'
+import Button from 'components/Button'
import LogStream from './LogStream'
import RunButton from '../RunButton'
@@ -47,6 +49,7 @@ function Agent({
const client = useSupabaseClient<Database>()
const tabsCss = useTabs(tabsProps)
const [selector] = useStateStore()
+ const router = useRouter()
const [creds,] = useModelProviderCreds()
const model = selector.use.model()
@@ -80,49 +83,59 @@ function Agent({
<div className="
flex
items-center
- justify-between
border-b
py-2
pr-4
+ justify-between
">
- <Text
- text="Agent"
- size={Text.size.S2}
- className="
+ <div className="
+ flex
+ space-x-2
+ ">
+ <Text
+ text="Agent"
+ size={Text.size.S2}
+ className="
uppercase
text-slate-400
font-semibold
- px-4
- "
- />
-
- {process.env.NODE_ENV === 'development' && (
- <Tabs
- {...tabsCss.tabProps}
- selectedTabIndex={selectedTab}
- setSelectedTab={setSelectedTab}
+ pl-4
+ "
/>
- )}
+
+ {process.env.NODE_ENV === 'development' && (
+ <Tabs
+ {...tabsCss.tabProps}
+ selectedTabIndex={selectedTab}
+ setSelectedTab={setSelectedTab}
+ />
+ )}
+ </div>
<div className="
flex
space-x-2
"
>
{missingCreds.length > 0 &&
- <Text
- text={`Missing key "${missingCreds[0][1].label || missingCreds[0][0]}"`}
- size={Text.size.S3}
- className="text-red-400"
- />
+ <>
+ <Text
+ text={`Missing key "${missingCreds[0][1].label || missingCreds[0][0]}"`}
+ size={Text.size.S3}
+ className="text-red-400"
+ />
+ <Button
+ text="Set keys"
+ onClick={() => router.push('/settings')}
+ />
+ </>
}
- {<RunButton
+ <RunButton
disabled={missingCreds.length !== 0}
deploy={deploy}
isDeployRequestRunning={isDeployRequestRunning}
isInitializingDeploy={isInitializingDeploy}
deployStatus={deployment?.state}
/>
- }
</div>
</div>
{!deployment &&
diff --git a/components/Tabs/index.tsx b/components/Tabs/index.tsx
index 9aec9f641..7620e6556 100644
--- a/components/Tabs/index.tsx
+++ b/components/Tabs/index.tsx
@@ -121,7 +121,7 @@ function Tab({
select-none
transition-colors
border-green-800
- px-2
+ px-1
`,
{
'text-slate-400': hoveredTabIndex !== i && selectedTabIndex !== i,
@@ -150,17 +150,6 @@ function Tab({
"
style={hoverStyles}
/>
- {/* <div
- className="
- absolute
- z-10
- bottom-0
- left-0
- h-0.5
- bg-green-800
- "
- style={selectStyles}
- /> */}
</nav>
)
}
diff --git a/pages/index.tsx b/pages/index.tsx
index b12c66a05..0ec2c679b 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -130,6 +130,7 @@ function Home({ projects }: Props) {
await deleteProject({ id })
router.replace(router.asPath)
}
+
return (
<div
className="
diff --git a/pages/new.tsx b/pages/new.tsx
index 4bd2fd94b..7c797c499 100644
--- a/pages/new.tsx
+++ b/pages/new.tsx
@@ -42,7 +42,6 @@ const reducer: Reducer<CreationState, CreationEvent> = (state, event) => {
return state
}
-
async function handlePostProject(url: string, { arg }: { arg: PostProjectBody }) {
return await fetch(url, {
method: 'POST',
diff --git a/pages/settings.tsx b/pages/settings.tsx
index 3528f36dd..fc22441ee 100644
--- a/pages/settings.tsx
+++ b/pages/settings.tsx
@@ -36,16 +36,15 @@ interface Props { }
function Settings({ }: Props) {
const user = useUser()
const router = useRouter()
-
const supabaseClient = useSupabaseClient<Database>()
+ const [creds, mergeCreds] = useModelProviderCreds()
+
async function handleSignOut() {
await supabaseClient.auth.signOut()
router.push('/')
}
- const [creds, mergeCreds] = useModelProviderCreds()
-
return (
<div
className="