Skip to content

Commit 1430eb6

Browse files
committed
fix(landing): wire agent input to mothership
1 parent e921448 commit 1430eb6

File tree

4 files changed

+17
-89
lines changed

4 files changed

+17
-89
lines changed

apps/sim/app/workspace/[workspaceId]/home/home.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
11
'use client'
22

3-
import { useCallback, useState } from 'react'
3+
import { useCallback, useEffect, useRef, useState } from 'react'
4+
import { createLogger } from '@sim/logger'
45
import { useParams } from 'next/navigation'
6+
import { LandingPromptStorage } from '@/lib/core/utils/browser-storage'
57
import { MessageContent, UserInput } from './components'
68
import { useChat } from './hooks'
79

10+
const logger = createLogger('Home')
11+
812
interface HomeProps {
913
chatId?: string
1014
}
1115

1216
export function Home({ chatId }: HomeProps = {}) {
1317
const { workspaceId } = useParams<{ workspaceId: string }>()
1418
const [inputValue, setInputValue] = useState('')
19+
const hasCheckedLandingPromptRef = useRef(false)
20+
21+
useEffect(() => {
22+
if (hasCheckedLandingPromptRef.current) return
23+
hasCheckedLandingPromptRef.current = true
24+
25+
const prompt = LandingPromptStorage.consume()
26+
if (prompt) {
27+
logger.info('Retrieved landing page prompt, populating home input')
28+
setInputValue(prompt)
29+
}
30+
}, [])
1531
const { messages, isSending, sendMessage, stopGeneration, chatBottomRef } = useChat(
1632
workspaceId,
1733
chatId

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import type { UserInputRef } from '@/app/workspace/[workspaceId]/w/[workflowId]/
3737
import {
3838
useChatHistory,
3939
useCopilotInitialization,
40-
useLandingPrompt,
4140
useTodoManagement,
4241
} from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/hooks'
4342
import { useScrollManagement } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks'
@@ -169,15 +168,6 @@ export const Copilot = forwardRef<CopilotRef, CopilotProps>(({ panelWidth }, ref
169168
userInputRef.current?.focus()
170169
}, [])
171170

172-
// Handle landing page prompt retrieval and population
173-
useLandingPrompt({
174-
isInitialized,
175-
setInputValue,
176-
focusInput,
177-
isSendingMessage,
178-
currentInputValue: inputValue,
179-
})
180-
181171
/** Auto-scrolls to bottom when chat loads */
182172
useEffect(() => {
183173
if (isInitialized && messages.length > 0) {
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export { useChatHistory } from './use-chat-history'
22
export { useCopilotInitialization } from './use-copilot-initialization'
3-
export { useLandingPrompt } from './use-landing-prompt'
43
export { useTodoManagement } from './use-todo-management'

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/hooks/use-landing-prompt.ts

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)