File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ export class GradioBot extends AbstractBot {
104104 try {
105105 await wsp . open ( )
106106 } catch ( err ) {
107- console . error ( 'lmsys ws open error' , err )
107+ console . error ( 'WS open error' , err )
108108 throw new ChatError ( 'Failed to establish websocket connection.' , ErrorCode . NETWORK_ERROR )
109109 }
110110
Original file line number Diff line number Diff line change 11import WebSocketAsPromised from 'websocket-as-promised'
22import { GradioBot } from '../gradio'
3+ import { ChatError , ErrorCode } from '~utils/errors'
34
45export class LMSYSBot extends GradioBot {
56 constructor ( model : string ) {
@@ -27,7 +28,10 @@ export class LMSYSBot extends GradioBot {
2728 resolve ( )
2829 }
2930 } )
30- wsp . open ( ) . catch ( ( err ) => reject ( err ) )
31+ wsp . open ( ) . catch ( ( err ) => {
32+ console . error ( 'lmsys ws open error' , err )
33+ reject ( new ChatError ( 'Failed to establish websocket connection.' , ErrorCode . LMSYS_WS_ERROR ) )
34+ } )
3135 } )
3236 }
3337
Original file line number Diff line number Diff line change @@ -139,6 +139,17 @@ const ErrorAction: FC<{ error: ChatError }> = ({ error }) => {
139139 </ p >
140140 )
141141 }
142+ if ( error . code === ErrorCode . LMSYS_WS_ERROR ) {
143+ return (
144+ < p className = "ml-2 text-secondary-text text-sm" >
145+ Please visit{ ' ' }
146+ < a href = "https://chat.lmsys.org" target = "_blank" rel = "noreferrer" className = "underline" >
147+ LMSYS.org
148+ </ a > { ' ' }
149+ and try again
150+ </ p >
151+ )
152+ }
142153 if (
143154 error . code === ErrorCode . NETWORK_ERROR ||
144155 ( error . code === ErrorCode . UNKOWN_ERROR && error . message . includes ( 'Failed to fetch' ) )
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export enum ErrorCode {
2121 CLAUDE_WEB_UNAVAILABLE = 'CLAUDE_WEB_UNAVAILABLE' ,
2222 QIANWEN_WEB_UNAUTHORIZED = 'QIANWEN_WEB_UNAUTHORIZED' ,
2323 BAICHUAN_WEB_UNAUTHORIZED = 'BAICHUAN_WEB_UNAUTHORIZED' ,
24+ LMSYS_WS_ERROR = 'LMSYS_WS_ERROR' ,
2425}
2526
2627export class ChatError extends Error {
You can’t perform that action at this time.
0 commit comments