UNPKG

smart-error-explanator

Version:

A Node.js SDK that explains cryptic error messages using OpenAI's API.

1 lines 3.34 kB
(function(_0x349cda,_0x1e023a){const _0x254dfe=a0_0x32e6,_0x24aaef=_0x349cda();while(!![]){try{const _0x334e3d=parseInt(_0x254dfe(0xf8))/0x1*(-parseInt(_0x254dfe(0xf1))/0x2)+parseInt(_0x254dfe(0xfb))/0x3*(-parseInt(_0x254dfe(0xe8))/0x4)+-parseInt(_0x254dfe(0xe4))/0x5+parseInt(_0x254dfe(0xf5))/0x6+parseInt(_0x254dfe(0xf6))/0x7+-parseInt(_0x254dfe(0xfd))/0x8+parseInt(_0x254dfe(0xed))/0x9*(parseInt(_0x254dfe(0xf4))/0xa);if(_0x334e3d===_0x1e023a)break;else _0x24aaef['push'](_0x24aaef['shift']());}catch(_0x5ca0c3){_0x24aaef['push'](_0x24aaef['shift']());}}}(a0_0xa50c,0x42e1c));import{explainError}from'./errorHandler.js';function a0_0x32e6(_0x188aa9,_0x1fba78){const _0xa50ca=a0_0xa50c();return a0_0x32e6=function(_0x32e6f0,_0x4dc6b3){_0x32e6f0=_0x32e6f0-0xe1;let _0x43f543=_0xa50ca[_0x32e6f0];return _0x43f543;},a0_0x32e6(_0x188aa9,_0x1fba78);}function a0_0xa50c(){const _0x2e468f=['355220LDXQeU','cyanBright','message','createInterface','4oZzXrv','\x0a💬\x20ENTERING\x20CHAT\x20MODE\x20TO\x20DISCUSS\x20THE\x20ERROR\x20FURTHER.\x20TYPE\x20\x27exit\x27\x20TO\x20QUIT.','error','whiteBright','exit','9257769NmTRzr','stdin','question','AI:\x20','4672LHPSMr','toString','yellowBright','10zYjImM','33450KvMYjw','744583HySOvg','You\x20can\x20now\x20chat\x20with\x20the\x20AI\x20about\x20the\x20error.\x20Type\x20your\x20questions\x20below.','165XaxChx','Exiting\x20chat\x20mode.','You:\x20','389559aRUsFi','log','2242400jqIsYO','bold','redBright','stdout','toLowerCase','close','\x0a🔍\x20\x20\x20ERROR\x20IN\x20FUNCTION\x20:'];a0_0xa50c=function(){return _0x2e468f;};return a0_0xa50c();}import a0_0x585737 from'chalk';import a0_0x632ad6 from'readline';import{chatWithAI}from'./errorHandler.js';export function wrapFunction(_0x740e95){return async(..._0x521b95)=>{const _0x5b584a=a0_0x32e6,_0xeeb34a=_0x740e95[_0x5b584a(0xf2)]();try{return await _0x740e95(..._0x521b95);}catch(_0x507fef){console[_0x5b584a(0xfc)](a0_0x585737['bgRedBright'][_0x5b584a(0xeb)](_0x5b584a(0xe3))),console[_0x5b584a(0xfc)](a0_0x585737['redBright'](_0xeeb34a)),await explainError(_0x507fef[_0x5b584a(0xe6)],_0xeeb34a,_0x521b95),console[_0x5b584a(0xfc)](a0_0x585737[_0x5b584a(0xfe)][_0x5b584a(0xf3)](_0x5b584a(0xe9))),await startChatSession(_0x507fef[_0x5b584a(0xe6)],_0xeeb34a,_0x521b95),console[_0x5b584a(0xfc)](a0_0x585737['redBright']('Process\x20completed.\x20The\x20console\x20will\x20remain\x20open.'));}};}async function startChatSession(_0x201a99,_0xd96da3,_0x2d895d){const _0x5af1ff=a0_0x32e6,_0x15099c=a0_0x632ad6[_0x5af1ff(0xe7)]({'input':process[_0x5af1ff(0xee)],'output':process[_0x5af1ff(0x100)]});console[_0x5af1ff(0xfc)](a0_0x585737[_0x5af1ff(0xfe)][_0x5af1ff(0xf3)](_0x5af1ff(0xf7)));async function _0x23ccb0(){const _0x546c4c=_0x5af1ff;_0x15099c[_0x546c4c(0xef)](a0_0x585737[_0x546c4c(0xfe)][_0x546c4c(0xf3)](_0x546c4c(0xfa)),async _0x32abb0=>{const _0x266bc5=_0x546c4c;if(_0x32abb0[_0x266bc5(0xe1)]()===_0x266bc5(0xec)){console['log'](a0_0x585737['greenBright'](_0x266bc5(0xf9))),_0x15099c[_0x266bc5(0xe2)]();return;}try{const _0x55ada0=await chatWithAI(_0x32abb0,_0x201a99,_0xd96da3,_0x2d895d);console[_0x266bc5(0xfc)](a0_0x585737[_0x266bc5(0xe5)](_0x266bc5(0xf0)+_0x55ada0));}catch(_0x5300a9){console[_0x266bc5(0xea)](a0_0x585737[_0x266bc5(0xff)]('Error\x20in\x20AI\x20response:',_0x5300a9[_0x266bc5(0xe6)]));}_0x23ccb0();});}_0x23ccb0();}