Skip to content

Commit a9fdff9

Browse files
authored
improvement(chat): remove legacy workspace mode selector (#7748)
* improvement(chat): remove legacy workspace mode selector * fix(chat): preserve request options when editing queued messages
1 parent bcce829 commit a9fdff9

25 files changed

Lines changed: 305 additions & 1578 deletions

apps/sim/app/workspace/[workspaceId]/home/components/knowledge-search-results/knowledge-search-results.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ type KnowledgeSearchResultsProps = (
9999
}
100100

101101
/**
102-
* The composer's Search mode: the documents the signed-in person may read that
102+
* Search results include documents the signed-in person may read that
103103
* match their query in the canonical Enterprise Search index, as rows
104104
* that open the source. A header says how many and that the search ran as
105105
* them; while a connected source is still indexing it says so, and the list

apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/mothership-chat.tsx

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type { ComponentType } from 'react'
44
import {
55
memo,
66
type ReactNode,
7-
type RefObject,
87
useCallback,
98
useDeferredValue,
109
useEffect,
@@ -69,27 +68,13 @@ interface MothershipChatProps {
6968
composer?: ReactNode
7069
messages: ChatMessage[]
7170
isSending: boolean
72-
/** The composer's Search-mode results, shown above the input. */
73-
searchResults?: ReactNode
74-
/** The live search query; the composer shows it so the box and the results never disagree. */
75-
searchQuery?: string
76-
/** The composer, for a caller that hands a question to the agent from outside the box. */
77-
userInputRef?: RefObject<UserInputHandle | null>
78-
/** Puts the composer in the mode a queued message was written in, when one is loaded for editing. */
79-
onRestoreQueuedMode?: (requestMode: QueuedMessage['requestMode']) => void
8071
isReconnecting?: boolean
8172
isLoading?: boolean
8273
onSubmit: (
8374
text: string,
8475
fileAttachments?: FileAttachmentForApi[],
8576
contexts?: ChatContext[]
8677
) => void
87-
/** Whether the composer offers Search mode; only the Home composer answers a search. */
88-
canSearch?: boolean
89-
/** Off in Search mode, where the query stays put so the person can refine it. */
90-
clearOnSubmit?: boolean
91-
/** Fires when the composer's text goes from something to nothing. */
92-
onCleared?: () => void
9378
onStopGeneration: () => void
9479
messageQueue: QueuedMessage[]
9580
editingQueuedId: string | null
@@ -341,16 +326,9 @@ export function MothershipChat({
341326
composer,
342327
messages: messagesProp,
343328
isSending,
344-
searchResults,
345-
searchQuery,
346-
userInputRef: userInputRefProp,
347-
onRestoreQueuedMode,
348329
isReconnecting = false,
349330
isLoading = false,
350331
onSubmit,
351-
canSearch = false,
352-
clearOnSubmit,
353-
onCleared,
354332
onStopGeneration,
355333
messageQueue,
356334
editingQueuedId,
@@ -701,8 +679,7 @@ export function MothershipChat({
701679
item.index !== lastIndex && item.start < (instance.scrollElement?.scrollTop ?? 0)
702680

703681
const scrolledChatRef = useRef<string | undefined | typeof UNSCROLLED>(UNSCROLLED)
704-
const ownUserInputRef = useRef<UserInputHandle>(null)
705-
const userInputRef = userInputRefProp ?? ownUserInputRef
682+
const userInputRef = useRef<UserInputHandle>(null)
706683
const messageQueueRef = useRef(messageQueue)
707684
useEffect(() => {
708685
messageQueueRef.current = messageQueue
@@ -726,10 +703,9 @@ export function MothershipChat({
726703
(id: string) => {
727704
const msg = onEditQueuedMessage(id)
728705
if (!msg) return
729-
onRestoreQueuedMode?.(msg.requestMode)
730706
userInputRef.current?.loadQueuedMessage(msg)
731707
},
732-
[onEditQueuedMessage, onRestoreQueuedMode, userInputRef]
708+
[onEditQueuedMessage, userInputRef]
733709
)
734710

735711
const handleEditQueuedTail = useCallback(() => {
@@ -860,9 +836,6 @@ export function MothershipChat({
860836
onAnimationEnd={animateInput ? onInputAnimationEnd : undefined}
861837
>
862838
<div className={styles.footerInner}>
863-
{searchResults && (
864-
<div className='max-h-[40vh] overflow-y-auto pb-2'>{searchResults}</div>
865-
)}
866839
<QueuedMessages
867840
messageQueue={messageQueue}
868841
editingQueuedId={editingQueuedId}
@@ -877,11 +850,7 @@ export function MothershipChat({
877850
<UserInput
878851
key={draftScopeKey}
879852
ref={userInputRef}
880-
defaultValue={searchQuery}
881853
onSubmit={onSubmit}
882-
canSearch={canSearch}
883-
clearOnSubmit={clearOnSubmit}
884-
onCleared={onCleared}
885854
isSending={isStreamActive}
886855
onStopGeneration={onStopGeneration}
887856
isInitialView={false}

apps/sim/app/workspace/[workspaceId]/home/components/search-sources/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/sim/app/workspace/[workspaceId]/home/components/search-sources/search-sources.test.tsx

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

0 commit comments

Comments
 (0)