chatdoc-com / ChatDOC-API-Demo

39 stars 13 forks source link

在Mac上部署后文件无法上传 #4

Open wangyf2001 opened 1 year ago

wangyf2001 commented 1 year ago

request error: AxiosError [AggregateError] at AxiosError.from (file:///Users/ocewang/Downloads/ChatDOC-API-Demo-main/node_modules/.pnpm/axios@1.4.0/node_modules/axios/lib/core/AxiosError.js:89:14) at RedirectableRequest.handleRequestError (file:///Users/ocewang/Downloads/ChatDOC-API-Demo-main/node_modules/.pnpm/axios@1.4.0/node_modules/axios/lib/adapters/http.js:591:25) at RedirectableRequest.emit (node:events:527:35) at eventHandlers. (/Users/ocewang/Downloads/ChatDOC-API-Demo-main/node_modules/.pnpm/follow-redirects@1.15.2/node_modules/follow-redirects/index.js:14:24) at ClientRequest.emit (node:events:515:28) at Socket.socketErrorListener (node:_http_client:495:9) at Socket.emit (node:events:515:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { code: 'ECONNREFUSED', errors: [ Error: connect ECONNREFUSED ::1:80 at createConnectionError (node:net:1634:14) at afterConnectMultiple (node:net:1664:40) { errno: -61, code: 'ECONNREFUSED', syscall: 'connect', address: '::1', port: 80 }, Error: connect ECONNREFUSED 127.0.0.1:80 at createConnectionError (node:net:1634:14) at afterConnectMultiple (node:net:1664:40) { errno: -61, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 80 }

截屏2023-11-13 10 46 07
jiaxiaxia commented 1 year ago

这个错误一般是网络异常导致,可以切换下网络再试试。

wangyf2001 commented 1 year ago

这个错误一般是网络异常导致,可以切换下网络再试试。

感谢您的回复,切换了网络之后还是一样的错误

request error: AxiosError [AggregateError] at AxiosError.from (file:///Users/ocewang/Downloads/ChatDOC-API-Demo-main/node_modules/.pnpm/axios@1.4.0/node_modules/axios/lib/core/AxiosError.js:89:14) at RedirectableRequest.handleRequestError (file:///Users/ocewang/Downloads/ChatDOC-API-Demo-main/node_modules/.pnpm/axios@1.4.0/node_modules/axios/lib/adapters/http.js:591:25) at RedirectableRequest.emit (node:events:527:35) at eventHandlers. (/Users/ocewang/Downloads/ChatDOC-API-Demo-main/node_modules/.pnpm/follow-redirects@1.15.2/node_modules/follow-redirects/index.js:14:24) at ClientRequest.emit (node:events:515:28) at Socket.socketErrorListener (node:_http_client:495:9) at Socket.emit (node:events:515:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { code: 'ECONNREFUSED', errors: [ Error: connect ECONNREFUSED 127.0.0.1:80 at createConnectionError (node:net:1634:14) at afterConnectMultiple (node:net:1664:40) { errno: -61, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 80 }, Error: connect ECONNREFUSED ::1:80 at createConnectionError (node:net:1634:14) at afterConnectMultiple (node:net:1664:40) { errno: -61, code: 'ECONNREFUSED', syscall: 'connect', address: '::1', port: 80 } ],

jiaxiaxia commented 1 year ago

请问你设置代理或者防火墙了吗?把这些关掉再试试

wangyf2001 commented 1 year ago

请问你设置代理或者防火墙了吗?把这些关掉再试试

截屏2023-11-13 14 57 28 截屏2023-11-13 14 58 15

代理防火墙均已关闭,还是相同错误

jiaxiaxia commented 1 year ago

你的命令行窗口应该有具体的报错信息,方便发一下,看一下请求的API_KEY以及API path信息

wangyf2001 commented 1 year ago

你的命令行窗口应该有具体的报错信息,方便发一下,看一下请求的API_KEY以及API path信息

imported.

request error: AxiosError [AggregateError] at AxiosError.from (file:///Users/ocewang/Downloads/ChatDOC-API-Demo-main/node_modules/.pnpm/axios@1.4.0/node_modules/axios/lib/core/AxiosError.js:89:14) at RedirectableRequest.handleRequestError (file:///Users/ocewang/Downloads/ChatDOC-API-Demo-main/node_modules/.pnpm/axios@1.4.0/node_modules/axios/lib/adapters/http.js:591:25) at RedirectableRequest.emit (node:events:527:35) at eventHandlers. (/Users/ocewang/Downloads/ChatDOC-API-Demo-main/node_modules/.pnpm/follow-redirects@1.15.2/node_modules/follow-redirects/index.js:14:24) at ClientRequest.emit (node:events:515:28) at Socket.socketErrorListener (node:_http_client:495:9) at Socket.emit (node:events:515:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { code: 'ECONNREFUSED', errors: [ Error: connect ECONNREFUSED 127.0.0.1:80 at createConnectionError (node:net:1634:14) at afterConnectMultiple (node:net:1664:40) { errno: -61, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 80 }, Error: connect ECONNREFUSED ::1:80 at createConnectionError (node:net:1634:14) at afterConnectMultiple (node:net:1664:40) { errno: -61, code: 'ECONNREFUSED', syscall: 'connect', address: '::1', port: 80 } ], 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: [class Blob] }, validateStatus: [Function: validateStatus], headers: AxiosHeaders { Accept: 'application/json, text/plain, /', 'Content-Type': 'multipart/form-data; boundary=--------------------------094104359771674959281698', Authorization: 'Bearer ', 'User-Agent': 'axios/1.4.0', 'Content-Length': '2248729', 'Accept-Encoding': 'gzip, compress, deflate, br' }, baseURL: 'undefined/api/v2', method: 'post', url: 'documents/upload', data: FormData { _overheadLength: 272, _valueLength: 5, _valuesToMeasure: [Array], writable: true, readable: true, dataSize: 0, maxDataSize: 2097152, pauseStreams: true, _released: true, _streams: [Array], _currentStream: [DelayedStream], _insideLoop: false, _pendingNext: false, _boundary: '--------------------------094104359771674959281698', _events: [Object: null prototype], _eventsCount: 4 } }, request: <ref *1> Writable { _writableState: WritableState { highWaterMark: 16384, length: 0, corked: 0, onwrite: [Function: bound onwrite], writelen: 0, bufferedIndex: 0, pendingcb: 0,

  [Symbol(kBufferedValue)]: null
},
_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: false,
_ending: false,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 131231,
_requestBodyBuffers: [ [Object], [Object], [Object] ],
_onNativeResponse: [Function (anonymous)],
_currentRequest: ClientRequest {
  _events: [Object: null prototype],
  _eventsCount: 7,
  _maxListeners: undefined,
  outputData: [],
  outputSize: 0,
  writable: true,
  destroyed: false,
  _last: false,
  chunkedEncoding: false,
  shouldKeepAlive: true,
  maxRequestsOnConnectionReached: false,
  _defaultKeepAlive: true,
  useChunkedEncodingByDefault: true,
  sendDate: false,
  _removedConnection: false,
  _removedContLen: false,
  _removedTE: false,
  strictContentLength: false,
  _contentLength: '2248729',
  _hasBody: true,
  _trailer: '',
  finished: false,
  _headerSent: true,
  _closed: false,
  _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=--------------------------094104359771674959281698\r\n' +
    'Authorization: Bearer \r\n' +
    'User-Agent: axios/1.4.0\r\n' +
    'Content-Length: 2248729\r\n' +
    'Accept-Encoding: gzip, compress, deflate, br\r\n' +
    'Host: localhost\r\n' +
    'Connection: keep-alive\r\n' +
    '\r\n',
  _keepAliveTimeout: 0,
  _onPendingData: [Function: nop],
  agent: [Agent],
  socketPath: undefined,
  method: 'POST',
  maxHeaderSize: undefined,
  insecureHTTPParser: undefined,
  joinDuplicateHeaders: undefined,
  path: '/undefined/api/v2/documents/upload',
  _ended: false,
  res: null,
  aborted: false,
  timeoutCb: [Function: emitRequestTimeout],
  upgradeOrConnect: false,
  parser: null,
  maxHeadersCount: null,
  reusedSocket: false,
  host: 'localhost',
  protocol: 'http:',
  _redirectable: [Circular *1],
  [Symbol(kCapture)]: false,
  [Symbol(kBytesWritten)]: 0,
  [Symbol(kNeedDrain)]: true,
  [Symbol(corked)]: 0,
  [Symbol(kChunkedBuffer)]: [],
  [Symbol(kChunkedLength)]: 0,
  [Symbol(kSocket)]: [Socket],
  [Symbol(kOutHeaders)]: [Object: null prototype],
  [Symbol(errored)]: null,
  [Symbol(kHighWaterMark)]: 16384,
  [Symbol(kRejectNonStandardBodyWrites)]: false,
  [Symbol(kUniqueHeaders)]: null
},
_currentUrl: 'http://localhost/undefined/api/v2/documents/upload',
_timeout: null,
[Symbol(kCapture)]: false

}, cause: AggregateError at internalConnectMultiple (node:net:1114:18) at afterConnectMultiple (node:net:1667:5) { code: 'ECONNREFUSED', [errors]: [ [Error], [Error] ] } } 这是全部的报错信息

