File tree Expand file tree Collapse file tree 4 files changed +22
-14
lines changed
apps/sim/app/workspace/[workspaceId]/home Expand file tree Collapse file tree 4 files changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,10 @@ import { cn } from '@/lib/core/utils/cn'
6464import { CHAT_ACCEPT_ATTRIBUTE } from '@/lib/uploads/utils/validation'
6565import { useAvailableResources } from '@/app/workspace/[workspaceId]/home/components/mothership-view/components/add-resource-dropdown'
6666import { getResourceConfig } from '@/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-registry'
67- import type { MothershipResource } from '@/app/workspace/[workspaceId]/home/types'
67+ import type {
68+ FileAttachmentForApi ,
69+ MothershipResource ,
70+ } from '@/app/workspace/[workspaceId]/home/types'
6871import {
6972 useContextManagement ,
7073 useFileAttachments ,
@@ -145,13 +148,7 @@ function mapResourceToContext(resource: MothershipResource): ChatContext {
145148 }
146149}
147150
148- export interface FileAttachmentForApi {
149- id : string
150- key : string
151- filename : string
152- media_type : string
153- size : number
154- }
151+ export type { FileAttachmentForApi } from '@/app/workspace/[workspaceId]/home/types'
155152
156153interface UserInputProps {
157154 defaultValue ?: string
@@ -200,11 +197,16 @@ export function UserInput({
200197 if ( editValue && editValue !== prevEditValue ) {
201198 setPrevEditValue ( editValue )
202199 setValue ( editValue )
203- onEditValueConsumed ?.( )
204200 } else if ( ! editValue && prevEditValue ) {
205201 setPrevEditValue ( editValue )
206202 }
207203
204+ useEffect ( ( ) => {
205+ if ( editValue ) {
206+ onEditValueConsumed ?.( )
207+ }
208+ } , [ editValue , onEditValueConsumed ] )
209+
208210 const animatedPlaceholder = useAnimatedPlaceholder ( isInitialView )
209211 const placeholder = isInitialView ? animatedPlaceholder : 'Send message to Sim'
210212
Original file line number Diff line number Diff line change @@ -25,9 +25,8 @@ import {
2525 UserMessageContent ,
2626} from './components'
2727import { PendingTagIndicator } from './components/message-content/components/special-tags'
28- import type { FileAttachmentForApi } from './components/user-input/user-input'
2928import { useAutoScroll , useChat } from './hooks'
30- import type { MothershipResource , MothershipResourceType } from './types'
29+ import type { FileAttachmentForApi , MothershipResource , MothershipResourceType } from './types'
3130
3231const logger = createLogger ( 'Home' )
3332
Original file line number Diff line number Diff line change @@ -28,12 +28,12 @@ import { useFolderStore } from '@/stores/folders/store'
2828import type { ChatContext } from '@/stores/panel'
2929import { useTerminalConsoleStore } from '@/stores/terminal'
3030import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
31- import type { FileAttachmentForApi } from '../components/user-input/user-input'
3231import type {
3332 ChatMessage ,
3433 ChatMessageAttachment ,
3534 ContentBlock ,
3635 ContentBlockType ,
36+ FileAttachmentForApi ,
3737 MothershipResource ,
3838 MothershipResourceType ,
3939 QueuedMessage ,
@@ -1016,7 +1016,7 @@ export function useChat(
10161016 if ( ! msg ) return
10171017 await stopGeneration ( )
10181018 setMessageQueue ( ( prev ) => prev . filter ( ( m ) => m . id !== id ) )
1019- sendMessage ( msg . content , msg . fileAttachments , msg . contexts )
1019+ await sendMessage ( msg . content , msg . fileAttachments , msg . contexts )
10201020 } ,
10211021 [ stopGeneration , sendMessage , setMessageQueue ]
10221022 )
Original file line number Diff line number Diff line change 11import type { MothershipResourceType } from '@/lib/copilot/resource-types'
22import type { ChatContext } from '@/stores/panel'
3- import type { FileAttachmentForApi } from './components/user-input/user-input'
43
54export type {
65 MothershipResource ,
76 MothershipResourceType ,
87} from '@/lib/copilot/resource-types'
98
9+ export interface FileAttachmentForApi {
10+ id : string
11+ key : string
12+ filename : string
13+ media_type : string
14+ size : number
15+ }
16+
1017export interface QueuedMessage {
1118 id : string
1219 content : string
You can’t perform that action at this time.
0 commit comments