Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ type KnowledgeSearchResultsProps = (
}

/**
* The composer's Search mode: the documents the signed-in person may read that
* Search results include documents the signed-in person may read that
* match their query in the canonical Enterprise Search index, as rows
* that open the source. A header says how many and that the search ran as
* them; while a connected source is still indexing it says so, and the list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { ComponentType } from 'react'
import {
memo,
type ReactNode,
type RefObject,
useCallback,
useDeferredValue,
useEffect,
Expand Down Expand Up @@ -69,27 +68,13 @@ interface MothershipChatProps {
composer?: ReactNode
messages: ChatMessage[]
isSending: boolean
/** The composer's Search-mode results, shown above the input. */
searchResults?: ReactNode
/** The live search query; the composer shows it so the box and the results never disagree. */
searchQuery?: string
/** The composer, for a caller that hands a question to the agent from outside the box. */
userInputRef?: RefObject<UserInputHandle | null>
/** Puts the composer in the mode a queued message was written in, when one is loaded for editing. */
onRestoreQueuedMode?: (requestMode: QueuedMessage['requestMode']) => void
isReconnecting?: boolean
isLoading?: boolean
onSubmit: (
text: string,
fileAttachments?: FileAttachmentForApi[],
contexts?: ChatContext[]
) => void
/** Whether the composer offers Search mode; only the Home composer answers a search. */
canSearch?: boolean
/** Off in Search mode, where the query stays put so the person can refine it. */
clearOnSubmit?: boolean
/** Fires when the composer's text goes from something to nothing. */
onCleared?: () => void
onStopGeneration: () => void
messageQueue: QueuedMessage[]
editingQueuedId: string | null
Expand Down Expand Up @@ -341,16 +326,9 @@ export function MothershipChat({
composer,
messages: messagesProp,
isSending,
searchResults,
searchQuery,
userInputRef: userInputRefProp,
onRestoreQueuedMode,
isReconnecting = false,
isLoading = false,
onSubmit,
canSearch = false,
clearOnSubmit,
onCleared,
onStopGeneration,
messageQueue,
editingQueuedId,
Expand Down Expand Up @@ -701,8 +679,7 @@ export function MothershipChat({
item.index !== lastIndex && item.start < (instance.scrollElement?.scrollTop ?? 0)

const scrolledChatRef = useRef<string | undefined | typeof UNSCROLLED>(UNSCROLLED)
const ownUserInputRef = useRef<UserInputHandle>(null)
const userInputRef = userInputRefProp ?? ownUserInputRef
const userInputRef = useRef<UserInputHandle>(null)
const messageQueueRef = useRef(messageQueue)
useEffect(() => {
messageQueueRef.current = messageQueue
Expand All @@ -726,10 +703,9 @@ export function MothershipChat({
(id: string) => {
const msg = onEditQueuedMessage(id)
if (!msg) return
onRestoreQueuedMode?.(msg.requestMode)
userInputRef.current?.loadQueuedMessage(msg)
},
[onEditQueuedMessage, onRestoreQueuedMode, userInputRef]
[onEditQueuedMessage, userInputRef]
)

const handleEditQueuedTail = useCallback(() => {
Expand Down Expand Up @@ -860,9 +836,6 @@ export function MothershipChat({
onAnimationEnd={animateInput ? onInputAnimationEnd : undefined}
>
<div className={styles.footerInner}>
{searchResults && (
<div className='max-h-[40vh] overflow-y-auto pb-2'>{searchResults}</div>
)}
<QueuedMessages
messageQueue={messageQueue}
editingQueuedId={editingQueuedId}
Expand All @@ -877,11 +850,7 @@ export function MothershipChat({
<UserInput
key={draftScopeKey}
ref={userInputRef}
defaultValue={searchQuery}
onSubmit={onSubmit}
canSearch={canSearch}
clearOnSubmit={clearOnSubmit}
onCleared={onCleared}
isSending={isStreamActive}
onStopGeneration={onStopGeneration}
isInitialView={false}
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading