import { useState } from "react" import type { ModelSelection } from "@/lib/agents/useModelOptions" import { AgentPromptBar } from "@/components/agents/AgentPromptBar" import { SlackConnectDialog } from "@/components/agents/SlackConnectDialog" import { Logo } from "@/components/agents/ported/Logo" import { useCreateAgentThread } from "@/lib/agents/queries" import { useModelOptions } from "@/lib/agents/useModelOptions" import { useProfile, useRepos } from "@/lib/profile" export function AgentsHome() { const createThread = useCreateAgentThread() const { models, defaultSelection } = useModelOptions() const [selection, setSelection] = useState(null) const activeSelection = selection ?? defaultSelection const reposQuery = useRepos() const profileQuery = useProfile() // undefined = untouched (fall back to the profile default); null = explicitly "no repo". const [repoOverride, setRepoOverride] = useState( undefined ) const repo = repoOverride === undefined ? (profileQuery.data?.default_repo ?? null) : repoOverride return (
createThread.mutate({ prompt, images, repo, repo_explicitly_none: repoOverride === null, model_id: activeSelection?.modelId ?? null, effort: activeSelection?.effort ?? null, }) } disabled={createThread.isPending} models={models} selection={activeSelection} onSelectionChange={setSelection} repos={reposQuery.data?.repositories} selectedRepo={repo} onRepoChange={setRepoOverride} />
) }