chore: add back Call component from rebase, increase max file size cache

This commit is contained in:
Danny Avila 2025-02-12 17:12:02 -05:00
parent c768b8feb1
commit f170d5ba23
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
2 changed files with 107 additions and 104 deletions

View file

@ -157,116 +157,119 @@ const ChatForm = ({ index = 0 }) => {
: `pl-${uploadActive ? '12' : '4'} pr-12`; : `pl-${uploadActive ? '12' : '4'} pr-12`;
return ( return (
<form <>
onSubmit={methods.handleSubmit((data) => submitMessage(data))} <form
className={cn( onSubmit={methods.handleSubmit((data) => submitMessage(data))}
'mx-auto flex flex-row gap-3 pl-2 transition-all duration-200 last:mb-2', className={cn(
maximizeChatSpace ? 'w-full max-w-full' : 'md:max-w-2xl xl:max-w-3xl', 'mx-auto flex flex-row gap-3 pl-2 transition-all duration-200 last:mb-2',
)} maximizeChatSpace ? 'w-full max-w-full' : 'md:max-w-2xl xl:max-w-3xl',
> )}
<div className="relative flex h-full flex-1 items-stretch md:flex-col"> >
<div className="flex w-full items-center"> <div className="relative flex h-full flex-1 items-stretch md:flex-col">
{showPlusPopover && !isAssistantsEndpoint(endpoint) && ( <div className="flex w-full items-center">
<Mention {showPlusPopover && !isAssistantsEndpoint(endpoint) && (
setShowMentionPopover={setShowPlusPopover} <Mention
newConversation={generateConversation} setShowMentionPopover={setShowPlusPopover}
textAreaRef={textAreaRef} newConversation={generateConversation}
commandChar="+"
placeholder="com_ui_add_model_preset"
includeAssistants={false}
/>
)}
{showMentionPopover && (
<Mention
setShowMentionPopover={setShowMentionPopover}
newConversation={newConversation}
textAreaRef={textAreaRef}
/>
)}
<PromptsCommand index={index} textAreaRef={textAreaRef} submitPrompt={submitPrompt} />
<div className="transitional-all relative flex w-full flex-grow flex-col overflow-hidden rounded-3xl bg-surface-tertiary text-text-primary duration-200">
<TemporaryChat
isTemporaryChat={isTemporaryChat}
setIsTemporaryChat={setIsTemporaryChat}
/>
<TextareaHeader addedConvo={addedConvo} setAddedConvo={setAddedConvo} />
<FileFormWrapper disableInputs={disableInputs}>
{endpoint && (
<>
<CollapseChat
isCollapsed={isCollapsed}
isScrollable={isScrollable}
setIsCollapsed={setIsCollapsed}
/>
<TextareaAutosize
{...registerProps}
ref={(e) => {
ref(e);
textAreaRef.current = e;
}}
disabled={disableInputs}
onPaste={handlePaste}
onKeyDown={handleKeyDown}
onKeyUp={handleKeyUp}
onHeightChange={() => {
if (textAreaRef.current) {
const scrollable = checkIfScrollable(textAreaRef.current);
setIsScrollable(scrollable);
}
}}
onCompositionStart={handleCompositionStart}
onCompositionEnd={handleCompositionEnd}
id={mainTextareaId}
tabIndex={0}
data-testid="text-input"
rows={1}
onFocus={() => isCollapsed && setIsCollapsed(false)}
onClick={() => isCollapsed && setIsCollapsed(false)}
style={{ height: 44, overflowY: 'auto' }}
className={cn(
baseClasses,
speechClass,
removeFocusRings,
'transition-[max-height] duration-200',
)}
/>
</>
)}
</FileFormWrapper>
{SpeechToText && (
<AudioRecorder
isRTL={isRTL}
methods={methods}
ask={submitMessage}
textAreaRef={textAreaRef} textAreaRef={textAreaRef}
disabled={!!disableInputs} commandChar="+"
isSubmitting={isSubmitting} placeholder="com_ui_add_model_preset"
includeAssistants={false}
/> />
)} )}
{TextToSpeech && automaticPlayback && <StreamAudio index={index} />} {showMentionPopover && (
</div> <Mention
<div setShowMentionPopover={setShowMentionPopover}
className={cn( newConversation={newConversation}
'mb-[5px] ml-[8px] flex flex-col items-end justify-end', textAreaRef={textAreaRef}
isRTL && 'order-first mr-[8px]', />
)} )}
style={{ alignSelf: 'flex-end' }} <PromptsCommand index={index} textAreaRef={textAreaRef} submitPrompt={submitPrompt} />
> <div className="transitional-all relative flex w-full flex-grow flex-col overflow-hidden rounded-3xl bg-surface-tertiary text-text-primary duration-200">
{(isSubmitting || isSubmittingAdded) && (showStopButton || showStopAdded) ? ( <TemporaryChat
<StopButton stop={handleStopGenerating} setShowStopButton={setShowStopButton} /> isTemporaryChat={isTemporaryChat}
) : ( setIsTemporaryChat={setIsTemporaryChat}
endpoint && ( />
<SendButton <TextareaHeader addedConvo={addedConvo} setAddedConvo={setAddedConvo} />
ref={submitButtonRef} <FileFormWrapper disableInputs={disableInputs}>
control={methods.control} {endpoint && (
disabled={!!(filesLoading || isSubmitting || disableInputs)} <>
<CollapseChat
isCollapsed={isCollapsed}
isScrollable={isScrollable}
setIsCollapsed={setIsCollapsed}
/>
<TextareaAutosize
{...registerProps}
ref={(e) => {
ref(e);
textAreaRef.current = e;
}}
disabled={disableInputs}
onPaste={handlePaste}
onKeyDown={handleKeyDown}
onKeyUp={handleKeyUp}
onHeightChange={() => {
if (textAreaRef.current) {
const scrollable = checkIfScrollable(textAreaRef.current);
setIsScrollable(scrollable);
}
}}
onCompositionStart={handleCompositionStart}
onCompositionEnd={handleCompositionEnd}
id={mainTextareaId}
tabIndex={0}
data-testid="text-input"
rows={1}
onFocus={() => isCollapsed && setIsCollapsed(false)}
onClick={() => isCollapsed && setIsCollapsed(false)}
style={{ height: 44, overflowY: 'auto' }}
className={cn(
baseClasses,
speechClass,
removeFocusRings,
'transition-[max-height] duration-200',
)}
/>
</>
)}
</FileFormWrapper>
{SpeechToText && (
<AudioRecorder
isRTL={isRTL}
methods={methods}
ask={submitMessage}
textAreaRef={textAreaRef}
disabled={!!disableInputs}
isSubmitting={isSubmitting}
/> />
) )}
)} {TextToSpeech && automaticPlayback && <StreamAudio index={index} />}
</div>
<div
className={cn(
'mb-[5px] ml-[8px] flex flex-col items-end justify-end',
isRTL && 'order-first mr-[8px]',
)}
style={{ alignSelf: 'flex-end' }}
>
{(isSubmitting || isSubmittingAdded) && (showStopButton || showStopAdded) ? (
<StopButton stop={handleStopGenerating} setShowStopButton={setShowStopButton} />
) : (
endpoint && (
<SendButton
ref={submitButtonRef}
control={methods.control}
disabled={!!(filesLoading || isSubmitting || disableInputs)}
/>
)
)}
</div>
</div> </div>
</div> </div>
</div> </form>
</form> <Call />
</>
); );
}; };

View file

@ -62,7 +62,7 @@ export default defineConfig({
useCredentials: true, useCredentials: true,
workbox: { workbox: {
globPatterns: ['assets/**/*.{png,jpg,svg,ico}', '**/*.{js,css,html,ico,woff2}'], globPatterns: ['assets/**/*.{png,jpg,svg,ico}', '**/*.{js,css,html,ico,woff2}'],
maximumFileSizeToCacheInBytes: 4 * 1024 * 1024, maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,
navigateFallbackDenylist: [/^\/oauth/], navigateFallbackDenylist: [/^\/oauth/],
}, },
manifest: { manifest: {