Skip to content

Commit

Permalink
Refactor: add loader componet
Browse files Browse the repository at this point in the history
  • Loading branch information
swgvenghy committed Aug 23, 2024
1 parent eacb6e4 commit 2f384a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/hooks/use-chat-form.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const useChatForm = () => {
e.preventDefault();
try {
useChatStore.getState().addMessage({ content, role: 'user' });
useChatStore.getState().addMessage({ content: '답변을 생성중입니다...', role: 'system' });
useChatStore.getState().addMessage({ content: 'loading', role: 'system' });
useChatStore.getState().setLoading(true);
setContent('');
setAutoOpen(false);
Expand Down
3 changes: 2 additions & 1 deletion src/ui/components/atom/chat-card/chat-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import { cn } from '../../../../utils/style';
import maru from '../../../../assets/maru-egg.png';
import Loader from '../loader/loader';
interface ChatCardProps {
content: string;
role: 'user' | 'system';
Expand All @@ -24,7 +25,7 @@ const ChatCard = ({ content, role }: ChatCardProps) => {
})}
>
<div className="font-pretendard text-sm font-normal">
<ReactMarkdown remarkPlugins={[remarkGfm]}>{content}</ReactMarkdown>
{content === 'loading' ? <Loader /> : <ReactMarkdown remarkPlugins={[remarkGfm]}>{content}</ReactMarkdown>}
</div>
</div>
</div>
Expand Down

0 comments on commit 2f384a8

Please sign in to comment.