Files
lobe-chat/src/app/chat/settings/features/HeaderContent.tsx
CanisMinor 4fa2ef410f feat: support TTS & STT (#443)
*  feat(tts): Add tts and stt basic features

*  feat(tts): Handle error

* 💄 style(tts): Add alert to error handler

* 🐛 fix(tts): Error display

* ♻️ refactor: refactor the openai initial code to the createBizOpenAI

* ♻️ refactor(tts): Refactor header config

*  feat: Add TTS voice preview

* 🐛 fix(tts): Fix header

* 🐛 fix: Fix api

---------

Co-authored-by: Arvin Xu <arvinx@foxmail.com>
2023-11-19 21:43:58 +08:00

59 lines
1.5 KiB
TypeScript

import { ActionIcon } from '@lobehub/ui';
import { Dropdown, MenuProps } from 'antd';
import { useResponsive } from 'antd-style';
import { HardDriveDownload } from 'lucide-react';
import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { HEADER_ICON_SIZE } from '@/const/layoutTokens';
import { exportSingleAgent, exportSingleSession } from '@/helpers/export';
import { useSessionStore } from '@/store/session';
import SubmitAgentButton from './SubmitAgentButton';
export const HeaderContent = memo<{ mobile?: boolean }>(() => {
const { t } = useTranslation('setting');
const id = useSessionStore((s) => s.activeId);
const { mobile } = useResponsive();
const items = useMemo<MenuProps['items']>(
() => [
{
key: 'agent',
label: <div>{t('exportType.agent', { ns: 'common' })}</div>,
onClick: () => {
if (!id) return;
exportSingleAgent(id);
},
},
{
key: 'agentWithMessage',
label: <div>{t('exportType.agentWithMessage', { ns: 'common' })}</div>,
onClick: () => {
if (!id) return;
exportSingleSession(id);
},
},
],
[],
);
return (
<>
<SubmitAgentButton />
<Dropdown arrow={false} menu={{ items }} trigger={['click']}>
<ActionIcon
icon={HardDriveDownload}
size={HEADER_ICON_SIZE(mobile)}
title={t('export', { ns: 'common' })}
/>
</Dropdown>
</>
);
});
export default HeaderContent;