Skip to content

Commit

Permalink
💄 style: fix tool message suspense loading (lobehub#3138)
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx authored Jul 4, 2024
1 parent 0c09c84 commit 3ce59ca
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/features/Conversation/Messages/Tool/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Icon } from '@lobehub/ui';
import { ConfigProvider, Empty } from 'antd';
import { ConfigProvider, Empty, Skeleton } from 'antd';
import { useTheme } from 'antd-style';
import { LucideSquareArrowLeft, LucideSquareArrowRight } from 'lucide-react';
import { memo, useContext, useState } from 'react';
import { Suspense, memo, useContext, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Center, Flexbox } from 'react-layout-kit';

Expand All @@ -14,7 +14,7 @@ import { ChatMessage } from '@/types/message';
import Arguments from '../components/Arguments';
import Inspector from './Inspector';

export const ToolMessage = memo<ChatMessage>(({ id, content, pluginState, plugin }) => {
const Message = memo<ChatMessage>(({ id, content, pluginState, plugin }) => {
const [loading, isMessageToolUIOpen] = useChatStore((s) => [
chatSelectors.isPluginApiInvoking(id)(s),
chatPortalSelectors.isArtifactMessageUIOpen(id)(s),
Expand Down Expand Up @@ -68,3 +68,11 @@ export const ToolMessage = memo<ChatMessage>(({ id, content, pluginState, plugin
</Flexbox>
);
});

export const ToolMessage = memo<ChatMessage>((props) => (
<Suspense
fallback={<Skeleton.Button active style={{ height: 46, minWidth: 200, width: '100%' }} />}
>
<Message {...props} />
</Suspense>
));

0 comments on commit 3ce59ca

Please sign in to comment.