chatdoc-com / ChatDOC-API-Demo

36 stars 11 forks source link

change port #10

Open hello-lui opened 6 months ago

hello-lui commented 6 months ago

We are trying to distribute this within the company, but port 80 is blocked due to network policy. We are getting an error during upload. Can we change the port number?

image

jiaxiaxia commented 5 months ago

The demo hasn't configured the port to 80, and I'm uncertain about the source of the error. Could you please check your network or share more details? Thank you.

hello-lui commented 5 months ago

you're right. I am planning to distribute the repository on the company network. Distribution is normal and the first screen is displayed well, but the error occurred while uploading the file and is having difficulty.

The details of the error are as follows. I would appreciate it if you could provide more specific guidance on what I should check or discuss with the in-house network manager.

The detailed error message is as follows.

Forced re-optimization of dependencies

VITE v4.3.9 ready in 737 ms

➜ Local: https://localhost:5173/ ➜ Network: https://172.23.24.146:5173/ ➜ press h to show help

Shortcuts press r to restart the server press u to show server url press o to open in browser press c to clear console press q to quit [@vue/compiler-sfc] defineEmits is a compiler macro and no longer needs to be imported.

request error: AxiosError: connect ECONNREFUSED 127.0.0.1:80 at Function.AxiosError.from (file:///Users/1108029/my_githup/RPA_news_bot/chatDOC/ChatDOC-API-Demo/node_modules/.pnpm/axios@1.4.0/node_modules/axios/lib/core/AxiosError.js:89:14) at RedirectableRequest.handleRequestError (file:///Users/1108029/my_githup/RPA_news_bot/chatDOC/ChatDOC-API-Demo/node_modules/.pnpm/axios@1.4.0/node_modules/axios/lib/adapters/http.js:591:25) at RedirectableRequest.emit (node:events:525:35) at ClientRequest.eventHandlers. (/Users/1108029/my_githup/RPA_news_bot/chatDOC/ChatDOC-API-Demo/node_modules/.pnpm/follow-redirects@1.15.2/node_modules/follow-redirects/index.js:14:24) at ClientRequest.emit (node:events:513:28) at Socket.socketErrorListener (node:_http_client:494:9) at Socket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:157:8) at emitErrorCloseNT (node:internal/streams/destroy:122:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) { port: 80, address: '127.0.0.1', syscall: 'connect', code: 'ECONNREFUSED', errno: -61, config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [ 'xhr', 'http' ], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 6000000, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, env: { FormData: [Function], Blob: null }, validateStatus: [Function: validateStatus], headers: AxiosHeaders { Accept: 'application/json, text/plain, /', 'Content-Type': 'multipart/form-data; boundary=--------------------------387809854697238603383923', Authorization: 'Bearer ', 'User-Agent': 'axios/1.4.0', 'Content-Length': '29642', 'Accept-Encoding': 'gzip, compress, deflate, br' }, baseURL: 'undefined/api/v2', method: 'post', url: 'documents/upload', data: FormData { _overheadLength: 385, _valueLength: 12, _valuesToMeasure: [Array], writable: false, readable: true, dataSize: 0, maxDataSize: 2097152, pauseStreams: true, _released: true, _streams: [], _currentStream: null, _insideLoop: false, _pendingNext: false, _boundary: '--------------------------387809854697238603383923', _events: [Object: null prototype], _eventsCount: 3 } }, request: <ref *1> Writable { _writableState: WritableState { objectMode: false, highWaterMark: 16384, finalCalled: false, needDrain: false, ending: false, ended: false, finished: false, destroyed: false, decodeStrings: true, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: true, bufferProcessing: false, onwrite: [Function: bound onwrite], writecb: null, writelen: 0, afterWriteTickInfo: null, buffered: [], bufferedIndex: 0, allBuffers: true, allNoop: true, pendingcb: 0, constructed: true, prefinished: false, errorEmitted: false, emitClose: true, autoDestroy: true, errored: null, closed: false, closeEmitted: false,

},
_events: [Object: null prototype] {
  response: [Function: handleResponse],
  error: [Function: handleRequestError],
  socket: [Array]
},
_eventsCount: 3,
_maxListeners: undefined,
_options: {
  maxRedirects: 21,
  maxBodyLength: Infinity,
  protocol: 'http:',
  path: '/undefined/api/v2/documents/upload',
  method: 'POST',
  headers: [Object: null prototype],
  agents: [Object],
  auth: undefined,
  family: undefined,
  lookup: undefined,
  beforeRedirect: [Function: dispatchBeforeRedirect],
  beforeRedirects: [Object],
  hostname: 'localhost',
  port: '',
  agent: undefined,
  nativeProtocols: [Object],
  pathname: '/undefined/api/v2/documents/upload'
},
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 29628,
_requestBodyBuffers: [
  [Object], [Object],
  [Object], [Object],
  [Object], [Object],
  [Object], [Object],
  [Object]
],
_onNativeResponse: [Function (anonymous)],
_currentRequest: ClientRequest {
  _events: [Object: null prototype],
  _eventsCount: 7,
  _maxListeners: undefined,
  outputData: [],
  outputSize: 0,
  writable: true,
  destroyed: false,
  _last: true,
  chunkedEncoding: false,
  shouldKeepAlive: false,
  maxRequestsOnConnectionReached: false,
  _defaultKeepAlive: true,
  useChunkedEncodingByDefault: true,
  sendDate: false,
  _removedConnection: false,
  _removedContLen: false,
  _removedTE: false,
  strictContentLength: false,
  _contentLength: '29642',
  _hasBody: true,
  _trailer: '',
  finished: true,
  _headerSent: true,
  _closed: false,
  socket: [Socket],
  _header: 'POST /undefined/api/v2/documents/upload HTTP/1.1\r\n' +
    'Accept: application/json, text/plain, */*\r\n' +
    'Content-Type: multipart/form-data; boundary=--------------------------387809854697238603383923\r\n' +
    'Authorization: Bearer \r\n' +
    'User-Agent: axios/1.4.0\r\n' +
    'Content-Length: 29642\r\n' +
    'Accept-Encoding: gzip, compress, deflate, br\r\n' +
    'Host: localhost\r\n' +
    'Connection: close\r\n' +
    '\r\n',
  _keepAliveTimeout: 0,
  _onPendingData: [Function: nop],
  agent: [Agent],
  socketPath: undefined,
  method: 'POST',
  maxHeaderSize: undefined,
  insecureHTTPParser: undefined,
  path: '/undefined/api/v2/documents/upload',
  _ended: false,
  res: null,
  aborted: false,
  timeoutCb: null,
  upgradeOrConnect: false,
  parser: null,
  maxHeadersCount: null,
  reusedSocket: false,
  host: 'localhost',
  protocol: 'http:',
  _redirectable: [Circular *1],
  [Symbol(kCapture)]: false,
  [Symbol(kBytesWritten)]: 0,
  [Symbol(kEndCalled)]: true,
  [Symbol(kNeedDrain)]: true,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype],
  [Symbol(kUniqueHeaders)]: null
},
_currentUrl: 'http://localhost/undefined/api/v2/documents/upload',
_timeout: null,
[Symbol(kCapture)]: false

}, cause: Error: connect ECONNREFUSED 127.0.0.1:80 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) { errno: -61, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 80 } }

jiaxiaxia commented 5 months ago

Thank you for your feedback, and I noticed that the API_KEY isn't set correctly. You can refer to this link for instructions on how to properly set the API_KEY: https://github.com/chatdoc-com/ChatDOC-API-Demo?tab=readme-ov-file#custom-server-environment.

  1. run cp ./.env.template ./.env

  2. Fill in API_KEY in the .env file.