diff --git a/apps/shinkai-visor/src/components/create-inbox/create-inbox.tsx b/apps/shinkai-visor/src/components/create-inbox/create-inbox.tsx index f5a843f54..19149d9a8 100644 --- a/apps/shinkai-visor/src/components/create-inbox/create-inbox.tsx +++ b/apps/shinkai-visor/src/components/create-inbox/create-inbox.tsx @@ -105,7 +105,7 @@ export const CreateInbox = () => { type="submit" > {isLoading && } - + diff --git a/apps/shinkai-visor/src/components/create-job/create-job.tsx b/apps/shinkai-visor/src/components/create-job/create-job.tsx index b4fab4c23..5136c15ae 100644 --- a/apps/shinkai-visor/src/components/create-job/create-job.tsx +++ b/apps/shinkai-visor/src/components/create-job/create-job.tsx @@ -3,6 +3,7 @@ import { buildInboxIdFromJobId } from '@shinkai_network/shinkai-message-ts/utils import { useCreateJob } from '@shinkai_network/shinkai-node-state/lib/mutations/createJob/useCreateJob'; import { useAgents } from '@shinkai_network/shinkai-node-state/lib/queries/getAgents/useGetAgents'; import { Loader2 } from 'lucide-react'; +import { useEffect } from 'react'; import { useForm } from 'react-hook-form'; import { FormattedMessage } from 'react-intl'; import { useHistory, useLocation } from 'react-router-dom'; @@ -49,7 +50,7 @@ export const CreateJob = () => { defaultValues: { agent: '', content: '', - }, + } }); const { agents } = useAgents({ sender: auth?.shinkai_identity ?? '', @@ -63,10 +64,19 @@ export const CreateJob = () => { }); const { isLoading, mutateAsync: createJob } = useCreateJob({ onSuccess: (data) => { + console.log('job created'); const jobId = encodeURIComponent(buildInboxIdFromJobId(data.jobId)); history.replace(`/inboxes/${jobId}`); }, }); + + //TODO: Replace this assigment with a configured default agent + useEffect(() => { + if (agents?.length) { + const defaultAgentId = agents[0].id; + form.setValue('agent', defaultAgentId); + } + }, [agents, form]); const submit = (values: FormSchemaType) => { if (!auth) return; let content = values.content; @@ -105,7 +115,9 @@ export const CreateJob = () => {