From f0580cf418297ce18c3e507ebd8443eb8e535aa6 Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Wed, 13 Nov 2024 18:45:55 +0900 Subject: [PATCH 1/2] refactor: markdown link to new tab --- src/hooks/use-preset-button.hooks.ts | 4 ++-- src/ui/components/atom/chat-card/chat-card.tsx | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/hooks/use-preset-button.hooks.ts b/src/hooks/use-preset-button.hooks.ts index 8562958..41fd165 100644 --- a/src/hooks/use-preset-button.hooks.ts +++ b/src/hooks/use-preset-button.hooks.ts @@ -7,14 +7,14 @@ const usePresetButton = () => { const { addMessage, setLoading, updateLastMessage, updateLastReference, updateReferenceDisabled } = useChatStore(); const handleReferenceButtonClick = (references: referenceState[]) => { - let content = '๐Ÿ’ก๋‹ต๋ณ€ ์ถœ์ฒ˜๋ฅผ ์•Œ๋ ค๋“œ๋ฆด๊ฒŒ์š”! ๋งํฌ๋ฅผ ํด๋ฆญํ•˜๋ฉด ๋ชจ์ง‘์š”๊ฐ•์œผ๋กœ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”!\n'; + let content = '๐Ÿ’ก๋‹ต๋ณ€ ์ถœ์ฒ˜๋ฅผ ์•Œ๋ ค๋“œ๋ฆด๊ฒŒ์š”! ์ถœ์ฒ˜ ๊ธ€์‹œ๋ฅผ ํด๋ฆญํ•˜๋ฉด ๋ชจ์ง‘์š”๊ฐ•์œผ๋กœ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”!\n'; // references๊ฐ€ null, undefined, ๋˜๋Š” ๊ธธ์ด๊ฐ€ 0์ธ ๊ฒฝ์šฐ ์ฒดํฌ if (!references || references.length === 0) { addMessage({ content: '์ถœ์ฒ˜ ์ •๋ณด๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.', role: 'system' }); return; } references.map((reference, index) => { - content += `\n์ถœ์ฒ˜${index + 1}๋ฒˆ: ${reference.link}\n`; + content += `\n[์ถœ์ฒ˜ ${index + 1}๋ฒˆ](${reference.link})\n`; }); content += '\n๐Ÿ“Œ **๋‹ต๋ณ€์„ ๊ผญ ํ™•์ธํ•ด์ฃผ์„ธ์š”!** '; addMessage({ content: content, role: 'system' }); diff --git a/src/ui/components/atom/chat-card/chat-card.tsx b/src/ui/components/atom/chat-card/chat-card.tsx index ed9a5aa..48d0ea4 100644 --- a/src/ui/components/atom/chat-card/chat-card.tsx +++ b/src/ui/components/atom/chat-card/chat-card.tsx @@ -26,7 +26,22 @@ const ChatCard = ({ content, role, children }: ChatCardProps) => { })} >
- {content === 'loading' ? : {content}} + {content === 'loading' ? ( + + ) : ( + ( + + {props.children} + + ), + }} + > + {content} + + )} {children}
From 61d37391a9a3315a0165403944c37aaa289c6d16 Mon Sep 17 00:00:00 2001 From: Choi JunHo Date: Wed, 13 Nov 2024 18:56:23 +0900 Subject: [PATCH 2/2] refactor: Corrected typo and text-color --- src/hooks/use-preset-button.hooks.ts | 2 +- src/ui/components/atom/chat-card/chat-card.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/use-preset-button.hooks.ts b/src/hooks/use-preset-button.hooks.ts index 41fd165..f06be8c 100644 --- a/src/hooks/use-preset-button.hooks.ts +++ b/src/hooks/use-preset-button.hooks.ts @@ -7,7 +7,7 @@ const usePresetButton = () => { const { addMessage, setLoading, updateLastMessage, updateLastReference, updateReferenceDisabled } = useChatStore(); const handleReferenceButtonClick = (references: referenceState[]) => { - let content = '๐Ÿ’ก๋‹ต๋ณ€ ์ถœ์ฒ˜๋ฅผ ์•Œ๋ ค๋“œ๋ฆด๊ฒŒ์š”! ์ถœ์ฒ˜ ๊ธ€์‹œ๋ฅผ ํด๋ฆญํ•˜๋ฉด ๋ชจ์ง‘์š”๊ฐ•์œผ๋กœ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”!\n'; + let content = '๐Ÿ’ก๋‹ต๋ณ€ ์ถœ์ฒ˜๋ฅผ ์•Œ๋ ค๋“œ๋ฆด๊ฒŒ์š”! ์ถœ์ฒ˜๋ฅผ ํด๋ฆญํ•˜๋ฉด ๋ชจ์ง‘์š”๊ฐ•์œผ๋กœ ํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”!\n'; // references๊ฐ€ null, undefined, ๋˜๋Š” ๊ธธ์ด๊ฐ€ 0์ธ ๊ฒฝ์šฐ ์ฒดํฌ if (!references || references.length === 0) { addMessage({ content: '์ถœ์ฒ˜ ์ •๋ณด๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.', role: 'system' }); diff --git a/src/ui/components/atom/chat-card/chat-card.tsx b/src/ui/components/atom/chat-card/chat-card.tsx index 48d0ea4..5bc70b2 100644 --- a/src/ui/components/atom/chat-card/chat-card.tsx +++ b/src/ui/components/atom/chat-card/chat-card.tsx @@ -33,7 +33,7 @@ const ChatCard = ({ content, role, children }: ChatCardProps) => { remarkPlugins={[remarkGfm]} components={{ a: ({ node, ...props }) => ( - + {props.children} ),