Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Fix merge problems

Tomas Valenta1898ce0d0613
diff --git a/components/Repos.tsx b/components/Repos.tsx
deleted file mode 100644
index 0f3bf0e8a..000000000
--- a/components/Repos.tsx
+++ /dev/null
@@ -1,220 +0,0 @@
-import React, { useCallback, useMemo, useState } from 'react'
-import { GithubIcon, SearchIcon } from 'lucide-react'
-import clsx from 'clsx'
-import Fuse from 'fuse.js'
-
-import useListenOnMessage from 'hooks/useListenOnMessage'
-import Button from 'components/Button'
-import Text from 'components/Text'
-import { useGitHubClient } from 'hooks/useGitHubClient'
-import { useRepositories } from 'hooks/useRepositories'
-
-import { openPopupModal } from 'utils/popupModal'
-import TitleButton from 'components/TitleButton'
-import Input from 'components/Input'
-import SpinnerIcon from 'components/Spinner'
-import { useLocalStorage } from 'hooks/useLocalStorage'
-import { createRepo, parseRepoName } from 'github/repo'
-
-export interface RepoSetup {
- fullName: string
- repositoryID: number
- installationID: number
- defaultBranch: string
- branches?: string[]
- url: string
- owner: string
- repo: string
-}
-
-export interface Props {
- onRepoSelection: (repoSetup: RepoSetup) => void
-}
-
-function Repos({ onRepoSelection }: Props) {
- const [accessToken, setAccessToken] = useLocalStorage<string | undefined>('gh_access_token', undefined)
- const gitHub = useGitHubClient(accessToken)
- const { repos, refetch } = useRepositories(gitHub)
- const [query, setQuery] = useState<string>()
-
-
- async function createEmptyRepository(name: string) {
- if (!gitHub) return
-
- await createRepo({ client: gitHub, name })
- // When we refresh the list of repos now the new repo will be there
- // if we gave the GH App permissions to access all the personal repos or repos for the org
-
- refetch()
- }
-
- const searchEngine = useMemo(() => repos ?
- new Fuse(repos, {
- keys: ['full_name'],
- threshold: 0.4,
- }) : undefined
- , [repos])
-
- const filteredRepos = query && searchEngine ? searchEngine.search(query).map(i => i.item) : repos || []
-
- const handleMessageEvent = useCallback((event: MessageEvent) => {
- if (event.data.accessToken) {
- setAccessToken(event.data.accessToken)
- } else if (event.data.installationID) {
- refetch()
- }
- }, [refetch, setAccessToken])
- useListenOnMessage(handleMessageEvent)
-
- async function selectRepository(r: Omit<RepoSetup, 'branches' | 'owner' | 'repo'>) {
- const { owner, repo } = parseRepoName(r.fullName)
-
- onRepoSelection({
- ...r,
- branches: [r.defaultBranch],
- owner,
- repo,
- })
-
- const [repositoryOwnerName, repositoryName] = r.fullName.split('/')
- const repoBranches = await gitHub?.repos.listBranches({
- owner: repositoryOwnerName,
- repo: repositoryName,
- })
-
- const branches = repoBranches?.data.map(b => b.name)
- onRepoSelection({
- ...r,
- branches,
- owner,
- repo,
- })
- }
-
- async function signWithGitHubOAuth() {
- const url = new URL('/login/oauth/authorize', 'https://github.com')
- url.searchParams.set('client_id', process.env.NEXT_PUBLIC_GITHUB_CLIENT_ID!)
- openPopupModal(url)
- }
-
- function configureGitHubApp() {
- const url = new URL('https://github.com/apps/e2b-for-github/installations/new')
- openPopupModal(url)
- }
-
- return (
- <div className="flex flex-1 flex-col space-y-2 overflow-hidden">
- <div className={clsx(`
- border
- overflow-hidden
- rounded
- flex
- flex-col
- flex-1`,
- { 'bg-white': accessToken },
- )}>
- {!accessToken &&
- <div className="flex flex-1 justify-center items-center">
- <Button
- variant={Button.variant.Full}
- onClick={configureGitHubApp}
- text="Add GitHub Repository"
- icon={<GithubIcon />}
- />
- </div>
- }
-
- {accessToken &&
- <div className="flex overflow-hidden flex-col flex-1">
- <div className="flex items-center space-x-2 border-b px-8 py-4">
- <SearchIcon size="16px" />
- <Input
- placeholder="Search repositories..."
- value={query}
- onChange={q => setQuery(q)}
- autofocus
- />
- </div>
-
-
- {!repos &&
- <div className="flex flex-1 items-center justify-center flex-col space-y-1 text-slate-500">
- <SpinnerIcon className="text-slate-400" />
- <Text text="Fetching repositories" />
- </div>
- }
-
- {repos && repos.length === 0 &&
- <div className="flex flex-1 items-center justify-center flex-col space-y-1">
- <Text text="No connected repositories found" />
- <Button
- variant={Button.variant.Full}
- onClick={configureGitHubApp}
- text="Configure permissions"
- icon={<GithubIcon />}
- />
- </div>
- }
-
- {repos && repos.length > 0 &&
- <div className="
- flex
- flex-col
- scroller
- overflow-auto
- pl-8
- flex-1
- pr-6
- ">
- {filteredRepos.map(r => (
- <div
- className={clsx(
- 'flex',
- 'justify-between',
- 'py-4',
- 'border-b',
- )}
- key={r.id}
- >
- <div className="flex items-center space-x-2">
- <GithubIcon size="16px" />
- <Text text={r.full_name} className="" />
- </div>
- <Button
- onClick={() => selectRepository({
- defaultBranch: r.default_branch,
- installationID: r.installation_id,
- repositoryID: r.id,
- fullName: r.full_name,
- url: r.html_url,
- })}
- text="Select"
- />
- </div>
- ))}
- </div>
- }
- </div>
- }
- </div>
- {<Button
- onClick={() => createEmptyRepository('test')}
- text="Create Empty Repository"
- />}
- {accessToken &&
- <div className="flex justify-between">
- <TitleButton
- onClick={signWithGitHubOAuth}
- text="Reauthenticate GitHub Account"
- />
- <TitleButton
- onClick={configureGitHubApp}
- text="Configure GitHub App"
- />
- </div>
- }
- </div>
- )
-}
-
-export default Repos
diff --git a/components/SelectRepository/ExistingRepositories/RepositoriesList.tsx b/components/SelectRepository/ExistingRepositories/RepositoriesList.tsx
index 4eef18c83..12ae9660f 100644
--- a/components/SelectRepository/ExistingRepositories/RepositoriesList.tsx
+++ b/components/SelectRepository/ExistingRepositories/RepositoriesList.tsx
@@ -1,10 +1,11 @@
import {
Github,
} from 'lucide-react'
+import { Repos, RepoSetup } from '../RepoSetup'
export interface Props {
- repos: any[]
- onRepoSelection: (repo: any) => void
+ repos: Repos
+ onRepoSelection: (repo: RepoSetup) => void
}
function RepositoriesList({
@@ -13,7 +14,7 @@ function RepositoriesList({
}: Props) {
return (
<ul role="list" className="w-full overflow-auto divide-y divide-gray-700">
- {repos.map((r) => (
+ {repos?.map((r) => (
<li key={r.id} className="px-2 flex items-center justify-between h-[60px]">
<div className="flex flex-col items-start justify-start">
<div className="flex items-center space-x-1">
@@ -29,7 +30,15 @@ function RepositoriesList({
<button
type="button"
className="rounded bg-white/10 px-2 py-1 text-sm font-medium text-white shadow-sm hover:bg-white/20"
- onClick={() => onRepoSelection(r)}
+ onClick={() => onRepoSelection({
+ installationID: r.installation_id,
+ defaultBranch: r.default_branch,
+ fullName: r.full_name,
+ owner: r.owner.login,
+ repo: r.name,
+ repositoryID: r.id,
+ url: r.url,
+ })}
>
Select
</button>
diff --git a/components/SelectRepository/ExistingRepositories/index.tsx b/components/SelectRepository/ExistingRepositories/index.tsx
index 1f4f03685..89eb1910f 100644
--- a/components/SelectRepository/ExistingRepositories/index.tsx
+++ b/components/SelectRepository/ExistingRepositories/index.tsx
@@ -2,12 +2,13 @@ import clsx from 'clsx'
import ConfigureGitHubButton from 'components/ConfigureGitHubButton'
import SpinnerIcon from 'components/Spinner'
import RepositoriesList from './RepositoriesList'
+import { RepoSetup, Repos } from '../RepoSetup'
export interface Props {
accessToken?: string
- repos?: any[]
+ repos?: Repos
onConfigureGitHubAppClick: (e: any) => void
- onRepoSelection: (repo: any) => void
+ onRepoSelection: (repo: RepoSetup) => void
}
function ExistingRepositories({
@@ -47,7 +48,7 @@ function ExistingRepositories({
)}
{repos && repos.length > 0 && (
<RepositoriesList
- repos={repos.sort((a, b) => (new Date(b.updated_at) as any) - (new Date(a.updated_at) as any))}
+ repos={repos.sort((a, b) => (new Date(b.updated_at || b.created_at!) as any) - (new Date(a.updated_at || b.created_at!) as any))}
onRepoSelection={onRepoSelection}
/>
)}
diff --git a/components/SelectRepository/NewRepository/index.tsx b/components/SelectRepository/NewRepository/index.tsx
index 06ce3834f..4db6f4616 100644
--- a/components/SelectRepository/NewRepository/index.tsx
+++ b/components/SelectRepository/NewRepository/index.tsx
@@ -21,12 +21,13 @@ import {
creationReducer,
ActionType,
} from './newRepoState'
+import { RepoSetup } from '../RepoSetup'
export interface Props {
accessToken?: string
accounts: GitHubAccount[]
onConfigureGitHubAppClick: (e: any) => void
- onRepoSelection: (repo: any) => void
+ onRepoSelection: (repo: RepoSetup) => void
}
function NewRepository({
@@ -57,7 +58,16 @@ function NewRepository({
name: state.name,
})
dispatch({ type: ActionType.Success, payload: {} })
- onRepoSelection(newRepo)
+
+ onRepoSelection({
+ fullName: newRepo.full_name,
+ defaultBranch: newRepo.default_branch,
+ repositoryID: newRepo.id,
+ owner: newRepo.owner.login,
+ installationID: state.account.installationID,
+ repo: newRepo.name,
+ url: newRepo.url,
+ })
} catch (err: any) {
console.error('Error creating repository', err)
dispatch({ type: ActionType.Fail, payload: { error: err } })
diff --git a/components/SelectRepository/NewRepository/newRepoState.ts b/components/SelectRepository/NewRepository/newRepoState.ts
index 1422f8ec0..e4f0ff109 100644
--- a/components/SelectRepository/NewRepository/newRepoState.ts
+++ b/components/SelectRepository/NewRepository/newRepoState.ts
@@ -1,4 +1,4 @@
-import { GitHubAccount } from './RepoAccountSelect'
+import { GitHubAccount } from 'utils/github'
export enum ActionType {
Initial,
@@ -117,4 +117,3 @@ export function creationReducer(state: State, action: Action) {
return state
}
}
-
diff --git a/components/SelectRepository/RepoSetup.tsx b/components/SelectRepository/RepoSetup.tsx
new file mode 100644
index 000000000..6657217ca
--- /dev/null
+++ b/components/SelectRepository/RepoSetup.tsx
@@ -0,0 +1,14 @@
+import { useRepositories } from 'hooks/useRepositories'
+
+export interface RepoSetup {
+ fullName: string
+ repositoryID: number
+ installationID: number
+ defaultBranch: string
+ branches?: string[]
+ url: string
+ owner: string
+ repo: string
+}
+
+export type Repos = ReturnType<typeof useRepositories>['repos']
diff --git a/components/SelectRepository/index.tsx b/components/SelectRepository/index.tsx
index 4338a3600..e0858a8d4 100644
--- a/components/SelectRepository/index.tsx
+++ b/components/SelectRepository/index.tsx
@@ -14,14 +14,15 @@ import {
} from 'utils/github'
import SpinnerIcon from 'components/Spinner'
+import { RepoSetup, Repos } from './RepoSetup'
import RepoSwitch from './RepoSwitch'
import ExistingRepositories from './ExistingRepositories'
import NewRepository from './NewRepository'
export interface Props {
- repos?: any[]
+ repos?: Repos
accessToken?: string
- onRepoSelection: (repo: any) => void
+ onRepoSelection: (repo: RepoSetup) => void
githubAccounts: GitHubAccount[]
}
diff --git a/github/repo.ts b/github/repo.ts
index e3cde7e8a..cd1b88072 100644
--- a/github/repo.ts
+++ b/github/repo.ts
@@ -1,10 +1,5 @@
import { GitHubClient } from './client'
-export function parseRepoName(fullName: string) {
- const [owner, repo] = fullName.split('/')
- return { owner, repo }
-}
-
export async function createRepo({ client, name, org, isPrivate }: {
client: GitHubClient,
name: string,
diff --git a/github/webhooks.ts b/github/webhooks.ts
index 47fa8b5f8..ff358ae07 100644
--- a/github/webhooks.ts
+++ b/github/webhooks.ts
@@ -6,7 +6,6 @@ import {
import { getDeploymentsForPR, getGHAccessToken, getPromptFromPR, triggerSmolDevAgentRun } from './pullRequest'
import { getGHInstallationClient } from './installationClient'
-import { parseRepoName } from './repo'
export async function getGitHubWebhooksMiddleware() {
const webhooks = new Webhooks({
@@ -32,7 +31,8 @@ const pullRequestEditHandler: HandlerFunction<'pull_request.edited', unknown> =
const installationID = payload.installation?.id
const repositoryID = payload.repository.id
- const { owner, repo } = parseRepoName(payload.repository.full_name)
+ const owner = payload.repository.owner.login
+ const repo = payload.repository.name
// Every PR is also an issues - GH API endpoint for issues is used for the shared functionality
const issueID = payload.pull_request.id
@@ -95,7 +95,9 @@ const issueCommentHandler: HandlerFunction<'issue_comment', unknown> = async (ev
const installationID = payload.installation?.id
const repositoryID = payload.repository.id
- const { owner, repo } = parseRepoName(payload.repository.full_name)
+
+ const owner = payload.repository.owner.login
+ const repo = payload.repository.name
// Every PR is also an issues - GH API endpoint for issues is used for the shared functionality
// This issueID is not the PR issue id though, it's the issue id of the comment
diff --git a/pages/agent/smol-developer/setup-old.tsx b/pages/agent/smol-developer/setup-old.tsx
deleted file mode 100644
index ce038cb7b..000000000
--- a/pages/agent/smol-developer/setup-old.tsx
+++ /dev/null
@@ -1,171 +0,0 @@
-import type { GetServerSideProps } from 'next'
-import { useSessionContext, useSupabaseClient } from '@supabase/auth-helpers-react'
-import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'
-import {
- useUser,
- useSession,
-} from '@supabase/auth-helpers-react'
-import useSWRMutation from 'swr/mutation'
-import { nanoid } from 'nanoid'
-import { useState } from 'react'
-
-import { serverCreds } from 'db/credentials'
-import Repos, { RepoSetup } from 'components/Repos'
-import Button from 'components/Button'
-import { getDefaultModelConfig, getModelArgs, ModelConfig } from 'state/model'
-import { TemplateID } from 'state/template'
-import { Creds } from 'hooks/useModelProviderArgs'
-
-export interface PostAgentBody {
- // ID of the installation of the GitHub App
- installationID: number
- // ID of the repository
- repositoryID: number
- // Title of the PR
- title: string
- // Default branch against which to create the PR
- defaultBranch: string
- // Initial prompt used as a body text for the PR (can be markdown)
- body: string
- // Owner of the repo (user or org)
- owner: string
- // Name of the repo
- repo: string
- // Name of the branch created for the PR
- branch: string
- // Commit message for the PR first empty commit
- commitMessage: string
- modelConfig: ModelConfig
-}
-
-export const getServerSideProps: GetServerSideProps = async (ctx) => {
- const supabase = createServerSupabaseClient(ctx, serverCreds)
- const {
- data: { session },
- } = await supabase.auth.getSession()
-
- if (!session) {
- return {
- redirect: {
- destination: '/agent/smol-developer',
- permanent: false,
- },
- }
- }
-
- return { props: {} }
-}
-
-async function handlePostAgent(url: string, { arg }: { arg: PostAgentBody }) {
- return await fetch(url, {
- method: 'POST',
- body: JSON.stringify(arg),
-
- headers: {
- 'Content-Type': 'application/json',
- },
- }).then(r => r.json())
-}
-
-function getSmolDevModelConfig(creds: Creds): ModelConfig {
- const templateID = TemplateID.SmolDeveloper
- const modelConfig = getDefaultModelConfig(templateID)
- return {
- name: modelConfig.name,
- provider: modelConfig.provider,
- args: getModelArgs(modelConfig, creds),
- prompt: [],
- }
-}
-
-function Repo() {
- const supabaseClient = useSupabaseClient()
- const user = useUser()
- const session = useSession()
- const sessionCtx = useSessionContext()
- const [selectedRepo, setSelectedRepo] = useState<RepoSetup>()
- const [initialPrompt, setInitialPrompt] = useState<string>()
- const [openAIAPIKey, setOpenAIAPIKey] = useState<string>()
-
- async function signOut() {
- await supabaseClient.auth.signOut()
- location.reload()
- }
-
- const {
- trigger: createAgent,
- } = useSWRMutation('/api/agent', handlePostAgent)
-
- async function deployAgent() {
- if (!selectedRepo) return
- if (!initialPrompt) return
- if (!openAIAPIKey) return
- console.log('selectedRepo', selectedRepo)
-
- const modelConfig = getSmolDevModelConfig({
- OpenAI: {
- creds: {
- openai_api_key: openAIAPIKey,
- },
- },
- })
-
- await createAgent({
- defaultBranch: selectedRepo.defaultBranch,
- installationID: selectedRepo.installationID,
- owner: selectedRepo.owner,
- repo: selectedRepo.repo,
- repositoryID: selectedRepo.repositoryID,
- title: 'Smol PR',
- branch: `pr/smol-dev/${nanoid(6).toLowerCase()}`,
- body: initialPrompt,
- commitMessage: 'Smol dev initial commit',
- modelConfig,
- })
- }
-
- return (
- <div
- className="
- p-8
- flex-1
- flex
- flex-col
- space-y-4
- "
- >
- <div
- className="
- max-w-xl
- w-full
- max-h-[400px]
- flex-1
- flex
- flex-col
- self-center
- justify-center
- space-y-4
- "
- >
- {!sessionCtx.isLoading && user && (
- <Button
- text="Sign out"
- onClick={signOut}
- />
- )}
- Select repo
- {user &&
- <Repos
- onRepoSelection={setSelectedRepo}
- />
- }
- </div>
- <Button
- text='Deploy Smol developer'
- onClick={deployAgent}
- />
- </div>
- )
-}
-
-export default Repo
diff --git a/pages/agent/smol-developer/setup.tsx b/pages/agent/smol-developer/setup.tsx
index 04c6b0e49..04f6cec5c 100644
--- a/pages/agent/smol-developer/setup.tsx
+++ b/pages/agent/smol-developer/setup.tsx
@@ -22,6 +22,8 @@ import { TemplateID } from 'state/template'
import { Creds } from 'hooks/useModelProviderArgs'
import { getDefaultModelConfig, getModelArgs, ModelConfig } from 'state/model'
import { GitHubAccount } from 'utils/github'
+import { nanoid } from 'nanoid'
+import { RepoSetup } from 'components/SelectRepository/RepoSetup'
export interface PostAgentBody {
// ID of the installation of the GitHub App
@@ -88,7 +90,6 @@ async function handlePostAgent(url: string, { arg }: { arg: PostAgentBody }) {
return await response.json() as PostAgentResponse
}
-
function getSmolDevModelConfig(creds: Creds): ModelConfig & { templateID: TemplateID } {
const templateID = TemplateID.SmolDeveloper
const modelConfig = getDefaultModelConfig(templateID)
@@ -107,9 +108,12 @@ function Setup() {
const github = useGitHubClient(accessToken)
const [githubAccounts, setGitHubAccounts] = useState<GitHubAccount[]>([])
const [currentStep, setCurrentStep] = useState(0)
- const [selectedRepository, setSelectedRepository] = useState<any | undefined>()
+ const [selectedRepository, setSelectedRepository] = useState<RepoSetup>()
const { repos, refetch } = useRepositories(github)
+ const initialPrompt = 'Create chrome extension'
+ const openAIAPIKey = ''
+
const handleMessageEvent = useCallback((event: MessageEvent) => {
if (event.data.accessToken) {
setAccessToken(event.data.accessToken)
@@ -123,24 +127,34 @@ function Setup() {
trigger: createAgent,
} = useSWRMutation('/api/agent', handlePostAgent)
- // async function deployAgent() {
- // if (!selectedRepo) return
- // console.log('selectedRepo', selectedRepo)
-
-
- // return
- // await createAgent({
- // defaultBranch: selectedRepo.defaultBranch,
- // installationID: selectedRepo.installationID,
- // owner: selectedRepo.owner,
- // repo: selectedRepo.repo,
- // repositoryID: selectedRepo.repositoryID,
- // title,
- // branch,
- // body,
- // commitMessage,
- // })
- // }
+ async function deployAgent() {
+ console.log('DEPLOY AGENT', selectedRepository, initialPrompt, openAIAPIKey)
+
+ if (!selectedRepository) return
+ if (!initialPrompt) return
+ if (!openAIAPIKey) return
+
+ const modelConfig = getSmolDevModelConfig({
+ OpenAI: {
+ creds: {
+ openai_api_key: openAIAPIKey,
+ },
+ },
+ })
+
+ await createAgent({
+ defaultBranch: selectedRepository.defaultBranch,
+ installationID: selectedRepository.installationID,
+ owner: selectedRepository.owner,
+ repo: selectedRepository.repo,
+ repositoryID: selectedRepository.repositoryID,
+ title: 'Smol PR',
+ branch: `pr/smol-dev/${nanoid(6).toLowerCase()}`,
+ body: initialPrompt,
+ commitMessage: 'Smol dev initial commit',
+ modelConfig,
+ })
+ }
function handleRepoSelection(repo: any) {
console.log('SELECTED REPO', repo)
@@ -169,7 +183,7 @@ function Setup() {
const ghLogin = (i.account as any)['login']
// Filter out user accounts that are not the current user (when a user has access to repos that aren't theirs)
if (ghAccType === 'User' && ghLogin !== user?.user_metadata?.user_name) return
- accounts.push({ name: ghLogin, isOrg: ghAccType === 'Organization' })
+ accounts.push({ name: ghLogin, isOrg: ghAccType === 'Organization', installationID: i.id })
}
})
setGitHubAccounts(accounts)
@@ -192,19 +206,27 @@ function Setup() {
<div className="overflow-hidden flex-1 mx-auto w-full max-w-lg flex flex-col">
<Steps steps={steps} />
<div className="h-px bg-gray-700 my-8" />
-
- {currentStep === 0 ? (
+ {currentStep === 0 && (
<SelectRepository
repos={repos}
onRepoSelection={handleRepoSelection}
accessToken={accessToken}
githubAccounts={githubAccounts}
/>
- ) : currentStep === 1 ? (
+ )}
+ {currentStep === 1 && (
<div>prompt</div>
- ) : currentStep === 2 ? (
- <div>keys + deploy</div>
- ) : null}
+ )}
+ {currentStep === 2 && (
+ <div>
+ <button
+ className="w-8 min-w-[64px] h-[24px] min-h-[24px] flex items-center justify-center rounded bg-white/10 px-2 py-1 text-sm text-white font-medium hover:bg-white/20"
+ onClick={deployAgent}
+ >
+ <span>Deploy</span>
+ </button>
+ </div>
+ )}
</div>
</div>
)
diff --git a/pages/settings.tsx b/pages/settings.tsx
index 60f1d1798..42029ed7c 100644
--- a/pages/settings.tsx
+++ b/pages/settings.tsx
@@ -1,16 +1,13 @@
-import { Key, Mail, Settings as SettingsIcon } from 'lucide-react'
+import { Mail, Settings as SettingsIcon } from 'lucide-react'
import { useRouter } from 'next/router'
import { GetServerSideProps } from 'next'
import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'
import { useSupabaseClient, useUser } from '@supabase/auth-helpers-react'
import Text from 'components/Text'
-import Input from 'components/Input'
import Button from 'components/Button'
import { Database } from 'db/supabase'
import { serverCreds } from 'db/credentials'
-import useModelProviderArgs from 'hooks/useModelProviderArgs'
-import { providerTemplates, ModelProvider } from 'state/model'
export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {
const supabase = createServerSupabaseClient<Database>(ctx, serverCreds)
@@ -38,8 +35,6 @@ function Settings({ }: Props) {
const router = useRouter()
const supabaseClient = useSupabaseClient<Database>()
- const [creds, mergeCreds] = useModelProviderArgs()
-
async function handleSignOut() {
await supabaseClient.auth.signOut()
router.push('/')
@@ -119,63 +114,6 @@ function Settings({ }: Props) {
text={user?.email!}
/>
</div>
- <div
- className="
- flex
- flex-col
- space-y-1
- "
- >
- <div className="
- flex
- space-x-2
- text-slate-400
- items-center
- ">
- <Key size="16px" />
- <Text
- size={Text.size.S2}
- text="Keys"
- />
- </div>
- <div
- className="
- flex
- pt-1
- flex-col
- space-y-4
- flex-1
- w-[450px]
- "
- >
- {Object.entries(providerTemplates).map(([provider, value]) =>
- <div
- key={provider}
- className="
- space-y-4
- flex
- flex-col
- p-2
- rounded
- bg-slate-100
- flex-1
- "
- >
- {Object.entries(value.creds || {}).map(([key, cred]) =>
- <div key={key}>
- <Input
- title={cred.label || key}
- value={creds[provider as ModelProvider]?.creds?.[key]?.toString()}
- onChange={(v) => mergeCreds(provider as ModelProvider, key, v || undefined)}
- placeholder={cred.label}
- label={cred.label}
- />
- </div>
- )}
- </div>
- )}
- </div>
- </div>
</div>
</div>
)
diff --git a/utils/github.ts b/utils/github.ts
index afd8a4333..5ab0560cf 100644
--- a/utils/github.ts
+++ b/utils/github.ts
@@ -3,6 +3,7 @@ import { openPopupModal } from 'utils/popupModal'
export interface GitHubAccount {
name: string
isOrg: boolean
+ installationID: number
}
export function configureGitHubApp() {