🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(project): create a dedicated agent when creating from GitHub (#22696)
Arvin Xu7885324c1af1
diff --git a/src/features/Projects/CreateFromGithub/Content.tsx b/src/features/Projects/CreateFromGithub/Content.tsxindex 2bf12f6eb08..2ea5ae9a18d 100644--- a/src/features/Projects/CreateFromGithub/Content.tsx+++ b/src/features/Projects/CreateFromGithub/Content.tsx@@ -14,15 +14,19 @@ import { useTranslation } from 'react-i18next';import { GITHUB_RETURN_TO } from '@/features/Integrations/Github/installHref';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';+import { useHomeStore } from '@/store/home';import { useProjectStore } from '@/store/project';import {+ buildCreateProjectRequest,+ DEFAULT_MAIN_AGENT_MODE,getCreateProjectInput,getProjectConflictField,getProjectFieldSuggestions,isProjectIdentifierValid,+ type MainAgentMode,} from '../createProjectForm';-import MainAgentField from '../MainAgentField';+import MainAgentSection from '../MainAgentSection';import { useDefaultMainAgent } from '../useDefaultMainAgent';import { parseGithubRepository } from './githubRepository';import RepositoryList from './RepositoryList';@@ -36,6 +40,7 @@ interface FormState {loading: boolean;/** Explicit pick in this dialog; otherwise the workspace inbox agent, LobeAI. */mainAgentId?: string;+ mainAgentMode: MainAgentMode;name: string;nameEdited: boolean;url: string;@@ -43,8 +48,8 @@ interface FormState {/*** New project from a GitHub repository: pick one the connected GitHub App can- * read, or paste a URL, and the project is named after it, led by the default- * main agent, and created with the repository attached as its environment —+ * read, or paste a URL, and the project is named after it, led by an agent of+ * its own unless the person picks an existing one, and created with the repository attached as its environment —* no fields to fill unless the defaults are wrong.*/const CreateFromGithubContent = () => {@@ -55,6 +60,7 @@ const CreateFromGithubContent = () => {const [form, setForm] = useState<FormState>({identifier: '',loading: false,+ mainAgentMode: DEFAULT_MAIN_AGENT_MODE,name: '',nameEdited: false,url: '',@@ -102,14 +108,21 @@ const CreateFromGithubContent = () => {setForm((current) => ({ ...current, loading: true }));try {const project = await createProject({- ...createInput,- coordinatorAgentId: mainAgentId,+ ...buildCreateProjectRequest(createInput, {+ mainAgentId,+ mainAgentMode: form.mainAgentMode,+ }),repository: {defaultBranch: form.defaultBranch,name: repository.fullName,url: repository.url,},});+ if (form.mainAgentMode === 'dedicated') {+ // The project created an agent and maybe the Project label; show both.+ const { refreshAgentLabels, refreshAgentList } = useHomeStore.getState();+ void Promise.all([refreshAgentList(), refreshAgentLabels()]);+ }close();navigate(`/project/${project.slug ?? project.id}`);} catch (error) {@@ -207,16 +220,14 @@ const CreateFromGithubContent = () => {</Text>)}{repository && (- <Flexbox gap={6}>- <Text fontSize={13} weight={500}>- {t('create.mainAgentLabel')}- </Text>- <MainAgentField- agentId={mainAgentId}- disabled={form.loading}- onChange={(id) => setForm((current) => ({ ...current, mainAgentId: id }))}- />- </Flexbox>+ <MainAgentSection+ agentId={mainAgentId}+ disabled={form.loading}+ mode={form.mainAgentMode}+ projectName={form.name}+ onAgentChange={(id) => setForm((current) => ({ ...current, mainAgentId: id }))}+ onModeChange={(mainAgentMode) => setForm((current) => ({ ...current, mainAgentMode }))}+ />)}</Flexbox><ModalFooter>