SkyaTura / gpt-subb

gpt-subb is a command-line tool to translate and convert subtitles using OpenAI's Chat-GPT language models
GNU General Public License v3.0
15 stars 3 forks source link

sometimes getting prompt failed. #3

Closed ghost closed 1 year ago

ghost commented 1 year ago

Using Arch Linux, node 16, command gpt-subb -m gpt-3.5-turbo -l tr -f SRT tesst/[Judas]\ High\ School\ DxD\ S1\ -\ 01.srt

  prompt: 'Translate the following text into tr but keep the 6 digit codes between < > intact:\n' +
    '\n' +
    '<YRD613>\n' +
    '<font face="ITC Stone Sans Std Medium" size="52"><b>A-A devil?</b></font>\n' +
    '<000000>\n' +
    '<XJK848>\n' +
    '<font face="ITC Stone Sans Std Medium" size="52"><b>And your master.</b></font>\n' +
    '<000000>\n' +
    '<JIQ772>\n' +
    '<font face="ITC Stone Sans Std Medium" size="52"><b>Nice to have you, Hyoudou Issei-kun.</b></font>\n' +
    '<000000>\n' +
    '<IFM795>\n' +
    '<font face="Boopee" size="50" color="#d0d52a"><font color="#fdfdfd"><font color="#f91600">High School DxD</font></font></font>\n' +
    '<000000>\n' +
    '<EQX360>\n' +
    '<font face="Boopee" size="50" color="#d0d52a"><font color="#ff5169"><font color="#f91600">High School DxD</font></font></font>\n' +
    '<000000>\n' +
    '<ZBX292>\n' +
    '<font face="Boopee" size="50" color="#d0d52a"><font color="#ff5064">High School DxD</font></font>\n' +
    '<000000>\n' +
    '<IBN377>\n' +
    '<font face="Boopee" size="50" color="#d0d52a"><font color="#ff5300">High School DxD</font></font>\n' +
    '<000000>\n' +
    '<LUI665>\n' +
    '<font face="Boopee" size="50" color="#d0d52a"><font color="#f19498">High School DxD</font></font>\n' +
    '<000000>\n' +
    '<EAA572>\n' +
    '<font face="Boopee" size="50" color="#d0d52a"><font color="#dcd0f8">High School DxD</font></font>\n' +
    '<000000>\n' +
    '<XGY981>\n' +
    '<font face="Aurulent Sans" size="50">The lines come together with a distant voice calling in the skies,</font>\n' +
    '<000000>\n' +
    '<ROG759>\n' +
    '<font face="Baar Sophia" size="50">{\\an8}</font><font face="ITC Stone Sans Std Medium" size="52"><b><font color="#78595b"><font color="#ffffff">ma</font></font></b></font>\n' +
    '<000000>\n' +
    '<OYX736>\n' +
    '<font face="Baar Sophia" size="50">{\\an8}</font><font face="ITC Stone Sans Std Medium" size="52"><b><font color="#78595b"><font color="#ffffff">ji</font></font></b></font>\n' +
    '<000000>\n' +
    '<FLZ693>\n' +
    '<font face="Baar Sophia" size="50">{\\an8}</font><font face="ITC Stone Sans Std Medium" size="52"><b><font color="#78595b"><font color="#ffffff">wa</font></font></b></font>\n' +
    '<000000>\n' +
    '<OUH089>\n' +
    '<font face="Baar Sophia" size="50">{\\an8}</font><font face="ITC Stone Sans Std Medium" size="52"><b><font color="#78595b"><font color="#ffffff">ri</font></font></b></font>\n' +
    '<000000>\n' +
    '<OJI981>\n' +
    '<font face="Baar Sophia" size="50">{\\an8}</font><font face="ITC Stone Sans Std Medium" size="52"><b><font color="#78595b"><font color="#ffffff">a</font></font></b></font>',
  error: Error: Request failed with status code 502
      at createError (/home/tbb/.nvm/versions/node/v16.20.0/lib/node_modules/gpt-subb/node_modules/openai/node_modules/axios/lib/core/createError.js:16:15)
      at settle (/home/tbb/.nvm/versions/node/v16.20.0/lib/node_modules/gpt-subb/node_modules/openai/node_modules/axios/lib/core/settle.js:17:12)
      at IncomingMessage.handleStreamEnd (/home/tbb/.nvm/versions/node/v16.20.0/lib/node_modules/gpt-subb/node_modules/openai/node_modules/axios/lib/adapters/http.js:322:11)
      at IncomingMessage.emit (node:events:525:35)
      at endReadableNT (node:internal/streams/readable:1358:12)
      at processTicksAndRejections (node:internal/process/task_queues:83:21) {
    config: {
      transitional: [Object],
      adapter: [Function: httpAdapter],
      transformRequest: [Array],
      transformResponse: [Array],
      timeout: 0,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      validateStatus: [Function: validateStatus],
      headers: [Object],
      method: 'post',
      data: '{"model":"gpt-3.5-turbo","messages":[{"content":"Translate the following text into tr but keep the 6 digit codes between < > intact:\\n\\n<YRD613>\\n<font face=\\"ITC Stone Sans Std Medium\\" size=\\"52\\"><b>A-A devil?</b></font>\\n<000000>\\n<XJK848>\\n<font face=\\"ITC Stone Sans Std Medium\\" size=\\"52\\"><b>And your master.</b></font>\\n<000000>\\n<JIQ772>\\n<font face=\\"ITC Stone Sans Std Medium\\" size=\\"52\\"><b>Nice to have you, Hyoudou Issei-kun.</b></font>\\n<000000>\\n<IFM795>\\n<font face=\\"Boopee\\" size=\\"50\\" color=\\"#d0d52a\\"><font color=\\"#fdfdfd\\"><font color=\\"#f91600\\">High School DxD</font></font></font>\\n<000000>\\n<EQX360>\\n<font face=\\"Boopee\\" size=\\"50\\" color=\\"#d0d52a\\"><font color=\\"#ff5169\\"><font color=\\"#f91600\\">High School DxD</font></font></font>\\n<000000>\\n<ZBX292>\\n<font face=\\"Boopee\\" size=\\"50\\" color=\\"#d0d52a\\"><font color=\\"#ff5064\\">High School DxD</font></font>\\n<000000>\\n<IBN377>\\n<font face=\\"Boopee\\" size=\\"50\\" color=\\"#d0d52a\\"><font color=\\"#ff5300\\">High School DxD</font></font>\\n<000000>\\n<LUI665>\\n<font face=\\"Boopee\\" size=\\"50\\" color=\\"#d0d52a\\"><font color=\\"#f19498\\">High School DxD</font></font>\\n<000000>\\n<EAA572>\\n<font face=\\"Boopee\\" size=\\"50\\" color=\\"#d0d52a\\"><font color=\\"#dcd0f8\\">High School DxD</font></font>\\n<000000>\\n<XGY981>\\n<font face=\\"Aurulent Sans\\" size=\\"50\\">The lines come together with a distant voice calling in the skies,</font>\\n<000000>\\n<ROG759>\\n<font face=\\"Baar Sophia\\" size=\\"50\\">{\\\\an8}</font><font face=\\"ITC Stone Sans Std Medium\\" size=\\"52\\"><b><font color=\\"#78595b\\"><font color=\\"#ffffff\\">ma</font></font></b></font>\\n<000000>\\n<OYX736>\\n<font face=\\"Baar Sophia\\" size=\\"50\\">{\\\\an8}</font><font face=\\"ITC Stone Sans Std Medium\\" size=\\"52\\"><b><font color=\\"#78595b\\"><font color=\\"#ffffff\\">ji</font></font></b></font>\\n<000000>\\n<FLZ693>\\n<font face=\\"Baar Sophia\\" size=\\"50\\">{\\\\an8}</font><font face=\\"ITC Stone Sans Std Medium\\" size=\\"52\\"><b><font color=\\"#78595b\\"><font color=\\"#ffffff\\">wa</font></font></b></font>\\n<000000>\\n<OUH089>\\n<font face=\\"Baar Sophia\\" size=\\"50\\">{\\\\an8}</font><font face=\\"ITC Stone Sans Std Medium\\" size=\\"52\\"><b><font color=\\"#78595b\\"><font color=\\"#ffffff\\">ri</font></font></b></font>\\n<000000>\\n<OJI981>\\n<font face=\\"Baar Sophia\\" size=\\"50\\">{\\\\an8}</font><font face=\\"ITC Stone Sans Std Medium\\" size=\\"52\\"><b><font color=\\"#78595b\\"><font color=\\"#ffffff\\">a</font></font></b></font>","role":"user"}],"temperature":0.4}',
      url: 'https://api.openai.com/v1/chat/completions'
    },
    request: 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: 2478,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      _closed: false,
      socket: [TLSSocket],
      _header: 'POST /v1/chat/completions HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'Content-Type: application/json\r\n' +
        'User-Agent: OpenAI/NodeJS/3.2.1\r\n' +
        'Authorization: Bearer (they were key )n' +
        'Content-Length: 2478\r\n' +
        'Host: api.openai.com\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'POST',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      path: '/v1/chat/completions',
      _ended: true,
      res: [IncomingMessage],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'api.openai.com',
      protocol: 'https:',
      _redirectable: [Writable],
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kEndCalled)]: true,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(kUniqueHeaders)]: null
    },
    response: {
      status: 502,
      statusText: 'Bad Gateway',
      headers: [Object],
      config: [Object],
      request: [ClientRequest],
      data: '<html>\r\n' +
        '<head><title>502 Bad Gateway</title></head>\r\n' +
        '<body>\r\n' +
        '<center><h1>502 Bad Gateway</h1></center>\r\n' +
        '<hr><center>cloudflare</center>\r\n' +
        '</body>\r\n' +
        '</html>\r\n'
    },
    isAxiosError: true,
    toJSON: [Function: toJSON]
  }
}
Translating queue 25 of 35... failed! (skipping)
ghost commented 1 year ago

also is there anyway to save the output to same folder as input file like I gave the command above already but it saves my home folder instead of the wanted one.

SkyaTura commented 1 year ago

Hey @toprak .

502 is a server error, more specifically on Cloudflare's side. Which means this is not related to the tool itself.


I'll add your suggestion of output on the origin path in the new version