Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚓ fix: Export Button Content Shift; chore: bump axios and add logging #3668

Merged
merged 3 commits into from
Aug 16, 2024
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
6 changes: 3 additions & 3 deletions client/src/components/Audio/TTS.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function BrowserTTS({ isLast, index, messageId, content, className }: TMe
}}
src={audioRef.current?.src}
onError={(error) => {
console.error('Error fetching audio:', error);
logger.error('Error fetching audio:', error);
}}
id={`audio-${messageId}`}
muted
Expand Down Expand Up @@ -166,7 +166,7 @@ export function EdgeTTS({ isLast, index, messageId, content, className }: TMessa
}}
src={audioRef.current?.src}
onError={(error) => {
console.error('Error fetching audio:', error);
logger.error('Error fetching audio:', error);
}}
id={`audio-${messageId}`}
muted
Expand Down Expand Up @@ -245,7 +245,7 @@ export function ExternalTTS({ isLast, index, messageId, content, className }: TM
}}
src={audioRef.current?.src}
onError={(error) => {
console.error('Error fetching audio:', error);
logger.error('Error fetching audio:', error);
}}
id={`audio-${messageId}`}
muted
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/Chat/ExportAndShareMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Upload, Share2 } from 'lucide-react';
import { useRecoilValue } from 'recoil';
import { ShareButton } from '~/components/Conversations/ConvoOptions';
import { Button, DropdownPopup } from '~/components/ui';
import useLocalize from '~/hooks/useLocalize';
import { useMediaQuery, useLocalize } from '~/hooks';
import { ExportModal } from '../Nav';
import store from '~/store';

Expand All @@ -17,6 +17,7 @@ export default function ExportAndShareMenu({
const [isPopoverActive, setIsPopoverActive] = useState(false);
const [showExports, setShowExports] = useState(false);
const [showShareDialog, setShowShareDialog] = useState(false);
const isSmallScreen = useMediaQuery('(max-width: 768px)');

const exportable =
conversation &&
Expand Down Expand Up @@ -73,6 +74,7 @@ export default function ExportAndShareMenu({
}
items={dropdownItems}
anchor="bottom end"
className={isSmallScreen ? '' : 'absolute right-0 top-0 mt-2'}
/>
{showShareDialog && conversation.conversationId != null && (
<ShareButton
Expand Down
12 changes: 6 additions & 6 deletions client/src/components/Chat/Input/StreamAudio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ export default function StreamAudio({ index = 0 }) {

setAudioRunId(activeRunId);
if (cachedResponse) {
console.log('Audio found in cache');
logger.log('Audio found in cache');
const audioBlob = await cachedResponse.blob();
const blobUrl = URL.createObjectURL(audioBlob);
setGlobalAudioURL(blobUrl);
setIsFetching(false);
return;
}

console.log('Fetching audio...', navigator.userAgent);
logger.log('Fetching audio...', navigator.userAgent);
const response = await fetch('/api/files/speech/tts', {
method: 'POST',
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
Expand Down Expand Up @@ -137,7 +137,7 @@ export default function StreamAudio({ index = 0 }) {
}

if (chunks.length) {
console.log('Adding audio to cache');
logger.log('Adding audio to cache');
const latestMessages = getMessages() ?? [];
const targetMessage = latestMessages.find(
(msg) => msg.messageId === latestMessage?.messageId,
Expand All @@ -161,13 +161,13 @@ export default function StreamAudio({ index = 0 }) {
setIsFetching(false);
}

console.log('Audio stream reading ended');
logger.log('Audio stream reading ended');
} catch (error) {
if (error?.['message'] !== promiseTimeoutMessage) {
console.log(promiseTimeoutMessage);
logger.log(promiseTimeoutMessage);
return;
}
console.error('Error fetching audio:', error);
logger.error('Error fetching audio:', error);
setIsFetching(false);
setGlobalAudioURL(null);
} finally {
Expand Down
18 changes: 10 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.