mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-27 13:29:15 +07:00
✨ feat: 优化保存为话题功能
This commit is contained in:
@@ -4,5 +4,7 @@ config.extends.push('plugin:@next/next/recommended');
|
||||
|
||||
config.rules['unicorn/no-negated-condition'] = 0;
|
||||
config.rules['unicorn/prefer-type-error'] = 0;
|
||||
config.rules['unicorn/prefer-logical-operator-over-ternary'] = 0;
|
||||
config.rules['unicorn/no-null'] = 0;
|
||||
|
||||
module.exports = config;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ChatInputArea, DraggablePanel, Icon, Tooltip } from '@lobehub/ui';
|
||||
import { Button } from 'antd';
|
||||
import { LucideGalleryVerticalEnd } from 'lucide-react';
|
||||
import { memo, useMemo, useState } from 'react';
|
||||
import { memo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { shallow } from 'zustand/shallow';
|
||||
|
||||
@@ -18,18 +18,15 @@ const ChatInput = () => {
|
||||
const [text, setText] = useState('');
|
||||
|
||||
const [inputHeight] = useSettings((s) => [s.inputHeight], shallow);
|
||||
const [sendMessage, saveToTopic] = useSessionStore(
|
||||
(s) => [s.createOrSendMsg, s.saveToTopic],
|
||||
const [sendMessage, hasTopic, saveToTopic] = useSessionStore(
|
||||
(s) => [s.createOrSendMsg, !!s.activeTopicId, s.saveToTopic],
|
||||
shallow,
|
||||
);
|
||||
|
||||
const footer = useMemo(
|
||||
() => (
|
||||
<Tooltip title={t('topic.saveCurrentMessages')}>
|
||||
<Button icon={<Icon icon={LucideGalleryVerticalEnd} />} onClick={saveToTopic} />
|
||||
</Tooltip>
|
||||
),
|
||||
[],
|
||||
const footer = hasTopic ? null : (
|
||||
<Tooltip title={t('topic.saveCurrentMessages')}>
|
||||
<Button icon={<Icon icon={LucideGalleryVerticalEnd} />} onClick={saveToTopic} />
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -52,7 +52,7 @@ export const createSettings: StateCreator<
|
||||
setSettings({
|
||||
...settings,
|
||||
// 如果用户存在用户头像,那么不做导入
|
||||
avatar: get().settings.avatar ?? settings.avatar,
|
||||
avatar: !get().settings.avatar ? settings.avatar : get().settings.avatar,
|
||||
});
|
||||
},
|
||||
resetSettings: () => {
|
||||
|
||||
Reference in New Issue
Block a user