@@ -7,7 +7,7 @@ dotenv.config()
77
88class Config {
99 constructor ( ) {
10- this . PORT = process . env . PORT || '/'
10+ this . PORT = process . env . PORT || 8787
1111 this . API_PREFIX = process . env . API_PREFIX || '/'
1212 this . API_KEY = process . env . API_KEY || ''
1313 this . MAX_RETRY_COUNT = process . env . MAX_RETRY_COUNT || 3
@@ -63,7 +63,7 @@ const logger = (res, req) => {
6363
6464const router = AutoRouter ( {
6565 before : [ withBenchmarking , preflight , withAuth ] ,
66- missing : ( ) => error ( 404 , '404 not found .' ) ,
66+ missing : ( ) => error ( 404 , '404 Not Found. Please check whether the calling URL is correct .' ) ,
6767 finally : [ corsify , logger ] ,
6868} )
6969
@@ -90,7 +90,7 @@ async function handleCompletion(request) {
9090 const content = messagesPrepare ( messages )
9191 return createCompletion ( model , content , returnStream )
9292 } catch ( err ) {
93- error ( 500 , err . message )
93+ return error ( 500 , err . message )
9494 }
9595}
9696
@@ -320,9 +320,9 @@ function newChatCompletionWithModel(text, model) {
320320 if ( typeof addEventListener === 'function' ) return
321321 // For Nodejs
322322 const ittyServer = createServerAdapter ( router . fetch )
323- console . log ( `Listening on http://localhost:${ config . PORT || 8787 } ` )
323+ console . log ( `Listening on http://localhost:${ config . PORT } ` )
324324 const httpServer = createServer ( ittyServer )
325- httpServer . listen ( config . PORT || 8787 )
325+ httpServer . listen ( config . PORT )
326326} ) ( )
327327
328328// export default router
0 commit comments