File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
test-clients/ai-chat-client Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -554,6 +554,12 @@ function sendChat() {
554554 const msg = userInput . value . trim ( ) ;
555555 if ( ! msg ) return ;
556556
557+ // 캐릭터 선택 검증
558+ if ( ! characterSelect . value ) {
559+ appendLog ( `<span style='color:red'>❌ 캐릭터를 선택해주세요.</span>` ) ;
560+ return ;
561+ }
562+
557563 const timestamp = new Date ( ) . toLocaleTimeString ( ) ;
558564 appendLog ( `<b>나:</b> ${ msg } ` ) ;
559565 appendLog ( `<span style="color: #888; font-size: 0.9em;">[${ timestamp } ] 📤 서버로 메시지 전송 중...</span>` ) ;
@@ -582,17 +588,24 @@ function sendChat() {
582588 . then ( res => {
583589 const responseTimestamp = new Date ( ) . toLocaleTimeString ( ) ;
584590 if ( ! res . ok ) {
585- appendLog ( `<span style='color:red'>[${ responseTimestamp } ] ❌ HTTP 오류] 상태코드: ${ res . status } </span>` ) ;
586- console . error ( "HTTP 오류" , res ) ;
591+ // 오류 응답의 상세 정보를 표시
592+ res . json ( ) . then ( errorData => {
593+ const errorMsg = errorData . message || `HTTP ${ res . status } 오류` ;
594+ appendLog ( `<span style='color:red'>[${ responseTimestamp } ] ❌ ${ errorMsg } (${ res . status } )</span>` ) ;
595+ console . error ( "HTTP 오류 상세:" , errorData ) ;
596+ } ) . catch ( ( ) => {
597+ appendLog ( `<span style='color:red'>[${ responseTimestamp } ] ❌ HTTP 오류: ${ res . status } </span>` ) ;
598+ } ) ;
599+ return ;
587600 } else {
588601 appendLog ( `<span style="color: #888; font-size: 0.9em;">[${ responseTimestamp } ] ✅ HTTP 응답 수신: ${ res . status } </span>` ) ;
589602 }
590603 return res . json ( ) ;
591604 } )
592605 . catch ( err => {
593606 const errorTimestamp = new Date ( ) . toLocaleTimeString ( ) ;
594- appendLog ( `<span style='color:red'>[${ errorTimestamp } ] ❌ HTTP 오류: ${ err } </span>` ) ;
595- console . error ( err ) ;
607+ appendLog ( `<span style='color:red'>[${ errorTimestamp } ] ❌ 네트워크 오류: ${ err . message } </span>` ) ;
608+ console . error ( "네트워크 오류:" , err ) ;
596609 } ) ;
597610}
598611
You can’t perform that action at this time.
0 commit comments