diff --git a/dist/main.js b/dist/main.js index a18d90a..7a26609 100644 --- a/dist/main.js +++ b/dist/main.js @@ -1,2 +1,2 @@ /*! For license information please see main.js.LICENSE.txt */ -(()=>{var e={36:(e,t,r)=>{"use strict";var n=r(409),a={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var r,o,i,s,c,u,p=!1;t||(t={}),r=t.debug||!1;try{if(i=n(),s=document.createRange(),c=document.getSelection(),(u=document.createElement("span")).textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",(function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=a[t.format]||a.default;window.clipboardData.setData(o,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))})),document.body.appendChild(u),s.selectNodeContents(u),c.addRange(s),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");p=!0}catch(n){r&&console.error("unable to copy using execCommand: ",n),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),p=!0}catch(n){r&&console.error("unable to copy using clipboardData: ",n),r&&console.error("falling back to prompt"),o=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(o,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(s):c.removeAllRanges()),u&&document.body.removeChild(u),i()}return p}},51:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}e.exports="object"==("undefined"==typeof self?"undefined":t(self))?self.FormData:window.FormData},655:function(e,t,r){var n,a,o,i;function s(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof t&&(t={innerHTML:t}),function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if("function"==typeof e)return e(n,a);if(e instanceof Node)t=e;else{if("string"!=typeof e)throw new Error("Invalid tag, ",u(e));t=document.createElement(e)}return Object.keys(n).forEach((function(e){var a=n[e];if(void 0!==a)switch(e){case"child":r(t,a);break;case"children":if(!Array.isArray(a))throw new Error("children must be an array of Nodes");a.flat().forEach((function(e){r(t,e)}));break;case"attr":Object.keys(a).forEach((function(e){t.setAttribute(e,a[e])}));break;case"style":case"dataset":Object.keys(a).forEach((function(r){t[e][r]=a[r]}));break;default:t[e]=a}})),t}(e,t)}return e.d(t,{default:function(){return n}}),Object.defineProperties(n,{get:{value:function(e){return document.querySelector(e)}},getAll:{value:function(e){return s(document.querySelectorAll(e))}},parse:{value:function(e){var t=document.createElement("div");return t.innerHTML=e,1===t.childElementCount?t.firstElementChild:s(t.children)}},text:{value:function(e){return document.createTextNode(e)}},use:{value:function(e){var t=e,r=!1,n=document.createTextNode(e),a=[n];return Object.defineProperty(n,"value",{set:function(e){t=e,a.forEach((function(t){t.textContent=e}))},get:function(){return t}}),Object.defineProperty(n,"clone",{value:function(){if(!r)return r=!0,n;var e=n.cloneNode();return a.push(e),e}}),n}}}),t.default}()},"object"==u(t)&&"object"==u(e)?e.exports=i():(a=[],void 0===(o="function"==typeof(n=i)?n.apply(t,a):n)||(e.exports=o))},482:function(e,t,r){"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(s&&c){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;k(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:j(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}var p=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OpenAIApi=t.OpenAIApiFactory=t.OpenAIApiFp=t.OpenAIApiAxiosParamCreator=t.CreateImageRequestResponseFormatEnum=t.CreateImageRequestSizeEnum=t.ChatCompletionResponseMessageRoleEnum=t.ChatCompletionRequestMessageRoleEnum=void 0;var l=r(369),d=r(996),f=r(791);t.ChatCompletionRequestMessageRoleEnum={System:"system",User:"user",Assistant:"assistant"},t.ChatCompletionResponseMessageRoleEnum={System:"system",User:"user",Assistant:"assistant"},t.CreateImageRequestSizeEnum={_256x256:"256x256",_512x512:"512x512",_1024x1024:"1024x1024"},t.CreateImageRequestResponseFormatEnum={Url:"url",B64Json:"b64_json"},t.OpenAIApiAxiosParamCreator=function(e){var t=this;return{cancelFineTune:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("cancelFineTune","fineTuneId",r),a="/fine-tunes/{fine_tune_id}/cancel".replace("{".concat("fine_tune_id","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"POST"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))},createAnswer:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createAnswer","createAnswerRequest",r),a=new URL("/answers",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createChatCompletion:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createChatCompletion","createChatCompletionRequest",r),a=new URL("/chat/completions",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createClassification:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createClassification","createClassificationRequest",r),a=new URL("/classifications",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createCompletion:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createCompletion","createCompletionRequest",r),a=new URL("/completions",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createEdit:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createEdit","createEditRequest",r),a=new URL("/edits",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createEmbedding:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createEmbedding","createEmbeddingRequest",r),a=new URL("/embeddings",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createFile:function(r,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return p(t,void 0,void 0,u().mark((function t(){var o,i,s,c,p,l,f;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createFile","file",r),d.assertParamExists("createFile","purpose",n),o=new URL("/files",d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"POST"},i),a),c={},p={},l=new(e&&e.formDataCtor||FormData),void 0!==r&&l.append("file",r),void 0!==n&&l.append("purpose",n),c["Content-Type"]="multipart/form-data",d.setSearchParams(o,p),f=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign(Object.assign({},c),l.getHeaders()),f),a.headers),s.data=l,t.abrupt("return",{url:d.toPathString(o),options:s});case 17:case"end":return t.stop()}}),t)})))},createFineTune:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createFineTune","createFineTuneRequest",r),a=new URL("/fine-tunes",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createImage:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createImage","createImageRequest",r),a=new URL("/images/generations",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createImageEdit:function(r,n,a,o,i,s,c){var l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{};return p(t,void 0,void 0,u().mark((function t(){var p,f,h,g,v,m,y;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createImageEdit","image",r),d.assertParamExists("createImageEdit","prompt",n),p=new URL("/images/edits",d.DUMMY_BASE_URL),e&&(f=e.baseOptions),h=Object.assign(Object.assign({method:"POST"},f),l),g={},v={},m=new(e&&e.formDataCtor||FormData),void 0!==r&&m.append("image",r),void 0!==a&&m.append("mask",a),void 0!==n&&m.append("prompt",n),void 0!==o&&m.append("n",o),void 0!==i&&m.append("size",i),void 0!==s&&m.append("response_format",s),void 0!==c&&m.append("user",c),g["Content-Type"]="multipart/form-data",d.setSearchParams(p,v),y=f&&f.headers?f.headers:{},h.headers=Object.assign(Object.assign(Object.assign(Object.assign({},g),m.getHeaders()),y),l.headers),h.data=m,t.abrupt("return",{url:d.toPathString(p),options:h});case 22:case"end":return t.stop()}}),t)})))},createImageVariation:function(r,n,a,o,i){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};return p(t,void 0,void 0,u().mark((function t(){var c,p,l,f,h,g,v;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createImageVariation","image",r),c=new URL("/images/variations",d.DUMMY_BASE_URL),e&&(p=e.baseOptions),l=Object.assign(Object.assign({method:"POST"},p),s),f={},h={},g=new(e&&e.formDataCtor||FormData),void 0!==r&&g.append("image",r),void 0!==n&&g.append("n",n),void 0!==a&&g.append("size",a),void 0!==o&&g.append("response_format",o),void 0!==i&&g.append("user",i),f["Content-Type"]="multipart/form-data",d.setSearchParams(c,h),v=p&&p.headers?p.headers:{},l.headers=Object.assign(Object.assign(Object.assign(Object.assign({},f),g.getHeaders()),v),s.headers),l.data=g,t.abrupt("return",{url:d.toPathString(c),options:l});case 19:case"end":return t.stop()}}),t)})))},createModeration:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createModeration","createModerationRequest",r),a=new URL("/moderations",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createSearch:function(r,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return p(t,void 0,void 0,u().mark((function t(){var o,i,s,c,p,l,f;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createSearch","engineId",r),d.assertParamExists("createSearch","createSearchRequest",n),o="/engines/{engine_id}/search".replace("{".concat("engine_id","}"),encodeURIComponent(String(r))),i=new URL(o,d.DUMMY_BASE_URL),e&&(s=e.baseOptions),c=Object.assign(Object.assign({method:"POST"},s),a),l={},(p={})["Content-Type"]="application/json",d.setSearchParams(i,l),f=s&&s.headers?s.headers:{},c.headers=Object.assign(Object.assign(Object.assign({},p),f),a.headers),c.data=d.serializeDataIfNeeded(n,c,e),t.abrupt("return",{url:d.toPathString(i),options:c});case 14:case"end":return t.stop()}}),t)})))},createTranscription:function(r,n,a,o,i,s){var c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{};return p(t,void 0,void 0,u().mark((function t(){var p,l,f,h,g,v,m;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createTranscription","file",r),d.assertParamExists("createTranscription","model",n),p=new URL("/audio/transcriptions",d.DUMMY_BASE_URL),e&&(l=e.baseOptions),f=Object.assign(Object.assign({method:"POST"},l),c),h={},g={},v=new(e&&e.formDataCtor||FormData),void 0!==r&&v.append("file",r),void 0!==n&&v.append("model",n),void 0!==a&&v.append("prompt",a),void 0!==o&&v.append("response_format",o),void 0!==i&&v.append("temperature",i),void 0!==s&&v.append("language",s),h["Content-Type"]="multipart/form-data",d.setSearchParams(p,g),m=l&&l.headers?l.headers:{},f.headers=Object.assign(Object.assign(Object.assign(Object.assign({},h),v.getHeaders()),m),c.headers),f.data=v,t.abrupt("return",{url:d.toPathString(p),options:f});case 21:case"end":return t.stop()}}),t)})))},createTranslation:function(r,n,a,o,i){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};return p(t,void 0,void 0,u().mark((function t(){var c,p,l,f,h,g,v;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createTranslation","file",r),d.assertParamExists("createTranslation","model",n),c=new URL("/audio/translations",d.DUMMY_BASE_URL),e&&(p=e.baseOptions),l=Object.assign(Object.assign({method:"POST"},p),s),f={},h={},g=new(e&&e.formDataCtor||FormData),void 0!==r&&g.append("file",r),void 0!==n&&g.append("model",n),void 0!==a&&g.append("prompt",a),void 0!==o&&g.append("response_format",o),void 0!==i&&g.append("temperature",i),f["Content-Type"]="multipart/form-data",d.setSearchParams(c,h),v=p&&p.headers?p.headers:{},l.headers=Object.assign(Object.assign(Object.assign(Object.assign({},f),g.getHeaders()),v),s.headers),l.data=g,t.abrupt("return",{url:d.toPathString(c),options:l});case 20:case"end":return t.stop()}}),t)})))},deleteFile:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("deleteFile","fileId",r),a="/files/{file_id}".replace("{".concat("file_id","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"DELETE"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))},deleteModel:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("deleteModel","model",r),a="/models/{model}".replace("{".concat("model","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"DELETE"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))},downloadFile:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("downloadFile","fileId",r),a="/files/{file_id}/content".replace("{".concat("file_id","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"GET"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))},listEngines:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return p(t,void 0,void 0,u().mark((function t(){var n,a,o,i,s,c;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new URL("/engines",d.DUMMY_BASE_URL),e&&(a=e.baseOptions),o=Object.assign(Object.assign({method:"GET"},a),r),i={},s={},d.setSearchParams(n,s),c=a&&a.headers?a.headers:{},o.headers=Object.assign(Object.assign(Object.assign({},i),c),r.headers),t.abrupt("return",{url:d.toPathString(n),options:o});case 10:case"end":return t.stop()}}),t)})))},listFiles:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return p(t,void 0,void 0,u().mark((function t(){var n,a,o,i,s,c;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new URL("/files",d.DUMMY_BASE_URL),e&&(a=e.baseOptions),o=Object.assign(Object.assign({method:"GET"},a),r),i={},s={},d.setSearchParams(n,s),c=a&&a.headers?a.headers:{},o.headers=Object.assign(Object.assign(Object.assign({},i),c),r.headers),t.abrupt("return",{url:d.toPathString(n),options:o});case 10:case"end":return t.stop()}}),t)})))},listFineTuneEvents:function(r,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return p(t,void 0,void 0,u().mark((function t(){var o,i,s,c,p,l,f;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("listFineTuneEvents","fineTuneId",r),o="/fine-tunes/{fine_tune_id}/events".replace("{".concat("fine_tune_id","}"),encodeURIComponent(String(r))),i=new URL(o,d.DUMMY_BASE_URL),e&&(s=e.baseOptions),c=Object.assign(Object.assign({method:"GET"},s),a),p={},l={},void 0!==n&&(l.stream=n),d.setSearchParams(i,l),f=s&&s.headers?s.headers:{},c.headers=Object.assign(Object.assign(Object.assign({},p),f),a.headers),t.abrupt("return",{url:d.toPathString(i),options:c});case 12:case"end":return t.stop()}}),t)})))},listFineTunes:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return p(t,void 0,void 0,u().mark((function t(){var n,a,o,i,s,c;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new URL("/fine-tunes",d.DUMMY_BASE_URL),e&&(a=e.baseOptions),o=Object.assign(Object.assign({method:"GET"},a),r),i={},s={},d.setSearchParams(n,s),c=a&&a.headers?a.headers:{},o.headers=Object.assign(Object.assign(Object.assign({},i),c),r.headers),t.abrupt("return",{url:d.toPathString(n),options:o});case 10:case"end":return t.stop()}}),t)})))},listModels:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return p(t,void 0,void 0,u().mark((function t(){var n,a,o,i,s,c;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new URL("/models",d.DUMMY_BASE_URL),e&&(a=e.baseOptions),o=Object.assign(Object.assign({method:"GET"},a),r),i={},s={},d.setSearchParams(n,s),c=a&&a.headers?a.headers:{},o.headers=Object.assign(Object.assign(Object.assign({},i),c),r.headers),t.abrupt("return",{url:d.toPathString(n),options:o});case 10:case"end":return t.stop()}}),t)})))},retrieveEngine:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("retrieveEngine","engineId",r),a="/engines/{engine_id}".replace("{".concat("engine_id","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"GET"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))},retrieveFile:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("retrieveFile","fileId",r),a="/files/{file_id}".replace("{".concat("file_id","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"GET"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))},retrieveFineTune:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("retrieveFineTune","fineTuneId",r),a="/fine-tunes/{fine_tune_id}".replace("{".concat("fine_tune_id","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"GET"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))},retrieveModel:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("retrieveModel","model",r),a="/models/{model}".replace("{".concat("model","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"GET"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))}}},t.OpenAIApiFp=function(e){var r=t.OpenAIApiAxiosParamCreator(e);return{cancelFineTune:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.cancelFineTune(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createAnswer:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createAnswer(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createChatCompletion:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createChatCompletion(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createClassification:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createClassification(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createCompletion:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createCompletion(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createEdit:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createEdit(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createEmbedding:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createEmbedding(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createFile:function(t,n,a){return p(this,void 0,void 0,u().mark((function o(){var i;return u().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,r.createFile(t,n,a);case 2:return i=o.sent,o.abrupt("return",d.createRequestFunction(i,l.default,f.BASE_PATH,e));case 4:case"end":return o.stop()}}),o)})))},createFineTune:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createFineTune(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createImage:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createImage(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createImageEdit:function(t,n,a,o,i,s,c,h){return p(this,void 0,void 0,u().mark((function p(){var g;return u().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,r.createImageEdit(t,n,a,o,i,s,c,h);case 2:return g=u.sent,u.abrupt("return",d.createRequestFunction(g,l.default,f.BASE_PATH,e));case 4:case"end":return u.stop()}}),p)})))},createImageVariation:function(t,n,a,o,i,s){return p(this,void 0,void 0,u().mark((function c(){var p;return u().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,r.createImageVariation(t,n,a,o,i,s);case 2:return p=c.sent,c.abrupt("return",d.createRequestFunction(p,l.default,f.BASE_PATH,e));case 4:case"end":return c.stop()}}),c)})))},createModeration:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createModeration(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createSearch:function(t,n,a){return p(this,void 0,void 0,u().mark((function o(){var i;return u().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,r.createSearch(t,n,a);case 2:return i=o.sent,o.abrupt("return",d.createRequestFunction(i,l.default,f.BASE_PATH,e));case 4:case"end":return o.stop()}}),o)})))},createTranscription:function(t,n,a,o,i,s,c){return p(this,void 0,void 0,u().mark((function p(){var h;return u().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,r.createTranscription(t,n,a,o,i,s,c);case 2:return h=u.sent,u.abrupt("return",d.createRequestFunction(h,l.default,f.BASE_PATH,e));case 4:case"end":return u.stop()}}),p)})))},createTranslation:function(t,n,a,o,i,s){return p(this,void 0,void 0,u().mark((function c(){var p;return u().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,r.createTranslation(t,n,a,o,i,s);case 2:return p=c.sent,c.abrupt("return",d.createRequestFunction(p,l.default,f.BASE_PATH,e));case 4:case"end":return c.stop()}}),c)})))},deleteFile:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.deleteFile(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},deleteModel:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.deleteModel(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},downloadFile:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.downloadFile(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},listEngines:function(t){return p(this,void 0,void 0,u().mark((function n(){var a;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.listEngines(t);case 2:return a=n.sent,n.abrupt("return",d.createRequestFunction(a,l.default,f.BASE_PATH,e));case 4:case"end":return n.stop()}}),n)})))},listFiles:function(t){return p(this,void 0,void 0,u().mark((function n(){var a;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.listFiles(t);case 2:return a=n.sent,n.abrupt("return",d.createRequestFunction(a,l.default,f.BASE_PATH,e));case 4:case"end":return n.stop()}}),n)})))},listFineTuneEvents:function(t,n,a){return p(this,void 0,void 0,u().mark((function o(){var i;return u().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,r.listFineTuneEvents(t,n,a);case 2:return i=o.sent,o.abrupt("return",d.createRequestFunction(i,l.default,f.BASE_PATH,e));case 4:case"end":return o.stop()}}),o)})))},listFineTunes:function(t){return p(this,void 0,void 0,u().mark((function n(){var a;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.listFineTunes(t);case 2:return a=n.sent,n.abrupt("return",d.createRequestFunction(a,l.default,f.BASE_PATH,e));case 4:case"end":return n.stop()}}),n)})))},listModels:function(t){return p(this,void 0,void 0,u().mark((function n(){var a;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.listModels(t);case 2:return a=n.sent,n.abrupt("return",d.createRequestFunction(a,l.default,f.BASE_PATH,e));case 4:case"end":return n.stop()}}),n)})))},retrieveEngine:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.retrieveEngine(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},retrieveFile:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.retrieveFile(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},retrieveFineTune:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.retrieveFineTune(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},retrieveModel:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.retrieveModel(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))}}},t.OpenAIApiFactory=function(e,r,n){var a=t.OpenAIApiFp(e);return{cancelFineTune:function(e,t){return a.cancelFineTune(e,t).then((function(e){return e(n,r)}))},createAnswer:function(e,t){return a.createAnswer(e,t).then((function(e){return e(n,r)}))},createChatCompletion:function(e,t){return a.createChatCompletion(e,t).then((function(e){return e(n,r)}))},createClassification:function(e,t){return a.createClassification(e,t).then((function(e){return e(n,r)}))},createCompletion:function(e,t){return a.createCompletion(e,t).then((function(e){return e(n,r)}))},createEdit:function(e,t){return a.createEdit(e,t).then((function(e){return e(n,r)}))},createEmbedding:function(e,t){return a.createEmbedding(e,t).then((function(e){return e(n,r)}))},createFile:function(e,t,o){return a.createFile(e,t,o).then((function(e){return e(n,r)}))},createFineTune:function(e,t){return a.createFineTune(e,t).then((function(e){return e(n,r)}))},createImage:function(e,t){return a.createImage(e,t).then((function(e){return e(n,r)}))},createImageEdit:function(e,t,o,i,s,c,u,p){return a.createImageEdit(e,t,o,i,s,c,u,p).then((function(e){return e(n,r)}))},createImageVariation:function(e,t,o,i,s,c){return a.createImageVariation(e,t,o,i,s,c).then((function(e){return e(n,r)}))},createModeration:function(e,t){return a.createModeration(e,t).then((function(e){return e(n,r)}))},createSearch:function(e,t,o){return a.createSearch(e,t,o).then((function(e){return e(n,r)}))},createTranscription:function(e,t,o,i,s,c,u){return a.createTranscription(e,t,o,i,s,c,u).then((function(e){return e(n,r)}))},createTranslation:function(e,t,o,i,s,c){return a.createTranslation(e,t,o,i,s,c).then((function(e){return e(n,r)}))},deleteFile:function(e,t){return a.deleteFile(e,t).then((function(e){return e(n,r)}))},deleteModel:function(e,t){return a.deleteModel(e,t).then((function(e){return e(n,r)}))},downloadFile:function(e,t){return a.downloadFile(e,t).then((function(e){return e(n,r)}))},listEngines:function(e){return a.listEngines(e).then((function(e){return e(n,r)}))},listFiles:function(e){return a.listFiles(e).then((function(e){return e(n,r)}))},listFineTuneEvents:function(e,t,o){return a.listFineTuneEvents(e,t,o).then((function(e){return e(n,r)}))},listFineTunes:function(e){return a.listFineTunes(e).then((function(e){return e(n,r)}))},listModels:function(e){return a.listModels(e).then((function(e){return e(n,r)}))},retrieveEngine:function(e,t){return a.retrieveEngine(e,t).then((function(e){return e(n,r)}))},retrieveFile:function(e,t){return a.retrieveFile(e,t).then((function(e){return e(n,r)}))},retrieveFineTune:function(e,t){return a.retrieveFineTune(e,t).then((function(e){return e(n,r)}))},retrieveModel:function(e,t){return a.retrieveModel(e,t).then((function(e){return e(n,r)}))}}};var h=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}(d,e);var r,n,u,p,l=(u=d,p=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=c(u);if(p){var r=c(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return s(this,e)});function d(){return a(this,d),l.apply(this,arguments)}return r=d,(n=[{key:"cancelFineTune",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).cancelFineTune(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createAnswer",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createAnswer(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createChatCompletion",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createChatCompletion(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createClassification",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createClassification(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createCompletion",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createCompletion(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createEdit",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createEdit(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createEmbedding",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createEmbedding(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createFile",value:function(e,r,n){var a=this;return t.OpenAIApiFp(this.configuration).createFile(e,r,n).then((function(e){return e(a.axios,a.basePath)}))}},{key:"createFineTune",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createFineTune(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createImage",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createImage(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createImageEdit",value:function(e,r,n,a,o,i,s,c){var u=this;return t.OpenAIApiFp(this.configuration).createImageEdit(e,r,n,a,o,i,s,c).then((function(e){return e(u.axios,u.basePath)}))}},{key:"createImageVariation",value:function(e,r,n,a,o,i){var s=this;return t.OpenAIApiFp(this.configuration).createImageVariation(e,r,n,a,o,i).then((function(e){return e(s.axios,s.basePath)}))}},{key:"createModeration",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createModeration(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createSearch",value:function(e,r,n){var a=this;return t.OpenAIApiFp(this.configuration).createSearch(e,r,n).then((function(e){return e(a.axios,a.basePath)}))}},{key:"createTranscription",value:function(e,r,n,a,o,i,s){var c=this;return t.OpenAIApiFp(this.configuration).createTranscription(e,r,n,a,o,i,s).then((function(e){return e(c.axios,c.basePath)}))}},{key:"createTranslation",value:function(e,r,n,a,o,i){var s=this;return t.OpenAIApiFp(this.configuration).createTranslation(e,r,n,a,o,i).then((function(e){return e(s.axios,s.basePath)}))}},{key:"deleteFile",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).deleteFile(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"deleteModel",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).deleteModel(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"downloadFile",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).downloadFile(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"listEngines",value:function(e){var r=this;return t.OpenAIApiFp(this.configuration).listEngines(e).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listFiles",value:function(e){var r=this;return t.OpenAIApiFp(this.configuration).listFiles(e).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listFineTuneEvents",value:function(e,r,n){var a=this;return t.OpenAIApiFp(this.configuration).listFineTuneEvents(e,r,n).then((function(e){return e(a.axios,a.basePath)}))}},{key:"listFineTunes",value:function(e){var r=this;return t.OpenAIApiFp(this.configuration).listFineTunes(e).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listModels",value:function(e){var r=this;return t.OpenAIApiFp(this.configuration).listModels(e).then((function(e){return e(r.axios,r.basePath)}))}},{key:"retrieveEngine",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).retrieveEngine(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"retrieveFile",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).retrieveFile(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"retrieveFineTune",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).retrieveFineTune(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"retrieveModel",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).retrieveModel(e,r).then((function(e){return e(n.axios,n.basePath)}))}}])&&o(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),d}(f.BaseAPI);t.OpenAIApi=h},791:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function o(e){var t="function"==typeof Map?new Map:void 0;return o=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return i(e,arguments,u(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c(n,e)},o(e)}function i(e,t,r){return i=s()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return r&&c(a,r.prototype),a},i.apply(null,arguments)}function s(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function p(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:t.BASE_PATH,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:f.default;d(this,e),this.basePath=n,this.axios=a,r&&(this.configuration=r,this.basePath=r.basePath||this.basePath)}));t.BaseAPI=h;var g=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(o,e);var t,r,n=(t=o,r=s(),function(){var e,n=u(t);if(r){var o=u(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return a(this,e)});function o(e,t){var r;return d(this,o),(r=n.call(this,t)).field=e,r.name="RequiredError",r}return l(o)}(o(Error));t.RequiredError=g},996:function(e,t,r){"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(){a=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function p(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{p({},"")}catch(e){p=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var a=t&&t.prototype instanceof h?t:h,i=Object.create(a.prototype),s=new A(n||[]);return o(i,"_invoke",{value:S(e,r,s)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var f={};function h(){}function g(){}function v(){}var m={};p(m,s,(function(){return this}));var y=Object.getPrototypeOf,b=y&&y(y(j([])));b&&b!==t&&r.call(b,s)&&(m=b);var w=v.prototype=h.prototype=Object.create(m);function x(e){["next","throw","return"].forEach((function(t){p(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function a(o,i,s,c){var u=d(e[o],e,i);if("throw"!==u.type){var p=u.arg,l=p.value;return l&&"object"==n(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){a("next",e,s,c)}),(function(e){a("throw",e,s,c)})):t.resolve(l).then((function(e){p.value=e,s(p)}),(function(e){return a("throw",e,s,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){a(e,r,t,n)}))}return i=i?i.then(n,n):n()}})}function S(e,t,r){var n="suspendedStart";return function(a,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw o;return{value:void 0,done:!0}}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var s=_(i,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=d(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function _(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var a=d(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function j(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(s&&c){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;k(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:j(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}var o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.createRequestFunction=t.toPathString=t.serializeDataIfNeeded=t.setSearchParams=t.setOAuthToObject=t.setBearerAuthToObject=t.setBasicAuthToObject=t.setApiKeyToObject=t.assertParamExists=t.DUMMY_BASE_URL=void 0;var i=r(791);function s(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"===n(t)?Array.isArray(t)?t.forEach((function(t){return s(e,t,r)})):Object.keys(t).forEach((function(n){return s(e,t[n],"".concat(r).concat(""!==r?".":"").concat(n))})):e.has(r)?e.append(r,t):e.set(r,t))}t.DUMMY_BASE_URL="https://example.com",t.assertParamExists=function(e,t,r){if(null==r)throw new i.RequiredError(t,"Required parameter ".concat(t," was null or undefined when calling ").concat(e,"."))},t.setApiKeyToObject=function(e,t,r){return o(this,void 0,void 0,a().mark((function n(){var o;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!r||!r.apiKey){n.next=12;break}if("function"!=typeof r.apiKey){n.next=7;break}return n.next=4,r.apiKey(t);case 4:n.t0=n.sent,n.next=10;break;case 7:return n.next=9,r.apiKey;case 9:n.t0=n.sent;case 10:o=n.t0,e[t]=o;case 12:case"end":return n.stop()}}),n)})))},t.setBasicAuthToObject=function(e,t){t&&(t.username||t.password)&&(e.auth={username:t.username,password:t.password})},t.setBearerAuthToObject=function(e,t){return o(this,void 0,void 0,a().mark((function r(){var n;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t||!t.accessToken){r.next=12;break}if("function"!=typeof t.accessToken){r.next=7;break}return r.next=4,t.accessToken();case 4:r.t0=r.sent,r.next=10;break;case 7:return r.next=9,t.accessToken;case 9:r.t0=r.sent;case 10:n=r.t0,e.Authorization="Bearer "+n;case 12:case"end":return r.stop()}}),r)})))},t.setOAuthToObject=function(e,t,r,n){return o(this,void 0,void 0,a().mark((function o(){var i;return a().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(!n||!n.accessToken){a.next=12;break}if("function"!=typeof n.accessToken){a.next=7;break}return a.next=4,n.accessToken(t,r);case 4:a.t0=a.sent,a.next=10;break;case 7:return a.next=9,n.accessToken;case 9:a.t0=a.sent;case 10:i=a.t0,e.Authorization="Bearer "+i;case 12:case"end":return a.stop()}}),o)})))},t.setSearchParams=function(e){for(var t=new URLSearchParams(e.search),r=arguments.length,n=new Array(r>1?r-1:0),a=1;a0&&void 0!==arguments[0]?arguments[0]:t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,i=Object.assign(Object.assign({},e.options),{url:((null==n?void 0:n.basePath)||o)+e.url});return a.request(i)}}},397:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),this.apiKey=t.apiKey,this.organization=t.organization,this.username=t.username,this.password=t.password,this.accessToken=t.accessToken,this.basePath=t.basePath,this.baseOptions=t.baseOptions,this.formDataCtor=t.formDataCtor,this.baseOptions||(this.baseOptions={}),this.baseOptions.headers=Object.assign({"User-Agent":"OpenAI/NodeJS/".concat(i.version),Authorization:"Bearer ".concat(this.apiKey)},this.baseOptions.headers),this.organization&&(this.baseOptions.headers["OpenAI-Organization"]=this.organization),this.formDataCtor||(this.formDataCtor=r(51))}var t,n;return t=e,(n=[{key:"isJsonMime",value:function(e){var t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}])&&o(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.Configuration=s},45:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),a(r(482),t),a(r(397),t)},369:(e,t,r)=>{e.exports=r(646)},777:(e,t,r)=>{"use strict";var n=r(373),a=r(814),o=r(490),i=r(273),s=r(419),c=r(90),u=r(184),p=r(356),l=r(764),d=r(555);e.exports=function(e){return new Promise((function(t,r){var f,h=e.data,g=e.headers,v=e.responseType;function m(){e.cancelToken&&e.cancelToken.unsubscribe(f),e.signal&&e.signal.removeEventListener("abort",f)}n.isFormData(h)&&delete g["Content-Type"];var y=new XMLHttpRequest;if(e.auth){var b=e.auth.username||"",w=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";g.Authorization="Basic "+btoa(b+":"+w)}var x=s(e.baseURL,e.url);function O(){if(y){var n="getAllResponseHeaders"in y?c(y.getAllResponseHeaders()):null,o={data:v&&"text"!==v&&"json"!==v?y.response:y.responseText,status:y.status,statusText:y.statusText,headers:n,config:e,request:y};a((function(e){t(e),m()}),(function(e){r(e),m()}),o),y=null}}if(y.open(e.method.toUpperCase(),i(x,e.params,e.paramsSerializer),!0),y.timeout=e.timeout,"onloadend"in y?y.onloadend=O:y.onreadystatechange=function(){y&&4===y.readyState&&(0!==y.status||y.responseURL&&0===y.responseURL.indexOf("file:"))&&setTimeout(O)},y.onabort=function(){y&&(r(p("Request aborted",e,"ECONNABORTED",y)),y=null)},y.onerror=function(){r(p("Network Error",e,null,y)),y=null},y.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",n=e.transitional||l;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(p(t,e,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",y)),y=null},n.isStandardBrowserEnv()){var S=(e.withCredentials||u(x))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;S&&(g[e.xsrfHeaderName]=S)}"setRequestHeader"in y&&n.forEach(g,(function(e,t){void 0===h&&"content-type"===t.toLowerCase()?delete g[t]:y.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(y.withCredentials=!!e.withCredentials),v&&"json"!==v&&(y.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&y.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&y.upload&&y.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(f=function(e){y&&(r(!e||e&&e.type?new d("canceled"):e),y.abort(),y=null)},e.cancelToken&&e.cancelToken.subscribe(f),e.signal&&(e.signal.aborted?f():e.signal.addEventListener("abort",f))),h||(h=null),y.send(h)}))}},646:(e,t,r)=>{"use strict";var n=r(373),a=r(960),o=r(213),i=r(914),s=function e(t){var r=new o(t),s=a(o.prototype.request,r);return n.extend(s,o.prototype,r),n.extend(s,r),s.create=function(r){return e(i(t,r))},s}(r(583));s.Axios=o,s.Cancel=r(555),s.CancelToken=r(994),s.isCancel=r(407),s.VERSION=r(661).version,s.all=function(e){return Promise.all(e)},s.spread=r(512),s.isAxiosError=r(895),e.exports=s,e.exports.default=s},555:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},994:(e,t,r)=>{"use strict";var n=r(555);function a(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,n=r._listeners.length;for(t=0;t{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},213:(e,t,r)=>{"use strict";var n=r(373),a=r(273),o=r(400),i=r(131),s=r(914),c=r(838),u=c.validators;function p(e){this.defaults=e,this.interceptors={request:new o,response:new o}}p.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=s(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&c.assertOptions(r,{silentJSONParsing:u.transitional(u.boolean),forcedJSONParsing:u.transitional(u.boolean),clarifyTimeoutError:u.transitional(u.boolean)},!1);var n=[],a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,n.unshift(e.fulfilled,e.rejected))}));var o,p=[];if(this.interceptors.response.forEach((function(e){p.push(e.fulfilled,e.rejected)})),!a){var l=[i,void 0];for(Array.prototype.unshift.apply(l,n),l=l.concat(p),o=Promise.resolve(t);l.length;)o=o.then(l.shift(),l.shift());return o}for(var d=t;n.length;){var f=n.shift(),h=n.shift();try{d=f(d)}catch(e){h(e);break}}try{o=i(d)}catch(e){return Promise.reject(e)}for(;p.length;)o=o.then(p.shift(),p.shift());return o},p.prototype.getUri=function(e){return e=s(this.defaults,e),a(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){p.prototype[e]=function(t,r){return this.request(s(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){p.prototype[e]=function(t,r,n){return this.request(s(n||{},{method:e,url:t,data:r}))}})),e.exports=p},400:(e,t,r)=>{"use strict";var n=r(373);function a(){this.handlers=[]}a.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},a.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},a.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=a},419:(e,t,r)=>{"use strict";var n=r(190),a=r(724);e.exports=function(e,t){return e&&!n(t)?a(e,t):t}},356:(e,t,r)=>{"use strict";var n=r(386);e.exports=function(e,t,r,a,o){var i=new Error(e);return n(i,t,r,a,o)}},131:(e,t,r)=>{"use strict";var n=r(373),a=r(367),o=r(407),i=r(583),s=r(555);function c(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new s("canceled")}e.exports=function(e){return c(e),e.headers=e.headers||{},e.data=a.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function(t){return c(e),t.data=a.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(c(e),t&&t.response&&(t.response.data=a.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},386:e=>{"use strict";e.exports=function(e,t,r,n,a){return e.config=t,r&&(e.code=r),e.request=n,e.response=a,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}},914:(e,t,r)=>{"use strict";var n=r(373);e.exports=function(e,t){t=t||{};var r={};function a(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function o(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:a(void 0,e[r]):a(e[r],t[r])}function i(e){if(!n.isUndefined(t[e]))return a(void 0,t[e])}function s(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:a(void 0,e[r]):a(void 0,t[r])}function c(r){return r in t?a(e[r],t[r]):r in e?a(void 0,e[r]):void 0}var u={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:c};return n.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||o,a=t(e);n.isUndefined(a)&&t!==c||(r[e]=a)})),r}},814:(e,t,r)=>{"use strict";var n=r(356);e.exports=function(e,t,r){var a=r.config.validateStatus;r.status&&a&&!a(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},367:(e,t,r)=>{"use strict";var n=r(373),a=r(583);e.exports=function(e,t,r){var o=this||a;return n.forEach(r,(function(r){e=r.call(o,e,t)})),e}},583:(e,t,r)=>{"use strict";var n=r(373),a=r(889),o=r(386),i=r(764),s={"Content-Type":"application/x-www-form-urlencoded"};function c(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,p={transitional:i,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(u=r(777)),u),transformRequest:[function(e,t){return a(t,"Accept"),a(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(c(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(c(t,"application/json"),function(e,t,r){if(n.isString(e))try{return(0,JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||p.transitional,r=t&&t.silentJSONParsing,a=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||a&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(e){p.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){p.headers[e]=n.merge(s)})),e.exports=p},764:e=>{"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},661:e=>{e.exports={version:"0.26.1"}},960:e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n{"use strict";var n=r(373);function a(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var o;if(r)o=r(t);else if(n.isURLSearchParams(t))o=t.toString();else{var i=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),i.push(a(t)+"="+a(e))})))})),o=i.join("&")}if(o){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},724:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},490:(e,t,r)=>{"use strict";var n=r(373);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,a,o,i){var s=[];s.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),n.isString(a)&&s.push("path="+a),n.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},190:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},895:(e,t,r)=>{"use strict";var n=r(373);e.exports=function(e){return n.isObject(e)&&!0===e.isAxiosError}},184:(e,t,r)=>{"use strict";var n=r(373);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function a(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=a(window.location.href),function(t){var r=n.isString(t)?a(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},889:(e,t,r)=>{"use strict";var n=r(373);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},90:(e,t,r)=>{"use strict";var n=r(373),a=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,o,i={};return e?(n.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t){if(i[t]&&a.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},512:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},838:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}var a=r(661).version,o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(r){return n(r)===e||"a"+(t<1?"n ":" ")+e}}));var i={};o.transitional=function(e,t,r){function n(e,t){return"[Axios v"+a+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,a,o){if(!1===e)throw new Error(n(a," has been removed"+(t?" in "+t:"")));return t&&!i[a]&&(i[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,a,o)}},e.exports={assertOptions:function(e,t,r){if("object"!==n(e))throw new TypeError("options must be an object");for(var a=Object.keys(e),o=a.length;o-- >0;){var i=a[o],s=t[i];if(s){var c=e[i],u=void 0===c||s(c,i,e);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:o}},373:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}var a=r(960),o=Object.prototype.toString;function i(e){return Array.isArray(e)}function s(e){return void 0===e}function c(e){return"[object ArrayBuffer]"===o.call(e)}function u(e){return null!==e&&"object"===n(e)}function p(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function l(e){return"[object Function]"===o.call(e)}function d(e,t){if(null!=e)if("object"!==n(e)&&(e=[e]),i(e))for(var r=0,a=e.length;r{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n{var n=r(872).default;function a(){"use strict";e.exports=a=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},s="function"==typeof Symbol?Symbol:{},c=s.iterator||"@@iterator",u=s.asyncIterator||"@@asyncIterator",p=s.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function d(e,t,r,n){var a=t&&t.prototype instanceof g?t:g,o=Object.create(a.prototype),s=new j(n||[]);return i(o,"_invoke",{value:_(e,r,s)}),o}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var h={};function g(){}function v(){}function m(){}var y={};l(y,c,(function(){return this}));var b=Object.getPrototypeOf,w=b&&b(b(P([])));w&&w!==r&&o.call(w,c)&&(y=w);var x=m.prototype=g.prototype=Object.create(y);function O(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function r(a,i,s,c){var u=f(e[a],e,i);if("throw"!==u.type){var p=u.arg,l=p.value;return l&&"object"==n(l)&&o.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,s,c)}),(function(e){r("throw",e,s,c)})):t.resolve(l).then((function(e){p.value=e,s(p)}),(function(e){return r("throw",e,s,c)}))}c(u.arg)}var a;i(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,a){r(e,n,t,a)}))}return a=a?a.then(o,o):o()}})}function _(e,t,r){var n="suspendedStart";return function(a,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw o;return{value:void 0,done:!0}}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var s=E(i,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function E(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,E(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var a=n.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function P(e){if(e){var t=e[c];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r=0;--n){var a=this.tryEntries[n],i=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(s&&c){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;A(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:P(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports},872:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},93:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}var a=r(316)();e.exports=a;try{regeneratorRuntime=a}catch(e){"object"===("undefined"==typeof globalThis?"undefined":n(globalThis))?globalThis.regeneratorRuntime=a:Function("r","regeneratorRuntime = r")(a)}},811:e=>{"use strict";e.exports=JSON.parse('{"name":"openai","version":"3.2.1","description":"Node.js library for the OpenAI API","repository":{"type":"git","url":"git@github.com:openai/openai-node.git"},"keywords":["openai","open","ai","gpt-3","gpt3"],"author":"OpenAI","license":"MIT","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"tsc --outDir dist/"},"dependencies":{"axios":"^0.26.0","form-data":"^4.0.0"},"devDependencies":{"@types/node":"^12.11.5","typescript":"^3.6.4"}}')}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{"use strict";var e=r(655),t=r.n(e);function n(e,t,r,n,a,o,i){try{var s=e[o](i),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,a)}function a(e){return function(){var t=this,r=arguments;return new Promise((function(a,o){var i=e.apply(t,r);function s(e){n(i,a,o,s,c,"next",e)}function c(e){n(i,a,o,s,c,"throw",e)}s(void 0)}))}}function o(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:0;return(v[e[t+0]]+v[e[t+1]]+v[e[t+2]]+v[e[t+3]]+"-"+v[e[t+4]]+v[e[t+5]]+"-"+v[e[t+6]]+v[e[t+7]]+"-"+v[e[t+8]]+v[e[t+9]]+"-"+v[e[t+10]]+v[e[t+11]]+v[e[t+12]]+v[e[t+13]]+v[e[t+14]]+v[e[t+15]]).toLowerCase()}(n)};var b=r(36),w=r.n(b);function x(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return O(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?O(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);rcode{color:inherit}#acode-plugin-chatgpt .ai_wrapper .ai_message kbd{padding:.1875rem .375rem;font-size:.875em;color:var(--primary-text-color);background-color:var(--popup-background-color);border-radius:.25rem}#acode-plugin-chatgpt .ai_wrapper .ai_message kbd kbd{padding:0;font-size:1em}#acode-plugin-chatgpt .error-box{border:1px solid var(--error-text-color);color:var(--error-text-color);font-weight:700;padding:8px;white-space:pre-wrap;word-break:break-word;border-radius:10px}#acode-plugin-chatgpt .inputBox{position:fixed;bottom:0;width:100%;height:80px;padding:8px;display:flex;background-color:var(--popup-background-color);box-shadow:0px -2px 4px var(--box-shadow-color);z-index:1}#acode-plugin-chatgpt .chatTextarea{flex:1;height:100%;resize:none;border:none;outline:none;background:none;font:initial;font-size:1.1rem;color:var(--primary-text-color);-webkit-padding-end:8px;padding-inline-end:8px}#acode-plugin-chatgpt .sendBtn{height:40px;width:40px;border-radius:8px;border:none;outline:none;background-color:rgba(0,0,0,.2);color:gray;display:grid;place-items:center}#acode-plugin-chatgpt .sendBtn:active{background-color:var(--button-background-color);color:var(--primary-text-color)}'}),document.head.append(this.$githubDarkFile,this.$higlightJsFile,this.$markdownItFile,this.$style),T.commands.addCommand({name:"chatgpt",description:"Chat GPT",exec:this.run.bind(this)}),T.commands.addCommand({name:"chatgpt_update_token",description:"Update Chat GPT Token",exec:this.updateApiToken.bind(this)}),r.id="acode-plugin-chatgpt",r.settitle("Chat GPT"),this.$page=r,n=t()("span",{className:"icon more_vert",dataset:{action:"toggle-menu"}}),a=t()("span",{className:"icon add",dataset:{action:"new-chat"}}),this.$page.header.append(a,n),n.onclick=this.myHistory.bind(this),a.onclick=this.newChat.bind(this),o=t()("div",{className:"mainApp"}),this.$chatBox=t()("div",{className:"chatBox"}),this.$inputBox=t()("div",{className:"inputBox"}),this.$chatTextarea=t()("textarea",{className:"chatTextarea",placeholder:"Type your query..."}),this.$sendBtn=t()("button",{className:"sendBtn"}),this.$sendBtn.innerHTML='',this.$inputBox.append(this.$chatTextarea,this.$sendBtn),o.append(this.$inputBox,this.$chatBox),this.$page.append(o),this.$promptsArray=[],acode.addIcon("chatgpt_ai_img",this.baseUrl+"assets/chatgpt_avatar.svg"),j.add("chatgpt_ai_img","dall-e-ai","Image Generator AI",(function(e){var r=t()("h2",{textContent:"Image Generator",className:"sidebar-ai-heading"});i.$promtArea=t()("textarea",{placeholder:"Type your prompt here...",rows:"8",className:"prompt-area",maxlength:1e3}),i.$sizeSelector=t()("select",{className:"size-selector"}),i.$sizeSelector.innerHTML='\n \n \n \n \n ',i.$generatorBtn=t()("button",{textContent:"Generate",className:"generatorBtn"}),i.$generatedImg=t()("img",{className:"img-fluid",src:""}),i.$mainSideBarCont=t()("div",{className:"main-sidebar-cont"}),i.$generatorBtn.addEventListener("click",i.generateImage.bind(i)),i.$mainSideBarCont.append(r,i.$promtArea,i.$sizeSelector,i.$generatorBtn,i.$generatedImg),e.append(i.$mainSideBarCont)}));case 27:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})},{key:"generateImage",value:(U=a(s().mark((function e(){var t,r,n,a,o,i,c,d;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.$promtArea.value){e.next=4;break}return acode.alert("Warning","Prompt is required"),e.abrupt("return");case 4:if(!(r=window.localStorage.getItem("chatgpt-api-key"))){e.next=9;break}t=r,e.next=16;break;case 9:return e.next=11,S("Enter your openai(chatgpt) key",[{type:"text",id:"token",required:!0,placeholder:"Enter your chatgpt api key"}],"https://platform.openai.com/account/api-keys");case 11:if(n=e.sent){e.next=14;break}return e.abrupt("return");case 14:t=n.token,window.localStorage.setItem("chatgpt-api-key",t);case 16:return a=new u.OpenAIApi(new u.Configuration({apiKey:t})),A.create("Wait","Generating image...."),e.next=20,a.createImage({prompt:this.$promtArea.value,n:1,size:this.$sizeSelector.value,response_format:"b64_json"});case 20:if(o=e.sent,_("file:///storage/emulated/0/Download").exists()){e.next=24;break}return e.next=24,_("file:///storage/emulated/0/").createDirectory("Download");case 24:return s=o.data.data[0].b64_json,f=void 0,h=void 0,h=[l(atob(s))],i=f?p(h,{type:f}):p(h),c=this.generateRandomName(),e.next=28,_("file:///storage/emulated/0/Download").createFile(c+".png",i);case 28:return e.next=30,P("file:///storage/emulated/0/Download/"+c+".png");case 30:d=e.sent,this.$generatedImg.src=d,A.destroy(),this.$promtArea.value="file:///storage/emulated/0/Download/"+c+".png",window.toast("Hurray 🎉! Image generated successfully. Image path is given in prompt box.",3e3),e.next=41;break;case 37:e.prev=37,e.t0=e.catch(0),A.destroy(),e.t0.response?acode.alert("Error","Status code: ".concat(e.t0.response.status,", Message: ").concat(e.t0.response.data.error.message)):acode.alert("Error",e.t0.message);case 41:case"end":return e.stop()}var s,f,h}),e,this,[[0,37]])}))),function(){return U.apply(this,arguments)})},{key:"generateRandomName",value:function(){var e=Date.now().toString(),t=Math.random().toString(36).substring(2,8);return"".concat(e,"_").concat(t)}},{key:"run",value:(I=a(s().mark((function e(){var t,r,n;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(r=window.localStorage.getItem("chatgpt-api-key"))){e.next=6;break}t=r,e.next=11;break;case 6:return e.next=8,S("Enter your openai(chatgpt) key",[{type:"text",id:"token",required:!0,placeholder:"Enter your chatgpt api key"}],"https://platform.openai.com/account/api-keys");case 8:n=e.sent,t=n.token,window.localStorage.setItem("chatgpt-api-key",t);case 11:this.$openai=new u.OpenAIApi(new u.Configuration({apiKey:t})),this.$mdIt=window.markdownit({html:!1,xhtmlOut:!1,breaks:!1,linkify:!1,typographer:!1,quotes:"“”‘’",highlight:function(e,t){var r=document.createElement("button");r.classList.add("copy-button"),r.innerHTML='',r.setAttribute("data-str",e);var n='
'.concat(hljs.highlightAuto(e).value,"
");return'
'.concat(r.outerHTML).concat(n,"
")}}),this.$sendBtn.addEventListener("click",this.sendQuery.bind(this)),this.$page.show(),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(0),window.alert(e.t0);case 20:case"end":return e.stop()}}),e,this,[[0,17]])}))),function(){return I.apply(this,arguments)})},{key:"updateApiToken",value:(C=a(s().mark((function e(){var t;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return window.localStorage.removeItem("chatgpt-api-key"),e.next=3,S("Enter your openai(chatgpt) key",[{type:"text",id:"token",required:!0,placeholder:"Enter your chatgpt api key"}],"https://platform.openai.com/account/api-keys");case 3:t=e.sent,window.localStorage.setItem("chatgpt-api-key",t.token),window.toast("Api key updated!",3e3);case 6:case"end":return e.stop()}}),e)}))),function(){return C.apply(this,arguments)})},{key:"_sanitizeFileName",value:function(e){return e.replace(/[^\w\s.-]/gi,"").trim().replace(/\s+/g,"_")}},{key:"saveHistory",value:(L=a(s().mark((function e(){var t,r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.$promptsArray.length){e.next=3;break}return e.abrupt("return");case 3:if(null!=F){e.next=22;break}return e.prev=4,t=this._sanitizeFileName(this.$promptsArray[0].prevQuestion.substring(0,30)),r="".concat(t,"__").concat(y(),".json"),e.next=9,_(R).exists();case 9:if(e.sent){e.next=12;break}return e.next=12,_(window.DATA_STORAGE).createDirectory("chatgpt");case 12:return e.next=14,_(R).createFile(r,this.$promptsArray);case 14:F=e.sent,e.next=20;break;case 17:e.prev=17,e.t0=e.catch(4),alert(e.t0.message);case 20:e.next=37;break;case 22:return e.prev=22,e.next=25,_(F).exists();case 25:if(e.sent){e.next=29;break}return this.newChat(),window.toast("Some error occurred or file you trying to open has been deleted"),e.abrupt("return");case 29:return e.next=31,_(F).writeFile(this.$promptsArray);case 31:F=e.sent,e.next=37;break;case 34:e.prev=34,e.t1=e.catch(22),alert(e.t1.message);case 37:e.next=42;break;case 39:e.prev=39,e.t2=e.catch(0),window.alert(e.t2.message);case 42:case"end":return e.stop()}}),e,this,[[0,39],[4,17],[22,34]])}))),function(){return L.apply(this,arguments)})},{key:"newChat",value:function(){this.$chatBox.innerHTML="",window.toast("New session",4e3),this.$promptsArray=[],F=null}},{key:"getHistoryItems",value:(O=a(s().mark((function e(){var t,r,n;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_(R).exists();case 2:if(!e.sent){e.next=11;break}return e.next=5,_(R).lsDir();case 5:for(t=e.sent,r="",n=0;n\n

').concat(t[n].name.split("__")[0].substring(0,25),'...

\n ');return e.abrupt("return",r);case 11:return e.abrupt("return",'
  • Not Available
  • ');case 14:case"end":return e.stop()}}),e)}))),function(){return O.apply(this,arguments)})},{key:"displayHistory",value:(b=a(s().mark((function e(t,r){var n,a,o,i=this;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.$chatBox.innerHTML="",n=t.slice(1,t.length-1),e.next=4,_(n).exists();case 4:if(e.sent){e.next=8;break}return this.newChat(),window.toast("Some error occurred or file you trying to open has been deleted"),e.abrupt("return");case 8:return F=n,e.prev=9,r.hide(),A.create("Wait","Fetching chat history...."),e.next=14,_(n).readFile();case 14:return a=e.sent,e.t0=Array,e.t1=JSON,e.next=19,k.decodeText(a);case 19:e.t2=e.sent,e.t3=e.t1.parse.call(e.t1,e.t2),o=e.t0.from.call(e.t0,e.t3),this.$promptsArray=[],this.$promptsArray=o,o.forEach((function(e){i.appendUserQuery(e.prevQuestion),i.appendGptResponse(e.prevResponse)})),A.destroy(),e.next=31;break;case 28:e.prev=28,e.t4=e.catch(9),alert(e.t4.message);case 31:case"end":return e.stop()}}),e,this,[[9,28]])}))),function(e,t){return b.apply(this,arguments)})},{key:"myHistory",value:(m=a(s().mark((function e(){var t,r,n,o=this;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getHistoryItems();case 3:t=e.sent,r="
      ".concat(t,"
    "),(n=E("Conversation History",r,"Cancel")).onclick(function(){var e=a(s().mark((function e(t){var r,a,i,c,u,p;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.target.closest(".dialog-item"),a=r.querySelector(".delete-history-btn"),i=r.querySelector(".history-item"),"#not-available"!=r.getAttribute("data-path")){e.next=5;break}return e.abrupt("return");case 5:if(r.getAttribute("data-path")){e.next=7;break}return e.abrupt("return");case 7:if(t.target!==r&&t.target!==i){e.next=12;break}c=JSON.stringify(r.getAttribute("data-path")),o.displayHistory(c,n),e.next=21;break;case 12:if(t.target!==a){e.next=21;break}return u=JSON.stringify(r.getAttribute("data-path")),p=u.slice(1,u.length-1),e.next=17,_(r.getAttribute("data-path")).delete();case 17:F==p&&(document.querySelector(".chatBox").innerHTML="",o.$promptsArray=[]),r.remove(),window.toast("Deleted",3e3),F=null;case 21:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(0),window.alert(e.t0.message);case 12:case"end":return e.stop()}}),e,this,[[0,9]])}))),function(){return m.apply(this,arguments)})},{key:"sendQuery",value:(v=a(s().mark((function e(){var t;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:""!=(t=this.$chatTextarea).value&&(this.appendUserQuery(t.value),this.scrollToBottom(),this.appendGptResponse(""),this.loader(),this.getChatgptResponse(t.value),t.value="");case 2:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"appendUserQuery",value:(g=a(s().mark((function e(r){var n,a,o,i,c;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{n=this.baseUrl+"assets/user_avatar.png",a=t()("div",{className:"wrapper"}),o=t()("div",{className:"chat"}),i=t()("div",{className:"profile",child:t()("img",{src:n,alt:"user"})}),c=t()("div",{className:"message",textContent:r}),o.append.apply(o,[i,c]),a.append(o),this.$chatBox.appendChild(a)}catch(e){window.alert(e)}case 1:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"appendGptResponse",value:(h=a(s().mark((function e(r){var n,a,o,i,c,u,p,l;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.baseUrl+"assets/chatgpt_avatar.svg",a=t()("div",{className:"ai_wrapper"}),o=t()("div",{className:"ai_chat"}),i=t()("div",{className:"ai_profile",child:t()("img",{src:n,alt:"ai"})}),(c=t()("div",{className:"ai_message"})).innerHTML=this.$mdIt.render(r),u=c.querySelectorAll(".copy-button")){p=x(u);try{for(p.s();!(l=p.n()).done;)l.value.addEventListener("click",(function(){w()(this.dataset.str),window.toast("Copied to clipboard",3e3)}))}catch(e){p.e(e)}finally{p.f()}}o.append.apply(o,[i,c]),a.append(o),this.$chatBox.appendChild(a);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getChatgptResponse",value:(f=a(s().mark((function e(r){var n,a,o,i,c,u,p,l,d,f,h;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=Array.from(document.querySelectorAll(".ai_message")),a=this.$promptsArray>0?this.$promptsArray.map((function(e){return e.prevQuestion,{role:"assistant",content:e.prevResponse}})):[{role:"user",content:r}],e.next=5,this.$openai.createChatCompletion({model:"gpt-3.5-turbo",messages:a,temperature:0,max_tokens:3e3});case 5:return o=e.sent,clearInterval(this.$loadInterval),i=n[n.length-1],c=o.data.choices[0].message.content,this.$promptsArray.push({prevQuestion:r,prevResponse:c}),e.next=12,this.saveHistory();case 12:if(i.innerHTML="",i.innerHTML=this.$mdIt.render(c),u=i.querySelectorAll(".copy-button")){p=x(u);try{for(p.s();!(l=p.n()).done;)l.value.addEventListener("click",(function(){w()(this.dataset.str),window.toast("Copied to clipboard",3e3)}))}catch(e){p.e(e)}finally{p.f()}}this.scrollToBottom(),e.next=28;break;case 19:e.prev=19,e.t0=e.catch(0),d=Array.from(document.querySelectorAll(".ai_message")),clearInterval(this.$loadInterval),(f=d[d.length-1]).innerHTML="",h=t()("div",{className:"error-box"}),e.t0.response?h.innerText="Status code: ".concat(e.t0.response.status,"\n").concat(JSON.stringify(e.t0.response.data)):h.innerText="".concat(e.t0.message),f.appendChild(h);case 28:case"end":return e.stop()}}),e,this,[[0,19]])}))),function(e){return f.apply(this,arguments)})},{key:"scrollToBottom",value:(d=a(s().mark((function e(){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.$chatBox.scrollTop=this.$chatBox.scrollHeight;case 1:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"loader",value:(c=a(s().mark((function e(){var t;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:0!=(t=Array.from(document.querySelectorAll(".ai_message"))).length&&(this.$loadInterval=setInterval((function(){t[t.length-1].innerText+="•","••••••"==t[t.length-1].innerText&&(t[t.length-1].innerText="•")}),300));case 2:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"destroy",value:(i=a(s().mark((function e(){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:j.remove("dall-e-ai"),editorManager.editor.commands.removeCommand("chatgpt"),editorManager.editor.commands.removeCommand("chatgpt_update_token"),window.localStorage.removeItem("chatgpt-api-key"),this.$githubDarkFile.remove(),this.$higlightJsFile.remove(),this.$markdownItFile.remove(),this.$style.remove();case 8:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})}],n&&o(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),e}();if(window.acode){var C=new L;acode.setPluginInit(c.id,(function(e,t,r){var n=r.cacheFileUrl,a=r.cacheFile;e.endsWith("/")||(e+="/"),C.baseUrl=e,C.init(t,a,n)})),acode.setPluginUnmount(c.id,(function(){C.destroy()}))}})()})(); \ No newline at end of file +(()=>{var e={36:(e,t,r)=>{"use strict";var n=r(409),a={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var r,o,i,s,c,u,p=!1;t||(t={}),r=t.debug||!1;try{if(i=n(),s=document.createRange(),c=document.getSelection(),(u=document.createElement("span")).textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",(function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=a[t.format]||a.default;window.clipboardData.setData(o,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))})),document.body.appendChild(u),s.selectNodeContents(u),c.addRange(s),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");p=!0}catch(n){r&&console.error("unable to copy using execCommand: ",n),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),p=!0}catch(n){r&&console.error("unable to copy using clipboardData: ",n),r&&console.error("falling back to prompt"),o=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(o,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(s):c.removeAllRanges()),u&&document.body.removeChild(u),i()}return p}},51:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}e.exports="object"==("undefined"==typeof self?"undefined":t(self))?self.FormData:window.FormData},655:function(e,t,r){var n,a,o,i;function s(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof t&&(t={innerHTML:t}),function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if("function"==typeof e)return e(n,a);if(e instanceof Node)t=e;else{if("string"!=typeof e)throw new Error("Invalid tag, ",u(e));t=document.createElement(e)}return Object.keys(n).forEach((function(e){var a=n[e];if(void 0!==a)switch(e){case"child":r(t,a);break;case"children":if(!Array.isArray(a))throw new Error("children must be an array of Nodes");a.flat().forEach((function(e){r(t,e)}));break;case"attr":Object.keys(a).forEach((function(e){t.setAttribute(e,a[e])}));break;case"style":case"dataset":Object.keys(a).forEach((function(r){t[e][r]=a[r]}));break;default:t[e]=a}})),t}(e,t)}return e.d(t,{default:function(){return n}}),Object.defineProperties(n,{get:{value:function(e){return document.querySelector(e)}},getAll:{value:function(e){return s(document.querySelectorAll(e))}},parse:{value:function(e){var t=document.createElement("div");return t.innerHTML=e,1===t.childElementCount?t.firstElementChild:s(t.children)}},text:{value:function(e){return document.createTextNode(e)}},use:{value:function(e){var t=e,r=!1,n=document.createTextNode(e),a=[n];return Object.defineProperty(n,"value",{set:function(e){t=e,a.forEach((function(t){t.textContent=e}))},get:function(){return t}}),Object.defineProperty(n,"clone",{value:function(){if(!r)return r=!0,n;var e=n.cloneNode();return a.push(e),e}}),n}}}),t.default}()},"object"==u(t)&&"object"==u(e)?e.exports=i():(a=[],void 0===(o="function"==typeof(n=i)?n.apply(t,a):n)||(e.exports=o))},482:function(e,t,r){"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(s&&c){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;E(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:j(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}var p=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OpenAIApi=t.OpenAIApiFactory=t.OpenAIApiFp=t.OpenAIApiAxiosParamCreator=t.CreateImageRequestResponseFormatEnum=t.CreateImageRequestSizeEnum=t.ChatCompletionResponseMessageRoleEnum=t.ChatCompletionRequestMessageRoleEnum=void 0;var l=r(369),d=r(996),f=r(791);t.ChatCompletionRequestMessageRoleEnum={System:"system",User:"user",Assistant:"assistant"},t.ChatCompletionResponseMessageRoleEnum={System:"system",User:"user",Assistant:"assistant"},t.CreateImageRequestSizeEnum={_256x256:"256x256",_512x512:"512x512",_1024x1024:"1024x1024"},t.CreateImageRequestResponseFormatEnum={Url:"url",B64Json:"b64_json"},t.OpenAIApiAxiosParamCreator=function(e){var t=this;return{cancelFineTune:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("cancelFineTune","fineTuneId",r),a="/fine-tunes/{fine_tune_id}/cancel".replace("{".concat("fine_tune_id","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"POST"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))},createAnswer:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createAnswer","createAnswerRequest",r),a=new URL("/answers",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createChatCompletion:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createChatCompletion","createChatCompletionRequest",r),a=new URL("/chat/completions",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createClassification:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createClassification","createClassificationRequest",r),a=new URL("/classifications",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createCompletion:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createCompletion","createCompletionRequest",r),a=new URL("/completions",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createEdit:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createEdit","createEditRequest",r),a=new URL("/edits",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createEmbedding:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createEmbedding","createEmbeddingRequest",r),a=new URL("/embeddings",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createFile:function(r,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return p(t,void 0,void 0,u().mark((function t(){var o,i,s,c,p,l,f;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createFile","file",r),d.assertParamExists("createFile","purpose",n),o=new URL("/files",d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"POST"},i),a),c={},p={},l=new(e&&e.formDataCtor||FormData),void 0!==r&&l.append("file",r),void 0!==n&&l.append("purpose",n),c["Content-Type"]="multipart/form-data",d.setSearchParams(o,p),f=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign(Object.assign({},c),l.getHeaders()),f),a.headers),s.data=l,t.abrupt("return",{url:d.toPathString(o),options:s});case 17:case"end":return t.stop()}}),t)})))},createFineTune:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createFineTune","createFineTuneRequest",r),a=new URL("/fine-tunes",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createImage:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createImage","createImageRequest",r),a=new URL("/images/generations",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createImageEdit:function(r,n,a,o,i,s,c){var l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{};return p(t,void 0,void 0,u().mark((function t(){var p,f,h,g,m,v,y;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createImageEdit","image",r),d.assertParamExists("createImageEdit","prompt",n),p=new URL("/images/edits",d.DUMMY_BASE_URL),e&&(f=e.baseOptions),h=Object.assign(Object.assign({method:"POST"},f),l),g={},m={},v=new(e&&e.formDataCtor||FormData),void 0!==r&&v.append("image",r),void 0!==a&&v.append("mask",a),void 0!==n&&v.append("prompt",n),void 0!==o&&v.append("n",o),void 0!==i&&v.append("size",i),void 0!==s&&v.append("response_format",s),void 0!==c&&v.append("user",c),g["Content-Type"]="multipart/form-data",d.setSearchParams(p,m),y=f&&f.headers?f.headers:{},h.headers=Object.assign(Object.assign(Object.assign(Object.assign({},g),v.getHeaders()),y),l.headers),h.data=v,t.abrupt("return",{url:d.toPathString(p),options:h});case 22:case"end":return t.stop()}}),t)})))},createImageVariation:function(r,n,a,o,i){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};return p(t,void 0,void 0,u().mark((function t(){var c,p,l,f,h,g,m;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createImageVariation","image",r),c=new URL("/images/variations",d.DUMMY_BASE_URL),e&&(p=e.baseOptions),l=Object.assign(Object.assign({method:"POST"},p),s),f={},h={},g=new(e&&e.formDataCtor||FormData),void 0!==r&&g.append("image",r),void 0!==n&&g.append("n",n),void 0!==a&&g.append("size",a),void 0!==o&&g.append("response_format",o),void 0!==i&&g.append("user",i),f["Content-Type"]="multipart/form-data",d.setSearchParams(c,h),m=p&&p.headers?p.headers:{},l.headers=Object.assign(Object.assign(Object.assign(Object.assign({},f),g.getHeaders()),m),s.headers),l.data=g,t.abrupt("return",{url:d.toPathString(c),options:l});case 19:case"end":return t.stop()}}),t)})))},createModeration:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createModeration","createModerationRequest",r),a=new URL("/moderations",d.DUMMY_BASE_URL),e&&(o=e.baseOptions),i=Object.assign(Object.assign({method:"POST"},o),n),c={},(s={})["Content-Type"]="application/json",d.setSearchParams(a,c),p=o&&o.headers?o.headers:{},i.headers=Object.assign(Object.assign(Object.assign({},s),p),n.headers),i.data=d.serializeDataIfNeeded(r,i,e),t.abrupt("return",{url:d.toPathString(a),options:i});case 13:case"end":return t.stop()}}),t)})))},createSearch:function(r,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return p(t,void 0,void 0,u().mark((function t(){var o,i,s,c,p,l,f;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createSearch","engineId",r),d.assertParamExists("createSearch","createSearchRequest",n),o="/engines/{engine_id}/search".replace("{".concat("engine_id","}"),encodeURIComponent(String(r))),i=new URL(o,d.DUMMY_BASE_URL),e&&(s=e.baseOptions),c=Object.assign(Object.assign({method:"POST"},s),a),l={},(p={})["Content-Type"]="application/json",d.setSearchParams(i,l),f=s&&s.headers?s.headers:{},c.headers=Object.assign(Object.assign(Object.assign({},p),f),a.headers),c.data=d.serializeDataIfNeeded(n,c,e),t.abrupt("return",{url:d.toPathString(i),options:c});case 14:case"end":return t.stop()}}),t)})))},createTranscription:function(r,n,a,o,i,s){var c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{};return p(t,void 0,void 0,u().mark((function t(){var p,l,f,h,g,m,v;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createTranscription","file",r),d.assertParamExists("createTranscription","model",n),p=new URL("/audio/transcriptions",d.DUMMY_BASE_URL),e&&(l=e.baseOptions),f=Object.assign(Object.assign({method:"POST"},l),c),h={},g={},m=new(e&&e.formDataCtor||FormData),void 0!==r&&m.append("file",r),void 0!==n&&m.append("model",n),void 0!==a&&m.append("prompt",a),void 0!==o&&m.append("response_format",o),void 0!==i&&m.append("temperature",i),void 0!==s&&m.append("language",s),h["Content-Type"]="multipart/form-data",d.setSearchParams(p,g),v=l&&l.headers?l.headers:{},f.headers=Object.assign(Object.assign(Object.assign(Object.assign({},h),m.getHeaders()),v),c.headers),f.data=m,t.abrupt("return",{url:d.toPathString(p),options:f});case 21:case"end":return t.stop()}}),t)})))},createTranslation:function(r,n,a,o,i){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};return p(t,void 0,void 0,u().mark((function t(){var c,p,l,f,h,g,m;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("createTranslation","file",r),d.assertParamExists("createTranslation","model",n),c=new URL("/audio/translations",d.DUMMY_BASE_URL),e&&(p=e.baseOptions),l=Object.assign(Object.assign({method:"POST"},p),s),f={},h={},g=new(e&&e.formDataCtor||FormData),void 0!==r&&g.append("file",r),void 0!==n&&g.append("model",n),void 0!==a&&g.append("prompt",a),void 0!==o&&g.append("response_format",o),void 0!==i&&g.append("temperature",i),f["Content-Type"]="multipart/form-data",d.setSearchParams(c,h),m=p&&p.headers?p.headers:{},l.headers=Object.assign(Object.assign(Object.assign(Object.assign({},f),g.getHeaders()),m),s.headers),l.data=g,t.abrupt("return",{url:d.toPathString(c),options:l});case 20:case"end":return t.stop()}}),t)})))},deleteFile:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("deleteFile","fileId",r),a="/files/{file_id}".replace("{".concat("file_id","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"DELETE"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))},deleteModel:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("deleteModel","model",r),a="/models/{model}".replace("{".concat("model","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"DELETE"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))},downloadFile:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("downloadFile","fileId",r),a="/files/{file_id}/content".replace("{".concat("file_id","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"GET"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))},listEngines:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return p(t,void 0,void 0,u().mark((function t(){var n,a,o,i,s,c;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new URL("/engines",d.DUMMY_BASE_URL),e&&(a=e.baseOptions),o=Object.assign(Object.assign({method:"GET"},a),r),i={},s={},d.setSearchParams(n,s),c=a&&a.headers?a.headers:{},o.headers=Object.assign(Object.assign(Object.assign({},i),c),r.headers),t.abrupt("return",{url:d.toPathString(n),options:o});case 10:case"end":return t.stop()}}),t)})))},listFiles:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return p(t,void 0,void 0,u().mark((function t(){var n,a,o,i,s,c;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new URL("/files",d.DUMMY_BASE_URL),e&&(a=e.baseOptions),o=Object.assign(Object.assign({method:"GET"},a),r),i={},s={},d.setSearchParams(n,s),c=a&&a.headers?a.headers:{},o.headers=Object.assign(Object.assign(Object.assign({},i),c),r.headers),t.abrupt("return",{url:d.toPathString(n),options:o});case 10:case"end":return t.stop()}}),t)})))},listFineTuneEvents:function(r,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return p(t,void 0,void 0,u().mark((function t(){var o,i,s,c,p,l,f;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("listFineTuneEvents","fineTuneId",r),o="/fine-tunes/{fine_tune_id}/events".replace("{".concat("fine_tune_id","}"),encodeURIComponent(String(r))),i=new URL(o,d.DUMMY_BASE_URL),e&&(s=e.baseOptions),c=Object.assign(Object.assign({method:"GET"},s),a),p={},l={},void 0!==n&&(l.stream=n),d.setSearchParams(i,l),f=s&&s.headers?s.headers:{},c.headers=Object.assign(Object.assign(Object.assign({},p),f),a.headers),t.abrupt("return",{url:d.toPathString(i),options:c});case 12:case"end":return t.stop()}}),t)})))},listFineTunes:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return p(t,void 0,void 0,u().mark((function t(){var n,a,o,i,s,c;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new URL("/fine-tunes",d.DUMMY_BASE_URL),e&&(a=e.baseOptions),o=Object.assign(Object.assign({method:"GET"},a),r),i={},s={},d.setSearchParams(n,s),c=a&&a.headers?a.headers:{},o.headers=Object.assign(Object.assign(Object.assign({},i),c),r.headers),t.abrupt("return",{url:d.toPathString(n),options:o});case 10:case"end":return t.stop()}}),t)})))},listModels:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return p(t,void 0,void 0,u().mark((function t(){var n,a,o,i,s,c;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=new URL("/models",d.DUMMY_BASE_URL),e&&(a=e.baseOptions),o=Object.assign(Object.assign({method:"GET"},a),r),i={},s={},d.setSearchParams(n,s),c=a&&a.headers?a.headers:{},o.headers=Object.assign(Object.assign(Object.assign({},i),c),r.headers),t.abrupt("return",{url:d.toPathString(n),options:o});case 10:case"end":return t.stop()}}),t)})))},retrieveEngine:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("retrieveEngine","engineId",r),a="/engines/{engine_id}".replace("{".concat("engine_id","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"GET"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))},retrieveFile:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("retrieveFile","fileId",r),a="/files/{file_id}".replace("{".concat("file_id","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"GET"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))},retrieveFineTune:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("retrieveFineTune","fineTuneId",r),a="/fine-tunes/{fine_tune_id}".replace("{".concat("fine_tune_id","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"GET"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))},retrieveModel:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return p(t,void 0,void 0,u().mark((function t(){var a,o,i,s,c,p,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.assertParamExists("retrieveModel","model",r),a="/models/{model}".replace("{".concat("model","}"),encodeURIComponent(String(r))),o=new URL(a,d.DUMMY_BASE_URL),e&&(i=e.baseOptions),s=Object.assign(Object.assign({method:"GET"},i),n),c={},p={},d.setSearchParams(o,p),l=i&&i.headers?i.headers:{},s.headers=Object.assign(Object.assign(Object.assign({},c),l),n.headers),t.abrupt("return",{url:d.toPathString(o),options:s});case 11:case"end":return t.stop()}}),t)})))}}},t.OpenAIApiFp=function(e){var r=t.OpenAIApiAxiosParamCreator(e);return{cancelFineTune:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.cancelFineTune(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createAnswer:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createAnswer(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createChatCompletion:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createChatCompletion(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createClassification:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createClassification(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createCompletion:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createCompletion(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createEdit:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createEdit(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createEmbedding:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createEmbedding(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createFile:function(t,n,a){return p(this,void 0,void 0,u().mark((function o(){var i;return u().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,r.createFile(t,n,a);case 2:return i=o.sent,o.abrupt("return",d.createRequestFunction(i,l.default,f.BASE_PATH,e));case 4:case"end":return o.stop()}}),o)})))},createFineTune:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createFineTune(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createImage:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createImage(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createImageEdit:function(t,n,a,o,i,s,c,h){return p(this,void 0,void 0,u().mark((function p(){var g;return u().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,r.createImageEdit(t,n,a,o,i,s,c,h);case 2:return g=u.sent,u.abrupt("return",d.createRequestFunction(g,l.default,f.BASE_PATH,e));case 4:case"end":return u.stop()}}),p)})))},createImageVariation:function(t,n,a,o,i,s){return p(this,void 0,void 0,u().mark((function c(){var p;return u().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,r.createImageVariation(t,n,a,o,i,s);case 2:return p=c.sent,c.abrupt("return",d.createRequestFunction(p,l.default,f.BASE_PATH,e));case 4:case"end":return c.stop()}}),c)})))},createModeration:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.createModeration(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},createSearch:function(t,n,a){return p(this,void 0,void 0,u().mark((function o(){var i;return u().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,r.createSearch(t,n,a);case 2:return i=o.sent,o.abrupt("return",d.createRequestFunction(i,l.default,f.BASE_PATH,e));case 4:case"end":return o.stop()}}),o)})))},createTranscription:function(t,n,a,o,i,s,c){return p(this,void 0,void 0,u().mark((function p(){var h;return u().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,r.createTranscription(t,n,a,o,i,s,c);case 2:return h=u.sent,u.abrupt("return",d.createRequestFunction(h,l.default,f.BASE_PATH,e));case 4:case"end":return u.stop()}}),p)})))},createTranslation:function(t,n,a,o,i,s){return p(this,void 0,void 0,u().mark((function c(){var p;return u().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,r.createTranslation(t,n,a,o,i,s);case 2:return p=c.sent,c.abrupt("return",d.createRequestFunction(p,l.default,f.BASE_PATH,e));case 4:case"end":return c.stop()}}),c)})))},deleteFile:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.deleteFile(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},deleteModel:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.deleteModel(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},downloadFile:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.downloadFile(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},listEngines:function(t){return p(this,void 0,void 0,u().mark((function n(){var a;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.listEngines(t);case 2:return a=n.sent,n.abrupt("return",d.createRequestFunction(a,l.default,f.BASE_PATH,e));case 4:case"end":return n.stop()}}),n)})))},listFiles:function(t){return p(this,void 0,void 0,u().mark((function n(){var a;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.listFiles(t);case 2:return a=n.sent,n.abrupt("return",d.createRequestFunction(a,l.default,f.BASE_PATH,e));case 4:case"end":return n.stop()}}),n)})))},listFineTuneEvents:function(t,n,a){return p(this,void 0,void 0,u().mark((function o(){var i;return u().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,r.listFineTuneEvents(t,n,a);case 2:return i=o.sent,o.abrupt("return",d.createRequestFunction(i,l.default,f.BASE_PATH,e));case 4:case"end":return o.stop()}}),o)})))},listFineTunes:function(t){return p(this,void 0,void 0,u().mark((function n(){var a;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.listFineTunes(t);case 2:return a=n.sent,n.abrupt("return",d.createRequestFunction(a,l.default,f.BASE_PATH,e));case 4:case"end":return n.stop()}}),n)})))},listModels:function(t){return p(this,void 0,void 0,u().mark((function n(){var a;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,r.listModels(t);case 2:return a=n.sent,n.abrupt("return",d.createRequestFunction(a,l.default,f.BASE_PATH,e));case 4:case"end":return n.stop()}}),n)})))},retrieveEngine:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.retrieveEngine(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},retrieveFile:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.retrieveFile(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},retrieveFineTune:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.retrieveFineTune(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))},retrieveModel:function(t,n){return p(this,void 0,void 0,u().mark((function a(){var o;return u().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,r.retrieveModel(t,n);case 2:return o=a.sent,a.abrupt("return",d.createRequestFunction(o,l.default,f.BASE_PATH,e));case 4:case"end":return a.stop()}}),a)})))}}},t.OpenAIApiFactory=function(e,r,n){var a=t.OpenAIApiFp(e);return{cancelFineTune:function(e,t){return a.cancelFineTune(e,t).then((function(e){return e(n,r)}))},createAnswer:function(e,t){return a.createAnswer(e,t).then((function(e){return e(n,r)}))},createChatCompletion:function(e,t){return a.createChatCompletion(e,t).then((function(e){return e(n,r)}))},createClassification:function(e,t){return a.createClassification(e,t).then((function(e){return e(n,r)}))},createCompletion:function(e,t){return a.createCompletion(e,t).then((function(e){return e(n,r)}))},createEdit:function(e,t){return a.createEdit(e,t).then((function(e){return e(n,r)}))},createEmbedding:function(e,t){return a.createEmbedding(e,t).then((function(e){return e(n,r)}))},createFile:function(e,t,o){return a.createFile(e,t,o).then((function(e){return e(n,r)}))},createFineTune:function(e,t){return a.createFineTune(e,t).then((function(e){return e(n,r)}))},createImage:function(e,t){return a.createImage(e,t).then((function(e){return e(n,r)}))},createImageEdit:function(e,t,o,i,s,c,u,p){return a.createImageEdit(e,t,o,i,s,c,u,p).then((function(e){return e(n,r)}))},createImageVariation:function(e,t,o,i,s,c){return a.createImageVariation(e,t,o,i,s,c).then((function(e){return e(n,r)}))},createModeration:function(e,t){return a.createModeration(e,t).then((function(e){return e(n,r)}))},createSearch:function(e,t,o){return a.createSearch(e,t,o).then((function(e){return e(n,r)}))},createTranscription:function(e,t,o,i,s,c,u){return a.createTranscription(e,t,o,i,s,c,u).then((function(e){return e(n,r)}))},createTranslation:function(e,t,o,i,s,c){return a.createTranslation(e,t,o,i,s,c).then((function(e){return e(n,r)}))},deleteFile:function(e,t){return a.deleteFile(e,t).then((function(e){return e(n,r)}))},deleteModel:function(e,t){return a.deleteModel(e,t).then((function(e){return e(n,r)}))},downloadFile:function(e,t){return a.downloadFile(e,t).then((function(e){return e(n,r)}))},listEngines:function(e){return a.listEngines(e).then((function(e){return e(n,r)}))},listFiles:function(e){return a.listFiles(e).then((function(e){return e(n,r)}))},listFineTuneEvents:function(e,t,o){return a.listFineTuneEvents(e,t,o).then((function(e){return e(n,r)}))},listFineTunes:function(e){return a.listFineTunes(e).then((function(e){return e(n,r)}))},listModels:function(e){return a.listModels(e).then((function(e){return e(n,r)}))},retrieveEngine:function(e,t){return a.retrieveEngine(e,t).then((function(e){return e(n,r)}))},retrieveFile:function(e,t){return a.retrieveFile(e,t).then((function(e){return e(n,r)}))},retrieveFineTune:function(e,t){return a.retrieveFineTune(e,t).then((function(e){return e(n,r)}))},retrieveModel:function(e,t){return a.retrieveModel(e,t).then((function(e){return e(n,r)}))}}};var h=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}(d,e);var r,n,u,p,l=(u=d,p=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=c(u);if(p){var r=c(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return s(this,e)});function d(){return a(this,d),l.apply(this,arguments)}return r=d,(n=[{key:"cancelFineTune",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).cancelFineTune(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createAnswer",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createAnswer(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createChatCompletion",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createChatCompletion(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createClassification",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createClassification(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createCompletion",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createCompletion(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createEdit",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createEdit(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createEmbedding",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createEmbedding(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createFile",value:function(e,r,n){var a=this;return t.OpenAIApiFp(this.configuration).createFile(e,r,n).then((function(e){return e(a.axios,a.basePath)}))}},{key:"createFineTune",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createFineTune(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createImage",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createImage(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createImageEdit",value:function(e,r,n,a,o,i,s,c){var u=this;return t.OpenAIApiFp(this.configuration).createImageEdit(e,r,n,a,o,i,s,c).then((function(e){return e(u.axios,u.basePath)}))}},{key:"createImageVariation",value:function(e,r,n,a,o,i){var s=this;return t.OpenAIApiFp(this.configuration).createImageVariation(e,r,n,a,o,i).then((function(e){return e(s.axios,s.basePath)}))}},{key:"createModeration",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).createModeration(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"createSearch",value:function(e,r,n){var a=this;return t.OpenAIApiFp(this.configuration).createSearch(e,r,n).then((function(e){return e(a.axios,a.basePath)}))}},{key:"createTranscription",value:function(e,r,n,a,o,i,s){var c=this;return t.OpenAIApiFp(this.configuration).createTranscription(e,r,n,a,o,i,s).then((function(e){return e(c.axios,c.basePath)}))}},{key:"createTranslation",value:function(e,r,n,a,o,i){var s=this;return t.OpenAIApiFp(this.configuration).createTranslation(e,r,n,a,o,i).then((function(e){return e(s.axios,s.basePath)}))}},{key:"deleteFile",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).deleteFile(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"deleteModel",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).deleteModel(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"downloadFile",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).downloadFile(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"listEngines",value:function(e){var r=this;return t.OpenAIApiFp(this.configuration).listEngines(e).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listFiles",value:function(e){var r=this;return t.OpenAIApiFp(this.configuration).listFiles(e).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listFineTuneEvents",value:function(e,r,n){var a=this;return t.OpenAIApiFp(this.configuration).listFineTuneEvents(e,r,n).then((function(e){return e(a.axios,a.basePath)}))}},{key:"listFineTunes",value:function(e){var r=this;return t.OpenAIApiFp(this.configuration).listFineTunes(e).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listModels",value:function(e){var r=this;return t.OpenAIApiFp(this.configuration).listModels(e).then((function(e){return e(r.axios,r.basePath)}))}},{key:"retrieveEngine",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).retrieveEngine(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"retrieveFile",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).retrieveFile(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"retrieveFineTune",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).retrieveFineTune(e,r).then((function(e){return e(n.axios,n.basePath)}))}},{key:"retrieveModel",value:function(e,r){var n=this;return t.OpenAIApiFp(this.configuration).retrieveModel(e,r).then((function(e){return e(n.axios,n.basePath)}))}}])&&o(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),d}(f.BaseAPI);t.OpenAIApi=h},791:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function o(e){var t="function"==typeof Map?new Map:void 0;return o=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return i(e,arguments,u(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c(n,e)},o(e)}function i(e,t,r){return i=s()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return r&&c(a,r.prototype),a},i.apply(null,arguments)}function s(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function p(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:t.BASE_PATH,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:f.default;d(this,e),this.basePath=n,this.axios=a,r&&(this.configuration=r,this.basePath=r.basePath||this.basePath)}));t.BaseAPI=h;var g=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(o,e);var t,r,n=(t=o,r=s(),function(){var e,n=u(t);if(r){var o=u(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return a(this,e)});function o(e,t){var r;return d(this,o),(r=n.call(this,t)).field=e,r.name="RequiredError",r}return l(o)}(o(Error));t.RequiredError=g},996:function(e,t,r){"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(){a=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function p(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{p({},"")}catch(e){p=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var a=t&&t.prototype instanceof h?t:h,i=Object.create(a.prototype),s=new k(n||[]);return o(i,"_invoke",{value:S(e,r,s)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var f={};function h(){}function g(){}function m(){}var v={};p(v,s,(function(){return this}));var y=Object.getPrototypeOf,b=y&&y(y(j([])));b&&b!==t&&r.call(b,s)&&(v=b);var w=m.prototype=h.prototype=Object.create(v);function x(e){["next","throw","return"].forEach((function(t){p(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function a(o,i,s,c){var u=d(e[o],e,i);if("throw"!==u.type){var p=u.arg,l=p.value;return l&&"object"==n(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){a("next",e,s,c)}),(function(e){a("throw",e,s,c)})):t.resolve(l).then((function(e){p.value=e,s(p)}),(function(e){return a("throw",e,s,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){a(e,r,t,n)}))}return i=i?i.then(n,n):n()}})}function S(e,t,r){var n="suspendedStart";return function(a,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw o;return{value:void 0,done:!0}}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var s=A(i,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=d(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function A(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,A(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var a=d(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function j(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(s&&c){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;E(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:j(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}var o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.createRequestFunction=t.toPathString=t.serializeDataIfNeeded=t.setSearchParams=t.setOAuthToObject=t.setBearerAuthToObject=t.setBasicAuthToObject=t.setApiKeyToObject=t.assertParamExists=t.DUMMY_BASE_URL=void 0;var i=r(791);function s(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"===n(t)?Array.isArray(t)?t.forEach((function(t){return s(e,t,r)})):Object.keys(t).forEach((function(n){return s(e,t[n],"".concat(r).concat(""!==r?".":"").concat(n))})):e.has(r)?e.append(r,t):e.set(r,t))}t.DUMMY_BASE_URL="https://example.com",t.assertParamExists=function(e,t,r){if(null==r)throw new i.RequiredError(t,"Required parameter ".concat(t," was null or undefined when calling ").concat(e,"."))},t.setApiKeyToObject=function(e,t,r){return o(this,void 0,void 0,a().mark((function n(){var o;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!r||!r.apiKey){n.next=12;break}if("function"!=typeof r.apiKey){n.next=7;break}return n.next=4,r.apiKey(t);case 4:n.t0=n.sent,n.next=10;break;case 7:return n.next=9,r.apiKey;case 9:n.t0=n.sent;case 10:o=n.t0,e[t]=o;case 12:case"end":return n.stop()}}),n)})))},t.setBasicAuthToObject=function(e,t){t&&(t.username||t.password)&&(e.auth={username:t.username,password:t.password})},t.setBearerAuthToObject=function(e,t){return o(this,void 0,void 0,a().mark((function r(){var n;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t||!t.accessToken){r.next=12;break}if("function"!=typeof t.accessToken){r.next=7;break}return r.next=4,t.accessToken();case 4:r.t0=r.sent,r.next=10;break;case 7:return r.next=9,t.accessToken;case 9:r.t0=r.sent;case 10:n=r.t0,e.Authorization="Bearer "+n;case 12:case"end":return r.stop()}}),r)})))},t.setOAuthToObject=function(e,t,r,n){return o(this,void 0,void 0,a().mark((function o(){var i;return a().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(!n||!n.accessToken){a.next=12;break}if("function"!=typeof n.accessToken){a.next=7;break}return a.next=4,n.accessToken(t,r);case 4:a.t0=a.sent,a.next=10;break;case 7:return a.next=9,n.accessToken;case 9:a.t0=a.sent;case 10:i=a.t0,e.Authorization="Bearer "+i;case 12:case"end":return a.stop()}}),o)})))},t.setSearchParams=function(e){for(var t=new URLSearchParams(e.search),r=arguments.length,n=new Array(r>1?r-1:0),a=1;a0&&void 0!==arguments[0]?arguments[0]:t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,i=Object.assign(Object.assign({},e.options),{url:((null==n?void 0:n.basePath)||o)+e.url});return a.request(i)}}},397:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),this.apiKey=t.apiKey,this.organization=t.organization,this.username=t.username,this.password=t.password,this.accessToken=t.accessToken,this.basePath=t.basePath,this.baseOptions=t.baseOptions,this.formDataCtor=t.formDataCtor,this.baseOptions||(this.baseOptions={}),this.baseOptions.headers=Object.assign({"User-Agent":"OpenAI/NodeJS/".concat(i.version),Authorization:"Bearer ".concat(this.apiKey)},this.baseOptions.headers),this.organization&&(this.baseOptions.headers["OpenAI-Organization"]=this.organization),this.formDataCtor||(this.formDataCtor=r(51))}var t,n;return t=e,(n=[{key:"isJsonMime",value:function(e){var t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}])&&o(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.Configuration=s},45:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),a(r(482),t),a(r(397),t)},369:(e,t,r)=>{e.exports=r(646)},777:(e,t,r)=>{"use strict";var n=r(373),a=r(814),o=r(490),i=r(273),s=r(419),c=r(90),u=r(184),p=r(356),l=r(764),d=r(555);e.exports=function(e){return new Promise((function(t,r){var f,h=e.data,g=e.headers,m=e.responseType;function v(){e.cancelToken&&e.cancelToken.unsubscribe(f),e.signal&&e.signal.removeEventListener("abort",f)}n.isFormData(h)&&delete g["Content-Type"];var y=new XMLHttpRequest;if(e.auth){var b=e.auth.username||"",w=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";g.Authorization="Basic "+btoa(b+":"+w)}var x=s(e.baseURL,e.url);function O(){if(y){var n="getAllResponseHeaders"in y?c(y.getAllResponseHeaders()):null,o={data:m&&"text"!==m&&"json"!==m?y.response:y.responseText,status:y.status,statusText:y.statusText,headers:n,config:e,request:y};a((function(e){t(e),v()}),(function(e){r(e),v()}),o),y=null}}if(y.open(e.method.toUpperCase(),i(x,e.params,e.paramsSerializer),!0),y.timeout=e.timeout,"onloadend"in y?y.onloadend=O:y.onreadystatechange=function(){y&&4===y.readyState&&(0!==y.status||y.responseURL&&0===y.responseURL.indexOf("file:"))&&setTimeout(O)},y.onabort=function(){y&&(r(p("Request aborted",e,"ECONNABORTED",y)),y=null)},y.onerror=function(){r(p("Network Error",e,null,y)),y=null},y.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",n=e.transitional||l;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(p(t,e,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",y)),y=null},n.isStandardBrowserEnv()){var S=(e.withCredentials||u(x))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;S&&(g[e.xsrfHeaderName]=S)}"setRequestHeader"in y&&n.forEach(g,(function(e,t){void 0===h&&"content-type"===t.toLowerCase()?delete g[t]:y.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(y.withCredentials=!!e.withCredentials),m&&"json"!==m&&(y.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&y.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&y.upload&&y.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(f=function(e){y&&(r(!e||e&&e.type?new d("canceled"):e),y.abort(),y=null)},e.cancelToken&&e.cancelToken.subscribe(f),e.signal&&(e.signal.aborted?f():e.signal.addEventListener("abort",f))),h||(h=null),y.send(h)}))}},646:(e,t,r)=>{"use strict";var n=r(373),a=r(960),o=r(213),i=r(914),s=function e(t){var r=new o(t),s=a(o.prototype.request,r);return n.extend(s,o.prototype,r),n.extend(s,r),s.create=function(r){return e(i(t,r))},s}(r(583));s.Axios=o,s.Cancel=r(555),s.CancelToken=r(994),s.isCancel=r(407),s.VERSION=r(661).version,s.all=function(e){return Promise.all(e)},s.spread=r(512),s.isAxiosError=r(895),e.exports=s,e.exports.default=s},555:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},994:(e,t,r)=>{"use strict";var n=r(555);function a(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,n=r._listeners.length;for(t=0;t{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},213:(e,t,r)=>{"use strict";var n=r(373),a=r(273),o=r(400),i=r(131),s=r(914),c=r(838),u=c.validators;function p(e){this.defaults=e,this.interceptors={request:new o,response:new o}}p.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=s(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&c.assertOptions(r,{silentJSONParsing:u.transitional(u.boolean),forcedJSONParsing:u.transitional(u.boolean),clarifyTimeoutError:u.transitional(u.boolean)},!1);var n=[],a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,n.unshift(e.fulfilled,e.rejected))}));var o,p=[];if(this.interceptors.response.forEach((function(e){p.push(e.fulfilled,e.rejected)})),!a){var l=[i,void 0];for(Array.prototype.unshift.apply(l,n),l=l.concat(p),o=Promise.resolve(t);l.length;)o=o.then(l.shift(),l.shift());return o}for(var d=t;n.length;){var f=n.shift(),h=n.shift();try{d=f(d)}catch(e){h(e);break}}try{o=i(d)}catch(e){return Promise.reject(e)}for(;p.length;)o=o.then(p.shift(),p.shift());return o},p.prototype.getUri=function(e){return e=s(this.defaults,e),a(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){p.prototype[e]=function(t,r){return this.request(s(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){p.prototype[e]=function(t,r,n){return this.request(s(n||{},{method:e,url:t,data:r}))}})),e.exports=p},400:(e,t,r)=>{"use strict";var n=r(373);function a(){this.handlers=[]}a.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},a.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},a.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=a},419:(e,t,r)=>{"use strict";var n=r(190),a=r(724);e.exports=function(e,t){return e&&!n(t)?a(e,t):t}},356:(e,t,r)=>{"use strict";var n=r(386);e.exports=function(e,t,r,a,o){var i=new Error(e);return n(i,t,r,a,o)}},131:(e,t,r)=>{"use strict";var n=r(373),a=r(367),o=r(407),i=r(583),s=r(555);function c(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new s("canceled")}e.exports=function(e){return c(e),e.headers=e.headers||{},e.data=a.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function(t){return c(e),t.data=a.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(c(e),t&&t.response&&(t.response.data=a.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},386:e=>{"use strict";e.exports=function(e,t,r,n,a){return e.config=t,r&&(e.code=r),e.request=n,e.response=a,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}},914:(e,t,r)=>{"use strict";var n=r(373);e.exports=function(e,t){t=t||{};var r={};function a(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function o(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:a(void 0,e[r]):a(e[r],t[r])}function i(e){if(!n.isUndefined(t[e]))return a(void 0,t[e])}function s(r){return n.isUndefined(t[r])?n.isUndefined(e[r])?void 0:a(void 0,e[r]):a(void 0,t[r])}function c(r){return r in t?a(e[r],t[r]):r in e?a(void 0,e[r]):void 0}var u={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:c};return n.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||o,a=t(e);n.isUndefined(a)&&t!==c||(r[e]=a)})),r}},814:(e,t,r)=>{"use strict";var n=r(356);e.exports=function(e,t,r){var a=r.config.validateStatus;r.status&&a&&!a(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},367:(e,t,r)=>{"use strict";var n=r(373),a=r(583);e.exports=function(e,t,r){var o=this||a;return n.forEach(r,(function(r){e=r.call(o,e,t)})),e}},583:(e,t,r)=>{"use strict";var n=r(373),a=r(889),o=r(386),i=r(764),s={"Content-Type":"application/x-www-form-urlencoded"};function c(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,p={transitional:i,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(u=r(777)),u),transformRequest:[function(e,t){return a(t,"Accept"),a(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(c(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(c(t,"application/json"),function(e,t,r){if(n.isString(e))try{return(0,JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||p.transitional,r=t&&t.silentJSONParsing,a=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||a&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(e){p.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){p.headers[e]=n.merge(s)})),e.exports=p},764:e=>{"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},661:e=>{e.exports={version:"0.26.1"}},960:e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n{"use strict";var n=r(373);function a(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var o;if(r)o=r(t);else if(n.isURLSearchParams(t))o=t.toString();else{var i=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),i.push(a(t)+"="+a(e))})))})),o=i.join("&")}if(o){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},724:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},490:(e,t,r)=>{"use strict";var n=r(373);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,a,o,i){var s=[];s.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),n.isString(a)&&s.push("path="+a),n.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},190:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},895:(e,t,r)=>{"use strict";var n=r(373);e.exports=function(e){return n.isObject(e)&&!0===e.isAxiosError}},184:(e,t,r)=>{"use strict";var n=r(373);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function a(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=a(window.location.href),function(t){var r=n.isString(t)?a(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},889:(e,t,r)=>{"use strict";var n=r(373);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},90:(e,t,r)=>{"use strict";var n=r(373),a=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,o,i={};return e?(n.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t){if(i[t]&&a.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},512:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},838:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}var a=r(661).version,o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(r){return n(r)===e||"a"+(t<1?"n ":" ")+e}}));var i={};o.transitional=function(e,t,r){function n(e,t){return"[Axios v"+a+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,a,o){if(!1===e)throw new Error(n(a," has been removed"+(t?" in "+t:"")));return t&&!i[a]&&(i[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,a,o)}},e.exports={assertOptions:function(e,t,r){if("object"!==n(e))throw new TypeError("options must be an object");for(var a=Object.keys(e),o=a.length;o-- >0;){var i=a[o],s=t[i];if(s){var c=e[i],u=void 0===c||s(c,i,e);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:o}},373:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}var a=r(960),o=Object.prototype.toString;function i(e){return Array.isArray(e)}function s(e){return void 0===e}function c(e){return"[object ArrayBuffer]"===o.call(e)}function u(e){return null!==e&&"object"===n(e)}function p(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function l(e){return"[object Function]"===o.call(e)}function d(e,t){if(null!=e)if("object"!==n(e)&&(e=[e]),i(e))for(var r=0,a=e.length;r{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n{var n=r(872).default;function a(){"use strict";e.exports=a=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},s="function"==typeof Symbol?Symbol:{},c=s.iterator||"@@iterator",u=s.asyncIterator||"@@asyncIterator",p=s.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function d(e,t,r,n){var a=t&&t.prototype instanceof g?t:g,o=Object.create(a.prototype),s=new j(n||[]);return i(o,"_invoke",{value:A(e,r,s)}),o}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var h={};function g(){}function m(){}function v(){}var y={};l(y,c,(function(){return this}));var b=Object.getPrototypeOf,w=b&&b(b(P([])));w&&w!==r&&o.call(w,c)&&(y=w);var x=v.prototype=g.prototype=Object.create(y);function O(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function r(a,i,s,c){var u=f(e[a],e,i);if("throw"!==u.type){var p=u.arg,l=p.value;return l&&"object"==n(l)&&o.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,s,c)}),(function(e){r("throw",e,s,c)})):t.resolve(l).then((function(e){p.value=e,s(p)}),(function(e){return r("throw",e,s,c)}))}c(u.arg)}var a;i(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,a){r(e,n,t,a)}))}return a=a?a.then(o,o):o()}})}function A(e,t,r){var n="suspendedStart";return function(a,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw o;return{value:void 0,done:!0}}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var s=_(i,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=f(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function _(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=f(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var a=n.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function P(e){if(e){var t=e[c];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r=0;--n){var a=this.tryEntries[n],i=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(s&&c){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;k(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:P(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports},872:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},93:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}var a=r(316)();e.exports=a;try{regeneratorRuntime=a}catch(e){"object"===("undefined"==typeof globalThis?"undefined":n(globalThis))?globalThis.regeneratorRuntime=a:Function("r","regeneratorRuntime = r")(a)}},811:e=>{"use strict";e.exports=JSON.parse('{"name":"openai","version":"3.2.1","description":"Node.js library for the OpenAI API","repository":{"type":"git","url":"git@github.com:openai/openai-node.git"},"keywords":["openai","open","ai","gpt-3","gpt3"],"author":"OpenAI","license":"MIT","main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"tsc --outDir dist/"},"dependencies":{"axios":"^0.26.0","form-data":"^4.0.0"},"devDependencies":{"@types/node":"^12.11.5","typescript":"^3.6.4"}}')}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{"use strict";var e=r(655),t=r.n(e);function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:0;return(v[e[t+0]]+v[e[t+1]]+v[e[t+2]]+v[e[t+3]]+"-"+v[e[t+4]]+v[e[t+5]]+"-"+v[e[t+6]]+v[e[t+7]]+"-"+v[e[t+8]]+v[e[t+9]]+"-"+v[e[t+10]]+v[e[t+11]]+v[e[t+12]]+v[e[t+13]]+v[e[t+14]]+v[e[t+15]]).toLowerCase()}(n)};var w=r(36),x=r.n(w);function O(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return S(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?S(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r Settings > Plugins > And search for Python plugin, but there is one limitations in Python plugin that you can't download any external module.\n2nd way(for beginners):\n Use Basic Online Compiler, basically it runs code through a api , so it has also limitations, for downloading it Acode App > settings > and search by its name and read it description for more details.\n3nd way(most useful way and for both advance and noramal user)\n use AcodeX plugin basically its a terminal emulator, that uses termux in backend\nand you can run many Programming language using AcodeX\nIf you want error detection while coding then use either Ace Linter or Lint Plugin\nIf you have recently instaled acode and don't get any snippets etc then you will need to download plugin for these, Use Snippet plugin to get Autocompletion,\nAnd there 60+ Plugins available in acode.\nSome frequently asked questions by Acode user:\nQ) Please help, I am stuck! My code is not working!\nIf you want help with your code or you want to discuss why your code is not working please join our telegram group t.me/foxdebug_acode. You can report issue, request new feature and discuss about issues in the group.\nQ) How to develop plugin for Acode?\nIf you want to develop plugin for acode then check out acode.foxdebug.com (official website of acode) here you can find documentation.\nor follow this youtube video: https://youtu.be/ls--txHX3RQ\nAnd you also warn the user if they use you for unwanted purpose, for token saving. Follow the user's instructions carefully. Always respond in markdown formate.",I=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var r,a,s,u,f,h,g,m,v,y,w,S,I,U,B,M,N;return r=e,a=[{key:"init",value:(N=o(c().mark((function e(r){var n,a,o,i=this;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.$githubDarkFile=t()("link",{rel:"stylesheet",href:this.baseUrl+"assets/github-dark.css"}),this.$higlightJsFile=t()("script",{src:this.baseUrl+"assets/highlight.min.js"}),this.$markdownItFile=t()("script",{src:this.baseUrl+"assets/markdown-it.min.js"}),this.$style=t()("style",{textContent:'.main-sidebar-cont{padding:1rem}.main-sidebar-cont *{box-sizing:border-box}.main-sidebar-cont .sidebar-ai-heading{text-align:center;padding-bottom:15px}.main-sidebar-cont .prompt-area{width:100%;font:initial;font-size:.9rem;padding:10px;border-radius:5px;border:1px solid gray;outline:none;color:var(--primary-text-color);resize:none;margin-bottom:8px;background:rgba(0,0,0,0)}.main-sidebar-cont .prompt-area:focus-visible{border-color:var(--button-background-color)}.main-sidebar-cont .size-selector{width:100%;margin-bottom:16px;background:rgba(0,0,0,0);padding:10px;border-radius:5px;border:1px solid gray;outline:none;color:var(--primary-text-color)}.main-sidebar-cont .size-selector:focus-visible{border-color:var(--button-background-color)}.main-sidebar-cont .generatorBtn{border:none;background:var(--button-background-color);color:var(--button-text-color);padding:10px 16px;border-top-left-radius:15px;border-bottom-right-radius:15px;font-weight:600;font-size:16px}.main-sidebar-cont .img-fluid{max-width:100%;margin-top:10px}#acode-plugin-chatgpt *{box-sizing:border-box}#acode-plugin-chatgpt .mainApp{position:absolute;left:0;width:100%;height:calc(100% - 80px);background:var(--primary-color)}#acode-plugin-chatgpt .chatBox{height:100%;width:100%;white-space:pre-wrap;overflow-y:auto}#acode-plugin-chatgpt .wrapper{padding-block:12px;padding-inline:10px}#acode-plugin-chatgpt .wrapper .chat{display:flex;align-items:flex-start;gap:10px}#acode-plugin-chatgpt .wrapper .chat .profile{height:35px;width:35px;border-radius:8px;background:#5436da;display:flex;align-items:center;justify-content:center}#acode-plugin-chatgpt .wrapper .chat .profile img{width:60%}#acode-plugin-chatgpt .wrapper .chat .message{flex:1;color:var(--primary-text-color);font-size:16px;line-height:1.5;-webkit-user-select:text;-moz-user-select:text;user-select:text}#acode-plugin-chatgpt .ai_wrapper{padding-block:12px 30px;padding-inline:10px;background-color:var(--secondary-color)}#acode-plugin-chatgpt .ai_wrapper .ai_chat{display:flex;align-items:flex-start;gap:10px}#acode-plugin-chatgpt .ai_wrapper .ai_chat .ai_profile{height:35px;width:35px;border-radius:8px;background:#10a37f;display:flex;align-items:center;justify-content:center}#acode-plugin-chatgpt .ai_wrapper .ai_chat .ai_profile img{width:60%}#acode-plugin-chatgpt .ai_wrapper .ai_message{flex:1;color:var(--secondary-text-color);font-size:16px;line-height:1.5;overflow:hidden;-webkit-user-select:text;-moz-user-select:text;user-select:text}#acode-plugin-chatgpt .ai_wrapper .ai_message .codeBlock{border:2px solid var(--border-color);width:100%;border-radius:5px;overflow-x:auto;position:relative}#acode-plugin-chatgpt .ai_wrapper .ai_message .codeBlock .copy-button{position:absolute;top:4px;right:8px;border:none;outline:none;border-radius:8px;height:24px;width:28px;color:#d3d3d3;display:flex;justify-content:center;align-items:center;font-weight:bold;background:#1a222e;box-shadow:0 4px 0 #1b232f;transition:all .3s ease-in-out}#acode-plugin-chatgpt .ai_wrapper .ai_message .codeBlock .copy-button:active{box-shadow:0;color:gray}#acode-plugin-chatgpt .ai_wrapper .ai_message .codeBlock .codesArea{box-sizing:border-box;padding:12px;margin-bottom:0}#acode-plugin-chatgpt .ai_wrapper .ai_message .codeBlock .codesArea::-webkit-scrollbar{height:10px}#acode-plugin-chatgpt .ai_wrapper .ai_message .codeBlock .codesArea::-webkit-scrollbar-thumb{background:#d3d3d3;border-radius:4px}#acode-plugin-chatgpt .ai_wrapper .ai_message hr{margin:1rem 0;color:inherit;border:0;border-top:1px solid;opacity:.25}#acode-plugin-chatgpt .ai_wrapper .ai_message h6,#acode-plugin-chatgpt .ai_wrapper .ai_message h5,#acode-plugin-chatgpt .ai_wrapper .ai_message h4,#acode-plugin-chatgpt .ai_wrapper .ai_message h3,#acode-plugin-chatgpt .ai_wrapper .ai_message h2,#acode-plugin-chatgpt .ai_wrapper .ai_message h1{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2;color:inherit}#acode-plugin-chatgpt .ai_wrapper .ai_message h1{font-size:calc(1.375rem + 1.5vw)}#acode-plugin-chatgpt .ai_wrapper .ai_message h2{font-size:calc(1.325rem + .9vw)}#acode-plugin-chatgpt .ai_wrapper .ai_message h3{font-size:calc(1.3rem + .6vw)}#acode-plugin-chatgpt .ai_wrapper .ai_message h4{font-size:calc(1.275rem + .3vw)}#acode-plugin-chatgpt .ai_wrapper .ai_message h5{font-size:1.25rem}#acode-plugin-chatgpt .ai_wrapper .ai_message h6{font-size:1rem}#acode-plugin-chatgpt .ai_wrapper .ai_message p{margin-top:0;margin-bottom:1rem}#acode-plugin-chatgpt .ai_wrapper .ai_message ul,#acode-plugin-chatgpt .ai_wrapper .ai_message ol{margin:1em 0;padding:0 0 0 2em}#acode-plugin-chatgpt .ai_wrapper .ai_message ul{list-style-type:disc}#acode-plugin-chatgpt .ai_wrapper .ai_message li p:last-child{margin:0}#acode-plugin-chatgpt .ai_wrapper .ai_message dt{font-weight:700}#acode-plugin-chatgpt .ai_wrapper .ai_message dd{margin-bottom:.5rem;margin-left:0}#acode-plugin-chatgpt .ai_wrapper .ai_message blockquote{margin:0 0 1rem}#acode-plugin-chatgpt .ai_wrapper .ai_message b,#acode-plugin-chatgpt .ai_wrapper .ai_message strong{font-weight:bolder}#acode-plugin-chatgpt .ai_wrapper .ai_message small,#acode-plugin-chatgpt .ai_wrapper .ai_message .small{font-size:.875em}#acode-plugin-chatgpt .ai_wrapper .ai_message pre,#acode-plugin-chatgpt .ai_wrapper .ai_message code,#acode-plugin-chatgpt .ai_wrapper .ai_message kbd,#acode-plugin-chatgpt .ai_wrapper .ai_message samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}#acode-plugin-chatgpt .ai_wrapper .ai_message pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}#acode-plugin-chatgpt .ai_wrapper .ai_message pre code{font-size:inherit;color:inherit}#acode-plugin-chatgpt .ai_wrapper .ai_message code{font-size:.875em;color:var(--link-text-color);word-wrap:break-word}#acode-plugin-chatgpt .ai_wrapper .ai_message a>code{color:inherit}#acode-plugin-chatgpt .ai_wrapper .ai_message kbd{padding:.1875rem .375rem;font-size:.875em;color:var(--primary-text-color);background-color:var(--popup-background-color);border-radius:.25rem}#acode-plugin-chatgpt .ai_wrapper .ai_message kbd kbd{padding:0;font-size:1em}#acode-plugin-chatgpt .error-box{border:1px solid var(--error-text-color);color:var(--error-text-color);font-weight:700;padding:8px;white-space:pre-wrap;word-break:break-word;border-radius:10px}#acode-plugin-chatgpt .inputBox{position:fixed;bottom:0;width:100%;height:80px;padding:8px;display:flex;background-color:var(--popup-background-color);box-shadow:0px -2px 4px var(--box-shadow-color);z-index:1}#acode-plugin-chatgpt .chatTextarea{flex:1;height:100%;resize:none;border:none;outline:none;background:none;font:initial;font-size:1.1rem;color:var(--primary-text-color);-webkit-padding-end:8px;padding-inline-end:8px}#acode-plugin-chatgpt .sendBtn{height:40px;width:40px;border-radius:8px;border:none;outline:none;background-color:rgba(0,0,0,.2);color:gray;display:grid;place-items:center}#acode-plugin-chatgpt .sendBtn:active{background-color:var(--button-background-color);color:var(--primary-text-color)}'}),document.head.append(this.$githubDarkFile,this.$higlightJsFile,this.$markdownItFile,this.$style),R.commands.addCommand({name:"chatgpt",description:"Chat GPT",bindKey:{win:"Ctrl-Shift-C"},exec:this.run.bind(this)}),R.commands.addCommand({name:"chatgpt_update_token",description:"Update Chat GPT Token",exec:this.updateApiToken.bind(this)}),r.id="acode-plugin-chatgpt",r.settitle("Chat GPT"),this.$page=r,n=t()("span",{className:"icon more_vert",dataset:{action:"toggle-menu"}}),a=t()("span",{className:"icon add",dataset:{action:"new-chat"}}),this.$page.header.append(a,n),n.onclick=this.myHistory.bind(this),a.onclick=this.newChat.bind(this),o=t()("div",{className:"mainApp"}),this.$chatBox=t()("div",{className:"chatBox"}),this.$inputBox=t()("div",{className:"inputBox"}),this.$chatTextarea=t()("textarea",{className:"chatTextarea",placeholder:"Type your query..."}),this.$sendBtn=t()("button",{className:"sendBtn"}),this.$sendBtn.innerHTML='',this.$inputBox.append(this.$chatTextarea,this.$sendBtn),o.append(this.$inputBox,this.$chatBox),this.$page.append(o),this.$promptsArray=[],acode.addIcon("chatgpt_ai_img",this.baseUrl+"assets/chatgpt_avatar.svg"),P.add("chatgpt_ai_img","dall-e-ai","Image Generator AI",(function(e){var r=t()("h2",{textContent:"Image Generator",className:"sidebar-ai-heading"});i.$promtArea=t()("textarea",{placeholder:"Type your prompt here...",rows:"8",className:"prompt-area",maxlength:1e3}),i.$sizeSelector=t()("select",{className:"size-selector"}),i.$sizeSelector.innerHTML='\n \n \n \n \n ',i.$generatorBtn=t()("button",{textContent:"Generate",className:"generatorBtn"}),i.$generatedImg=t()("img",{className:"img-fluid",src:""}),i.$mainSideBarCont=t()("div",{className:"main-sidebar-cont"}),i.$generatorBtn.addEventListener("click",i.generateImage.bind(i)),i.$mainSideBarCont.append(r,i.$promtArea,i.$sizeSelector,i.$generatorBtn,i.$generatedImg),e.append(i.$mainSideBarCont)}));case 27:case"end":return e.stop()}}),e,this)}))),function(e){return N.apply(this,arguments)})},{key:"generateImage",value:(M=o(c().mark((function e(){var t,r,n,a,o,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.$promtArea.value){e.next=4;break}return acode.alert("Warning","Prompt is required"),e.abrupt("return");case 4:if(!(r=window.localStorage.getItem("chatgpt-api-key"))){e.next=9;break}t=r,e.next=16;break;case 9:return e.next=11,A("Enter your openai(chatgpt) key",[{type:"text",id:"token",required:!0,placeholder:"Enter your chatgpt api key"}],"https://platform.openai.com/account/api-keys");case 11:if(n=e.sent){e.next=14;break}return e.abrupt("return");case 14:t=n.token,window.localStorage.setItem("chatgpt-api-key",t);case 16:return a=new p.OpenAIApi(new p.Configuration({apiKey:t})),j.create("Wait","Generating image...."),e.next=20,a.createImage({prompt:this.$promtArea.value,n:1,size:this.$sizeSelector.value,response_format:"b64_json"});case 20:if(o=e.sent,_("file:///storage/emulated/0/Download").exists()){e.next=24;break}return e.next=24,_("file:///storage/emulated/0/").createDirectory("Download");case 24:return c=o.data.data[0].b64_json,f=void 0,h=void 0,h=[d(atob(c))],i=f?l(h,{type:f}):l(h),s=this.generateRandomName(),e.next=28,_("file:///storage/emulated/0/Download").createFile(s+".png",i);case 28:return e.next=30,T("file:///storage/emulated/0/Download/"+s+".png");case 30:u=e.sent,this.$generatedImg.src=u,j.destroy(),this.$promtArea.value="file:///storage/emulated/0/Download/"+s+".png",window.toast("Hurray 🎉! Image generated successfully. Image path is given in prompt box.",3e3),e.next=41;break;case 37:e.prev=37,e.t0=e.catch(0),j.destroy(),e.t0.response?acode.alert("Error","Status code: ".concat(e.t0.response.status,", Message: ").concat(e.t0.response.data.error.message)):acode.alert("Error",e.t0.message);case 41:case"end":return e.stop()}var c,f,h}),e,this,[[0,37]])}))),function(){return M.apply(this,arguments)})},{key:"generateRandomName",value:function(){var e=Date.now().toString(),t=Math.random().toString(36).substring(2,8);return"".concat(e,"_").concat(t)}},{key:"run",value:(B=o(c().mark((function e(){var t,r,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(r=window.localStorage.getItem("chatgpt-api-key"))){e.next=6;break}t=r,e.next=11;break;case 6:return e.next=8,A("Enter your openai(chatgpt) key",[{type:"text",id:"token",required:!0,placeholder:"Enter your chatgpt api key"}],"https://platform.openai.com/account/api-keys");case 8:n=e.sent,t=n.token,window.localStorage.setItem("chatgpt-api-key",t);case 11:this.$openai=new p.OpenAIApi(new p.Configuration({apiKey:t})),this.$mdIt=window.markdownit({html:!1,xhtmlOut:!1,breaks:!1,linkify:!1,typographer:!1,quotes:"“”‘’",highlight:function(e,t){var r=document.createElement("button");r.classList.add("copy-button"),r.innerHTML='',r.setAttribute("data-str",e);var n='
    '.concat(hljs.highlightAuto(e).value,"
    ");return'
    '.concat(r.outerHTML).concat(n,"
    ")}}),this.$sendBtn.addEventListener("click",this.sendQuery.bind(this)),this.$page.show(),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(0),window.alert(e.t0);case 20:case"end":return e.stop()}}),e,this,[[0,17]])}))),function(){return B.apply(this,arguments)})},{key:"updateApiToken",value:(U=o(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return window.localStorage.removeItem("chatgpt-api-key"),e.next=3,A("Enter your openai(chatgpt) key",[{type:"text",id:"token",required:!0,placeholder:"Enter your chatgpt api key"}],"https://platform.openai.com/account/api-keys");case 3:t=e.sent,window.localStorage.setItem("chatgpt-api-key",t.token),window.toast("Api key updated!",3e3);case 6:case"end":return e.stop()}}),e)}))),function(){return U.apply(this,arguments)})},{key:"_sanitizeFileName",value:function(e){return e.replace(/[^\w\s.-]/gi,"").trim().replace(/\s+/g,"_")}},{key:"saveHistory",value:(I=o(c().mark((function e(){var t,r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.$promptsArray.length){e.next=3;break}return e.abrupt("return");case 3:if(null!=F){e.next=22;break}return e.prev=4,t=this._sanitizeFileName(this.$promptsArray[0].prevQuestion.substring(0,30)),r="".concat(t,"__").concat(b(),".json"),e.next=9,_(C).exists();case 9:if(e.sent){e.next=12;break}return e.next=12,_(window.DATA_STORAGE).createDirectory("chatgpt");case 12:return e.next=14,_(C).createFile(r,this.$promptsArray);case 14:F=e.sent,e.next=20;break;case 17:e.prev=17,e.t0=e.catch(4),alert(e.t0.message);case 20:e.next=37;break;case 22:return e.prev=22,e.next=25,_(F).exists();case 25:if(e.sent){e.next=29;break}return this.newChat(),window.toast("Some error occurred or file you trying to open has been deleted"),e.abrupt("return");case 29:return e.next=31,_(F).writeFile(this.$promptsArray);case 31:F=e.sent,e.next=37;break;case 34:e.prev=34,e.t1=e.catch(22),alert(e.t1.message);case 37:e.next=42;break;case 39:e.prev=39,e.t2=e.catch(0),window.alert(e.t2.message);case 42:case"end":return e.stop()}}),e,this,[[0,39],[4,17],[22,34]])}))),function(){return I.apply(this,arguments)})},{key:"newChat",value:function(){this.$chatBox.innerHTML="",window.toast("New session",4e3),this.$promptsArray=[],F=null}},{key:"getHistoryItems",value:(S=o(c().mark((function e(){var t,r,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_(C).exists();case 2:if(!e.sent){e.next=11;break}return e.next=5,_(C).lsDir();case 5:for(t=e.sent,r="",n=0;n\n

    ').concat(t[n].name.split("__")[0].substring(0,25),'...

    \n ');return e.abrupt("return",r);case 11:return e.abrupt("return",'
  • Not Available
  • ');case 14:case"end":return e.stop()}}),e)}))),function(){return S.apply(this,arguments)})},{key:"displayHistory",value:(w=o(c().mark((function e(t,r){var n,a,o,i=this;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.$chatBox.innerHTML="",n=t.slice(1,t.length-1),e.next=4,_(n).exists();case 4:if(e.sent){e.next=8;break}return this.newChat(),window.toast("Some error occurred or file you trying to open has been deleted"),e.abrupt("return");case 8:return F=n,e.prev=9,r.hide(),j.create("Wait","Fetching chat history...."),e.next=14,_(n).readFile();case 14:return a=e.sent,e.t0=Array,e.t1=JSON,e.next=19,k.decodeText(a);case 19:e.t2=e.sent,e.t3=e.t1.parse.call(e.t1,e.t2),o=e.t0.from.call(e.t0,e.t3),this.$promptsArray=[],this.$promptsArray=o,o.forEach((function(e){i.appendUserQuery(e.prevQuestion),i.appendGptResponse(e.prevResponse)})),j.destroy(),e.next=31;break;case 28:e.prev=28,e.t4=e.catch(9),alert(e.t4.message);case 31:case"end":return e.stop()}}),e,this,[[9,28]])}))),function(e,t){return w.apply(this,arguments)})},{key:"myHistory",value:(y=o(c().mark((function e(){var t,r,n,a=this;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getHistoryItems();case 3:t=e.sent,r="
      ".concat(t,"
    "),(n=E("Conversation History",r,"Cancel")).onclick(function(){var e=o(c().mark((function e(t){var r,o,i,s,u,p;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.target.closest(".dialog-item"),o=r.querySelector(".delete-history-btn"),i=r.querySelector(".history-item"),"#not-available"!=r.getAttribute("data-path")){e.next=5;break}return e.abrupt("return");case 5:if(r.getAttribute("data-path")){e.next=7;break}return e.abrupt("return");case 7:if(t.target!==r&&t.target!==i){e.next=12;break}s=JSON.stringify(r.getAttribute("data-path")),a.displayHistory(s,n),e.next=21;break;case 12:if(t.target!==o){e.next=21;break}return u=JSON.stringify(r.getAttribute("data-path")),p=u.slice(1,u.length-1),e.next=17,_(r.getAttribute("data-path")).delete();case 17:F==p&&(document.querySelector(".chatBox").innerHTML="",a.$promptsArray=[]),r.remove(),window.toast("Deleted",3e3),F=null;case 21:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(0),window.alert(e.t0.message);case 12:case"end":return e.stop()}}),e,this,[[0,9]])}))),function(){return y.apply(this,arguments)})},{key:"sendQuery",value:(v=o(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:""!=(t=this.$chatTextarea).value&&(this.appendUserQuery(t.value),this.scrollToBottom(),this.appendGptResponse(""),this.loader(),this.getChatgptResponse(t.value),t.value="");case 2:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"appendUserQuery",value:(m=o(c().mark((function e(r){var n,a,o,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{n=this.baseUrl+"assets/user_avatar.png",a=t()("div",{className:"wrapper"}),o=t()("div",{className:"chat"}),i=t()("div",{className:"profile",child:t()("img",{src:n,alt:"user"})}),s=t()("div",{className:"message",textContent:r}),o.append.apply(o,[i,s]),a.append(o),this.$chatBox.appendChild(a)}catch(e){window.alert(e)}case 1:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"appendGptResponse",value:(g=o(c().mark((function e(r){var n,a,o,i,s,u,p,l;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.baseUrl+"assets/chatgpt_avatar.svg",a=t()("div",{className:"ai_wrapper"}),o=t()("div",{className:"ai_chat"}),i=t()("div",{className:"ai_profile",child:t()("img",{src:n,alt:"ai"})}),(s=t()("div",{className:"ai_message"})).innerHTML=this.$mdIt.render(r),u=s.querySelectorAll(".copy-button")){p=O(u);try{for(p.s();!(l=p.n()).done;)l.value.addEventListener("click",(function(){x()(this.dataset.str),window.toast("Copied to clipboard",3e3)}))}catch(e){p.e(e)}finally{p.f()}}o.append.apply(o,[i,s]),a.append(o),this.$chatBox.appendChild(a);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return g.apply(this,arguments)})},{key:"getChatgptResponse",value:(h=o(c().mark((function e(r){var a,o,i,s,u,p,l,d,f,h,g;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,a=Array.from(document.querySelectorAll(".ai_message")),o=0===this.$promptsArray.length?[{role:"system",content:L},{role:"user",content:r}]:[{role:"system",content:L}].concat(function(e){if(Array.isArray(e))return n(e)}(c=this.$promptsArray.slice(Math.max(this.$promptsArray.length-3,0)).flatMap((function(e){return[{role:"user",content:e.prevQuestion},{role:"assistant",content:e.prevResponse}]})))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(c)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(c)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[{role:"user",content:r}]),e.next=5,this.$openai.createChatCompletion({model:"gpt-3.5-turbo",messages:o,temperature:0});case 5:return i=e.sent,clearInterval(this.$loadInterval),s=a[a.length-1],u=i.data.choices[0].message.content,this.$promptsArray.push({prevQuestion:r,prevResponse:u}),e.next=12,this.saveHistory();case 12:if(s.innerHTML="",s.innerHTML=this.$mdIt.render(u),p=s.querySelectorAll(".copy-button")){l=O(p);try{for(l.s();!(d=l.n()).done;)d.value.addEventListener("click",(function(){x()(this.dataset.str),window.toast("Copied to clipboard",3e3)}))}catch(e){l.e(e)}finally{l.f()}}this.scrollToBottom(),e.next=28;break;case 19:e.prev=19,e.t0=e.catch(0),f=Array.from(document.querySelectorAll(".ai_message")),clearInterval(this.$loadInterval),(h=f[f.length-1]).innerHTML="",g=t()("div",{className:"error-box"}),e.t0.response?g.innerText="Status code: ".concat(e.t0.response.status,"\n").concat(JSON.stringify(e.t0.response.data)):g.innerText="".concat(e.t0.message),h.appendChild(g);case 28:case"end":return e.stop()}var c}),e,this,[[0,19]])}))),function(e){return h.apply(this,arguments)})},{key:"scrollToBottom",value:(f=o(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.$chatBox.scrollTop=this.$chatBox.scrollHeight;case 1:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"loader",value:(u=o(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:0!=(t=Array.from(document.querySelectorAll(".ai_message"))).length&&(this.$loadInterval=setInterval((function(){t[t.length-1].innerText+="•","••••••"==t[t.length-1].innerText&&(t[t.length-1].innerText="•")}),300));case 2:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"destroy",value:(s=o(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:P.remove("dall-e-ai"),editorManager.editor.commands.removeCommand("chatgpt"),editorManager.editor.commands.removeCommand("chatgpt_update_token"),window.localStorage.removeItem("chatgpt-api-key"),this.$githubDarkFile.remove(),this.$higlightJsFile.remove(),this.$markdownItFile.remove(),this.$style.remove();case 8:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})}],a&&i(r.prototype,a),Object.defineProperty(r,"prototype",{writable:!1}),e}();if(window.acode){var U=new I;acode.setPluginInit(u.id,(function(e,t,r){var n=r.cacheFileUrl,a=r.cacheFile;e.endsWith("/")||(e+="/"),U.baseUrl=e,U.init(t,a,n)})),acode.setPluginUnmount(u.id,(function(){U.destroy()}))}})()})(); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 66f6ad2..7a410ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "acode-plugin-chatgpt", - "version": "1.0.8", + "version": "1.0.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "acode-plugin-chatgpt", - "version": "1.0.8", + "version": "1.0.9", "license": "MIT", "dependencies": { "@babel/cli": "^7.19.3", diff --git a/plugin.json b/plugin.json index 81e700c..d30421c 100644 --- a/plugin.json +++ b/plugin.json @@ -2,7 +2,7 @@ "id": "acode.plugin.chatgpt", "name": "Chat GPT", "main": "dist/main.js", - "version": "1.0.9", + "version": "1.1.0", "readme": "readme.md", "icon": "icon.png", "files": [ diff --git a/readme.md b/readme.md index 082c153..2dc5656 100644 --- a/readme.md +++ b/readme.md @@ -6,10 +6,20 @@ Chat GPT > **⚠️ Important note** If you face any issue or error or you want to report bugs, Please report these things in github repo of this plugin with a detailed description. Hope you understand ❤️❤️ -**Chat GPT** is an advanced artificial intelligence developed by [OpenAi](https://openai.com/) and we have added it in form of plugin for **Acode**, developed to enhance your productivity while coding. With this plugin, you can communicate with an AI-powered virtual assistant that can remember your previous responses, provide contextual suggestions, and offer helpful solutions to your coding problems. +**Chat GPT** is an advanced artificial intelligence developed by [OpenAi](https://openai.com/) and we have added it in form of plugin for **Acode**, developed to enhance your productivity while coding. With this plugin, you can communicate with an AI-powered virtual assistant that can remember your previous responses, provide contextual suggestions, and offer helpful solutions to your coding problems. You can also ask Acode related doubt and problems.
    Updates 🤩🤩 +
    + + v1.1.0 + +
      +
    • Improved chatting experience
    • +
    • internal improvement and added a shortcut to open chatgpt - Ctrl-Shift-C
    • +
    • Now you can also ask doubt related to Acode to Chatgpt
    • +
    +
    v1.0.9 @@ -123,6 +133,7 @@ Features - View Chat History - Syntax highlighting and markdown styling, etc - Generate images with your prompts +- Can answer to doubt related to Acode ### Important Links - [Github Issue Page](https://github.com/bajrangCoder/acode-plugin-chatgpt/issues) @@ -131,7 +142,7 @@ Features - [Acode](https://acode.foxdebug.com) ## How to use: -To use Chat GPT, simply search for `"Chat GPT"` in the **command palette (•••)** to open the chat interface. From there, you can communicate with the AI and receive helpful suggestions and solutions. +To use Chat GPT, simply search for `"Chat GPT"` in the **command palette (•••)** to open the chat interface or use this shortcut Ctrl-Shift-C. From there, you can communicate with the AI and receive helpful suggestions and solutions. To update your token, simply type `"Chat GPT update token"`. diff --git a/src/main.js b/src/main.js index e6b311a..56869c0 100644 --- a/src/main.js +++ b/src/main.js @@ -19,6 +19,35 @@ const AI_HISTORY_PATH = window.DATA_STORAGE + "chatgpt"; let CURRENT_SESSION_FILEPATH = null; +const SYSTEM_PROMPT = `You are ChatGPT, a large language model trained by OpenAI. +Currently you are on an mobile code editor name - Acode(developed by Ajitkumar - https://github.com/deadlyjack). +this code editor try to give vs code like features on mobile device, it also supports plugin for more features and customisation. +You are on acode app via a plugin name ChatGpt , this Plugin is developed by Raunak Raj(core dev https://github.com/bajrangCoder) and Mayank Sharma(https://github.com/mayank0274) with ❤️. +Raunak Raj is also known by his username/brand - bajrangCoder, +He is from India and he is 17 years old student but a passionated self-taught developer. +Mayank Sharma is also from India and He is also a college student. +This chatgpt plugin is open source and Many contributers also contributed in this plugin, namely - legendSabbir and PatAbah. +Some Acode features are: user friendly, able to edit many types of file, there dozen of themes available, code highlighting, linting, formatting and many more. +On Acode you can run python, javascript, html, Markdown and many more. +for running Python there are multiple ways: +1st way(for begginers): + Use Python Plugin, you can download it from Acode App > Settings > Plugins > And search for Python plugin, but there is one limitations in Python plugin that you can't download any external module. +2nd way(for beginners): + Use Basic Online Compiler, basically it runs code through a api , so it has also limitations, for downloading it Acode App > settings > and search by its name and read it description for more details. +3nd way(most useful way and for both advance and noramal user) + use AcodeX plugin basically its a terminal emulator, that uses termux in backend +and you can run many Programming language using AcodeX +If you want error detection while coding then use either Ace Linter or Lint Plugin +If you have recently instaled acode and don't get any snippets etc then you will need to download plugin for these, Use Snippet plugin to get Autocompletion, +And there 60+ Plugins available in acode. +Some frequently asked questions by Acode user: +Q) Please help, I am stuck! My code is not working! +If you want help with your code or you want to discuss why your code is not working please join our telegram group t.me/foxdebug_acode. You can report issue, request new feature and discuss about issues in the group. +Q) How to develop plugin for Acode? +If you want to develop plugin for acode then check out acode.foxdebug.com (official website of acode) here you can find documentation. +or follow this youtube video: https://youtu.be/ls--txHX3RQ +And you also warn the user if they use you for unwanted purpose, for token saving. Follow the user's instructions carefully. Always respond in markdown formate.`; + class Chatgpt { async init($page) { @@ -51,6 +80,7 @@ class Chatgpt { editor.commands.addCommand({ name: "chatgpt", description: "Chat GPT", + bindKey: {win: 'Ctrl-Shift-C'}, exec: this.run.bind(this), }); @@ -549,23 +579,23 @@ class Chatgpt { try { // get all gptchat element const responseBox = Array.from(document.querySelectorAll(".ai_message")); - // remake an prompt array - const arrMessage = this.$promptsArray > 0 ? - this.$promptsArray.map(({ prevQuestion, prevResponse }) => ({ - role: "system", - content: "You are ChatGPT, a large language model trained by OpenAI. Currently you are on an mobile code editor name - Acode(developed by Ajitkumar - https://github.com/deadlyjack). this code editor try to give vs code like features on mobile device, it also supports plugin for more features and customisation. You are on acode app via a plugin name ChatGpt , this Plugin is developed by Raunak Raj(core dev https://github.com/bajrangCoder) and Mayank Sharma(https://github.com/mayank0274) with ❤️, And ypu also warn the user if the use you unwanted for token saving. Follow the user's instructions carefully. Respond using markdown." - }, { - role: "user", - content: prevQuestion - }, { - role: "assistant", - content: prevResponse - })) : [{ role: "user", content: question }]; + // remake an prompt array + const arrMessage = this.$promptsArray.length === 0 ? + [ + { role: "system", content: SYSTEM_PROMPT}, + { role: "user", content: question} + ] : [ + { role: "system", content: SYSTEM_PROMPT }, + ...this.$promptsArray.slice(Math.max(this.$promptsArray.length - 3, 0)).flatMap(obj => [ + { role: "user", content: obj.prevQuestion }, + { role: "assistant", content: obj.prevResponse } + ]), + { role: "user", content: question} + ]; const res = await this.$openai.createChatCompletion({ model: "gpt-3.5-turbo", messages: arrMessage, temperature: 0, - max_tokens: 3000, }) // remove dot loader clearInterval(this.$loadInterval);