Nikro / MMM-WhisperGPT

A Whisper + ChatGPT MagicMirror Module.
https://nikro.me/articles/professional/crafting-our-ai-assistant/
MIT License
34 stars 1 forks source link

Connection refused #4

Closed chuckTH closed 12 months ago

chuckTH commented 1 year ago

I have Whisper and Mimic running on a server, when trying to make a request from the mirror, I get this axios error:

`[14.09.2023 12:26.49.147] [ERROR] Error uploading file: AxiosError: connect ECONNREFUSED ::1:80 at AxiosError.from (/home/pi/MagicMirror/modules/MMM-WhisperGPT/node_modules/axios/dist/node/axios.cjs:836:14) at RedirectableRequest.handleRequestError (/home/pi/MagicMirror/modules/MMM-WhisperGPT/node_modules/axios/dist/node/axios.cjs:3010:25) at RedirectableRequest.emit (node:events:526:35) at eventHandlers. (/home/pi/MagicMirror/modules/MMM-WhisperGPT/node_modules/follow-redirects/index.js:14:24) at ClientRequest.emit (node:events:514:28) at Socket.socketErrorListener (node:_http_client:501:9) at Socket.emit (node:events:514: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) { port: 80, address: '::1', syscall: 'connect', code: 'ECONNREFUSED', errno: -111, config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [ 'xhr', 'http' ], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, 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=--------------------------751421172292702686143612', 'User-Agent': 'axios/1.4.0', 'Content-Length': '122615', 'Accept-Encoding': 'gzip, compress, deflate, br' }, params: { method: 'openai-whisper', task: 'transcribe', language: 'en', encode: true, output: 'json' }, method: 'post', url: '192.168.0.18:9000/asr', data: FormData { _overheadLength: 159, _valueLength: 0, _valuesToMeasure: [Array], writable: true, readable: true, dataSize: 0, maxDataSize: 2097152, pauseStreams: true, _released: true, _streams: [Array], _currentStream: [DelayedStream], _insideLoop: false, _pendingNext: false, _boundary: '--------------------------751421172292702686143612', _events: [Object: null prototype], _eventsCount: 4 } }, 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: [Function: handleRequestSocket]
},
_eventsCount: 3,
_maxListeners: undefined,
_options: {
  maxRedirects: 21,
  maxBodyLength: Infinity,
  protocol: 'http:',
  path: '/192.168.0.18:9000/asr?method=openai-whisper&task=transcribe&language=en&encode=true&output=json',
  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: '/192.168.0.18:9000/asr',
  search: '?method=openai-whisper&task=transcribe&language=en&encode=true&output=json'
},
_ended: false,
_ending: false,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 122557,
_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: true,
  chunkedEncoding: false,
  shouldKeepAlive: false,
  maxRequestsOnConnectionReached: false,
  _defaultKeepAlive: true,
  useChunkedEncodingByDefault: true,
  sendDate: false,
  _removedConnection: false,
  _removedContLen: false,
  _removedTE: false,
  strictContentLength: false,
  _contentLength: '122615',
  _hasBody: true,
  _trailer: '',
  finished: false,
  _headerSent: true,
  _closed: false,
  socket: [Socket],
  _header: 'POST /192.168.0.18:9000/asr?method=openai-whisper&task=transcribe&language=en&encode=true&output=json HTTP/1.1\r\n' +
    'Accept: application/json, text/plain, */*\r\n' +
    'Content-Type: multipart/form-data; boundary=--------------------------751421172292702686143612\r\n' +
    'User-Agent: axios/1.4.0\r\n' +
    'Content-Length: 122615\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,
  joinDuplicateHeaders: undefined,
  path: '/192.168.0.18:9000/asr?method=openai-whisper&task=transcribe&language=en&encode=true&output=json',
  _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(kNeedDrain)]: true,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype],
  [Symbol(errored)]: null,
  [Symbol(kHighWaterMark)]: 16384,
  [Symbol(kRejectNonStandardBodyWrites)]: false,
  [Symbol(kUniqueHeaders)]: null
},
_currentUrl: 'http://localhost/192.168.0.18:9000/asr?method=openai-whisper&task=transcribe&language=en&encode=true&output=json',
[Symbol(kCapture)]: false

}, cause: Error: connect ECONNREFUSED ::1:80 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '::1', port: 80 } } [14.09.2023 12:26.49.157] [ERROR] Whoops! There was an uncaught exception... [14.09.2023 12:26.49.158] [ERROR] TypeError: Cannot read properties of undefined (reading 'toLowerCase') at Class.stopRecording (/home/pi/MagicMirror/modules/MMM-WhisperGPT/node_helper.js:213:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) `

Calls my attention this part: _currentUrl: 'http://localhost/192.168.0.18:9000/asr?method=openai-

Nikro commented 1 year ago

Hey @chuckTH - did you use the Whisper with the Restful API wrapper around it? Make sure you can make the calls via cURL or that you can access the API's docs so you can make some dummy calls and see if it all works. Once you made sure it works, then you can fiddle with the settings.

I used this project: https://github.com/ahmetoner/whisper-asr-webservice