jiaxiaxia commented 1 year ago

是API_KEY没有设置对, image

wangyf2001 commented 1 year ago

是API_KEY没有设置对, image

截屏2023-11-14 10 35 27

设置之后上传仍有问题

wangyf2001 commented 1 year ago

是API_KEY没有设置对, image

或者能否提供一个使用python,借助APIkey返回结果的方式

jiaxiaxia commented 1 year ago

api.chatdoc.com这个地址需要代理才能访问,没有代理的话,建议将env.mjs文件中API_HOST的地址换成.site

.....
  } else {
    API_HOST = 'https://api.chatdoc.com';
  }
}

改成


.....
  } else {
    API_HOST = 'https://api.chatdoc.site';
  }
}
wangyf2001 commented 1 year ago

api.chatdoc.com这个地址需要代理才能访问,没有代理的话,建议将env.mjs文件中API_HOST的地址换成.site

.....
  } else {
    API_HOST = 'https://api.chatdoc.com';
  }
}

改成

.....
  } else {
    API_HOST = 'https://api.chatdoc.site';
  }
}

请问有简洁的使用python请求接口的代码吗?

jiaxiaxia commented 1 year ago

api.chatdoc.com这个地址需要代理才能访问,没有代理的话,建议将env.mjs文件中API_HOST的地址换成.site

.....
  } else {
    API_HOST = 'https://api.chatdoc.com';
  }
}

改成

.....
  } else {
    API_HOST = 'https://api.chatdoc.site';
  }
}

请问有简洁的使用python请求接口的代码吗?

目前没有,这是API的文档链接https://api-reference.paodingjiewen.com/

hello-lui commented 10 months ago

api.chatdoc.com 예시프정착이 필요하다고, 안녕하세요, 임시가없는env.mjs 파일의API_HOST 주소를 .site다음으로로바꾸는 것이 좋습니다.

.....
  } else {
    API_HOST = 'https://api.chatdoc.com';
  }
}

로변경

.....
  } else {
    API_HOST = 'https://api.chatdoc.site';
  }
}

Python 터페이스를 사용하기 위해 간결한 코드가 있습니까?

I'm facing the same issue. Has it been resolved by any chance?