File tree Expand file tree Collapse file tree 1 file changed +20
-9
lines changed
Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { useRouter } from "next/navigation";
44import Chatlist from "@/components/Chatlist" ;
55import Image from "next/image" ;
66import ChatMessages from "@/components/ChatMessages" ;
7- import { newChatWebSocket } from "@/lib/websocket" ;
7+ import { newChatWebSocket , continueChatWebSocket } from "@/lib/websocket" ;
88
99export default function MainPage ( ) {
1010 const router = useRouter ( ) ;
@@ -111,14 +111,25 @@ export default function MainPage() {
111111 console . log ( "메타데이터:" , id , title , description ) ;
112112 }
113113
114- // WebSocket 연결 설정
115- const socket = newChatWebSocket (
116- formData . content ,
117- localStorage . getItem ( "jwtToken" ) ,
118- modelNameHandler ,
119- modelResponseHandler ,
120- metadataHandler
121- ) ;
114+ if ( chat . chatList . length > 0 ) {
115+ // 기존 채팅이 있는 경우
116+ const socket = continueChatWebSocket (
117+ chat . chattingId ,
118+ formData . content ,
119+ localStorage . getItem ( "jwtToken" ) ,
120+ modelNameHandler ,
121+ modelResponseHandler
122+ ) ;
123+ } else {
124+ // WebSocket 연결 설정
125+ const socket = newChatWebSocket (
126+ formData . content ,
127+ localStorage . getItem ( "jwtToken" ) ,
128+ modelNameHandler ,
129+ modelResponseHandler ,
130+ metadataHandler
131+ ) ;
132+ }
122133 } ;
123134
124135 const handleInputKeyDown = ( e ) => {
You can’t perform that action at this time.
0 commit comments