@@ -45,6 +45,7 @@ import {
4545} from "./extractMsgFromHistoryResponse" ;
4646
4747import { X } from "lucide-react" ;
48+ import log from "@/utils/logger" ;
4849
4950const stepIdCounter = { current : 0 } ;
5051
@@ -208,7 +209,7 @@ export function ChatInterface() {
208209 handleNewConversation ( ) ;
209210 } )
210211 . catch ( ( err ) => {
211- console . error ( t ( "chatInterface.errorFetchingConversationList" ) , err ) ;
212+ log . error ( t ( "chatInterface.errorFetchingConversationList" ) , err ) ;
212213 // Create new conversation even if getting conversation list fails
213214 handleNewConversation ( ) ;
214215 } ) ;
@@ -234,7 +235,7 @@ export function ChatInterface() {
234235 try {
235236 abortControllerRef . current . abort ( t ( "chatInterface.componentUnmount" ) ) ;
236237 } catch ( error ) {
237- console . error ( t ( "chatInterface.errorCancelingRequest" ) , error ) ;
238+ log . error ( t ( "chatInterface.errorCancelingRequest" ) , error ) ;
238239 }
239240 abortControllerRef . current = null ;
240241 }
@@ -362,13 +363,13 @@ export function ChatInterface() {
362363 setSelectedConversationId ( currentConversationId ) ;
363364 }
364365 } catch ( error ) {
365- console . error (
366+ log . error (
366367 t ( "chatInterface.refreshDialogListFailedButContinue" ) ,
367368 error
368369 ) ;
369370 }
370371 } catch ( error ) {
371- console . error (
372+ log . error (
372373 t ( "chatInterface.createDialogFailedButContinue" ) ,
373374 error
374375 ) ;
@@ -720,14 +721,14 @@ export function ChatInterface() {
720721 try {
721722 await conversationService . stop ( currentConversationId ) ;
722723 } catch ( error ) {
723- console . error (
724+ log . error (
724725 t ( "chatInterface.stopTimeoutRequestFailed" ) ,
725726 error
726727 ) ;
727728 }
728729 }
729730 } catch ( error ) {
730- console . error ( t ( "chatInterface.errorCancelingRequest" ) , error ) ;
731+ log . error ( t ( "chatInterface.errorCancelingRequest" ) , error ) ;
731732 }
732733 }
733734 conversationTimeoutsRef . current . delete ( currentConversationId ) ;
@@ -808,7 +809,7 @@ export function ChatInterface() {
808809 return newMessages ;
809810 } ) ;
810811 } else {
811- console . error ( t ( "chatInterface.errorLabel" ) , error ) ;
812+ log . error ( t ( "chatInterface.errorLabel" ) , error ) ;
812813 const errorMessage =
813814 error instanceof Error
814815 ? error . message
@@ -926,7 +927,7 @@ export function ChatInterface() {
926927 setConversationList ( dialogHistory ) ;
927928 return dialogHistory ;
928929 } catch ( error ) {
929- console . error ( t ( "chatInterface.errorFetchingConversationList" ) , error ) ;
930+ log . error ( t ( "chatInterface.errorFetchingConversationList" ) , error ) ;
930931 throw error ;
931932 }
932933 } ;
@@ -980,7 +981,7 @@ export function ChatInterface() {
980981 try {
981982 controller . abort ( t ( "chatInterface.requestTimeout" ) ) ;
982983 } catch ( error ) {
983- console . error ( t ( "chatInterface.errorCancelingRequest" ) , error ) ;
984+ log . error ( t ( "chatInterface.errorCancelingRequest" ) , error ) ;
984985 }
985986 }
986987 timeoutRef . current = null ;
@@ -1061,7 +1062,7 @@ export function ChatInterface() {
10611062
10621063 // Refresh history list
10631064 fetchConversationList ( ) . catch ( ( err ) => {
1064- console . error (
1065+ log . error (
10651066 t ( "chatInterface.refreshDialogListFailedButContinue" ) ,
10661067 err
10671068 ) ;
@@ -1075,7 +1076,7 @@ export function ChatInterface() {
10751076 } ) ) ;
10761077 }
10771078 } catch ( error ) {
1078- console . error (
1079+ log . error (
10791080 t ( "chatInterface.errorFetchingConversationDetailsError" ) ,
10801081 error
10811082 ) ;
@@ -1123,7 +1124,7 @@ export function ChatInterface() {
11231124 try {
11241125 controller . abort ( t ( "chatInterface.requestTimeout" ) ) ;
11251126 } catch ( error ) {
1126- console . error ( t ( "chatInterface.errorCancelingRequest" ) , error ) ;
1127+ log . error ( t ( "chatInterface.errorCancelingRequest" ) , error ) ;
11271128 }
11281129 }
11291130 timeoutRef . current = null ;
@@ -1204,7 +1205,7 @@ export function ChatInterface() {
12041205
12051206 // Refresh history list
12061207 fetchConversationList ( ) . catch ( ( err ) => {
1207- console . error (
1208+ log . error (
12081209 t ( "chatInterface.refreshDialogListFailedButContinue" ) ,
12091210 err
12101211 ) ;
@@ -1218,7 +1219,7 @@ export function ChatInterface() {
12181219 } ) ) ;
12191220 }
12201221 } catch ( error ) {
1221- console . error (
1222+ log . error (
12221223 t ( "chatInterface.errorFetchingConversationDetailsError" ) ,
12231224 error
12241225 ) ;
@@ -1265,7 +1266,7 @@ export function ChatInterface() {
12651266 attachment . url = url ;
12661267 hasUpdates = true ;
12671268 } catch ( error ) {
1268- console . error (
1269+ log . error (
12691270 t ( "chatInterface.errorFetchingAttachmentUrl" , {
12701271 object_name : attachment . object_name ,
12711272 } ) ,
@@ -1296,7 +1297,7 @@ export function ChatInterface() {
12961297 setConversationTitle ( title ) ;
12971298 }
12981299 } catch ( error ) {
1299- console . error ( t ( "chatInterface.renameFailed" ) , error ) ;
1300+ log . error ( t ( "chatInterface.renameFailed" ) , error ) ;
13001301 }
13011302 } ;
13021303
@@ -1316,7 +1317,7 @@ export function ChatInterface() {
13161317 t ( "chatInterface.deleteConversation" )
13171318 ) ;
13181319 } catch ( error ) {
1319- console . error ( t ( "chatInterface.errorCancelingRequest" ) , error ) ;
1320+ log . error ( t ( "chatInterface.errorCancelingRequest" ) , error ) ;
13201321 }
13211322 abortControllerRef . current = null ;
13221323 }
@@ -1333,7 +1334,7 @@ export function ChatInterface() {
13331334 try {
13341335 await conversationService . stop ( dialogId ) ;
13351336 } catch ( error ) {
1336- console . error (
1337+ log . error (
13371338 t ( "chatInterface.stopConversationToDeleteFailed" ) ,
13381339 error
13391340 ) ;
@@ -1352,13 +1353,13 @@ export function ChatInterface() {
13521353 handleNewConversation ( ) ;
13531354 }
13541355 } catch ( error ) {
1355- console . error ( t ( "chatInterface.deleteFailed" ) , error ) ;
1356+ log . error ( t ( "chatInterface.deleteFailed" ) , error ) ;
13561357 }
13571358 } ;
13581359
13591360 // Add image error handling function
13601361 const handleImageError = ( imageUrl : string ) => {
1361- console . error ( t ( "chatInterface.imageLoadFailed" ) , imageUrl ) ;
1362+ log . error ( t ( "chatInterface.imageLoadFailed" ) , imageUrl ) ;
13621363
13631364 // Remove failed images from messages
13641365 setSessionMessages ( ( prev ) => {
@@ -1389,7 +1390,7 @@ export function ChatInterface() {
13891390 try {
13901391 currentController . abort ( t ( "chatInterface.userManuallyStopped" ) ) ;
13911392 } catch ( error ) {
1392- console . error ( t ( "chatInterface.errorCancelingRequest" ) , error ) ;
1393+ log . error ( t ( "chatInterface.errorCancelingRequest" ) , error ) ;
13931394 }
13941395 conversationControllersRef . current . delete ( conversationId ) ;
13951396 }
@@ -1462,7 +1463,7 @@ export function ChatInterface() {
14621463 } ) ;
14631464 }
14641465 } catch ( error ) {
1465- console . error ( t ( "chatInterface.stopConversationFailed" ) , error ) ;
1466+ log . error ( t ( "chatInterface.stopConversationFailed" ) , error ) ;
14661467
14671468 // Optionally show error message
14681469 setSessionMessages ( ( prev ) => {
@@ -1489,7 +1490,7 @@ export function ChatInterface() {
14891490 await fetchConversationList ( ) ;
14901491 setConversationTitle ( newTitle ) ;
14911492 } catch ( error ) {
1492- console . error ( t ( "chatInterface.renameFailed" ) , error ) ;
1493+ log . error ( t ( "chatInterface.renameFailed" ) , error ) ;
14931494 }
14941495 }
14951496 } ;
@@ -1538,15 +1539,15 @@ export function ChatInterface() {
15381539 return newMessages ;
15391540 } ) ;
15401541 } catch ( error ) {
1541- console . error ( t ( "chatInterface.updateOpinionFailed" ) , error ) ;
1542+ log . error ( t ( "chatInterface.updateOpinionFailed" ) , error ) ;
15421543 }
15431544 } ;
15441545
15451546 // Add event listener for conversation list updates
15461547 useEffect ( ( ) => {
15471548 const handleConversationListUpdate = ( ) => {
15481549 fetchConversationList ( ) . catch ( ( err ) => {
1549- console . error ( t ( "chatInterface.failedToUpdateConversationList" ) , err ) ;
1550+ log . error ( t ( "chatInterface.failedToUpdateConversationList" ) , err ) ;
15501551 } ) ;
15511552 } ;
15521553
0 commit comments