From 26084162f30fdfd3e0f06cfab7e1c7b1ec0240e9 Mon Sep 17 00:00:00 2001 From: muhammedsaidckr Date: Thu, 2 May 2024 15:48:26 +0300 Subject: [PATCH] Updated options for chat completions models --- js/dist/admin.js | 2 +- js/dist/admin.js.map | 2 +- js/src/admin/components/ChatGptSettings.tsx | 14 +++++--------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/js/dist/admin.js b/js/dist/admin.js index 98ed5a1..0bb073e 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,2 @@ -(()=>{var t={n:a=>{var e=a&&a.__esModule?()=>a.default:()=>a;return t.d(e,{a:e}),e},d:(a,e)=>{for(var n in e)t.o(e,n)&&!t.o(a,n)&&Object.defineProperty(a,n,{enumerable:!0,get:e[n]})},o:(t,a)=>Object.prototype.hasOwnProperty.call(t,a),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},a={};(()=>{"use strict";t.r(a);const e=flarum.core.compat["common/app"];t.n(e)().initializers.add("muhammedsaidckr/flarum-chatgpt",(function(){console.log("[muhammedsaidckr/flarum-chatgpt] Hello, forum and admin!")}));const n=flarum.core.compat["admin/app"];var s=t.n(n);function r(t,a){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,a){return t.__proto__=a,t},r(t,a)}const i=flarum.core.compat["admin/components/ExtensionPage"];var o=function(t){var a,e;function n(){return t.apply(this,arguments)||this}e=t,(a=n).prototype=Object.create(e.prototype),a.prototype.constructor=a,r(a,e);var i=n.prototype;return i.oninit=function(a){t.prototype.oninit.call(this,a),this.loading=!1},i.content=function(){return m("div",{className:"ExtensionPage-settings"},m("div",{className:"container"},m("div",{className:"Form"},this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.api_key",type:"text",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.api_key_label"),help:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.api_key_help",{a:m("a",{href:"https://platform.openai.com/account/api-keys",target:"_blank",rel:"noopener"})}),placeholder:"sk-..."}),this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.model",type:"dropdown",options:{"gpt-3.5-turbo-instruct":"gpt-3.5-turbo-instruct","gpt-3.5-turbo-16k-0613":"gpt-3.5-turbo-16k-0613","gpt-3.5-turbo-16k":"gpt-3.5-turbo-16k","text-davinci-003":"text-davinci-003","gpt-4":"gpt-4","gpt-4-0613":"gpt-4-0613","gpt-4-32k":"gpt-4-32k","gpt-4-32k-0613":"gpt-4-32k-0613","gpt-4-0314":"gpt-4-0314","gpt-4-32k-0314":"gpt-4-32k-0314"},label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.model_label"),help:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.model_help",{a:m("a",{href:"https://platform.openai.com/docs/models/overview",target:"_blank",rel:"noopener"})})}),this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.max_tokens",type:"number",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.max_tokens_label"),help:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.max_tokens_help",{a:m("a",{href:"https://help.openai.com/en/articles/4936856",target:"_blank",rel:"noopener"})}),default:100}),this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.user_prompt",type:"text",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.user_prompt_label"),help:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.user_prompt_help")}),this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.user_prompt_badge_text",type:"text",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.user_prompt_badge_label"),help:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.user_prompt_badge_help")}),this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.answer_duration",type:"number",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.answer_duration_label")}),this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.enable_on_reply",type:"boolean",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.enable_on_reply_label")}),this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.enable_on_discussion_started",type:"boolean",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.enable_on_discussion_started_label"),help:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.enable_on_discussion_started_help")}),this.buildSettingComponent({type:"flarum-tags.select-tags",setting:"muhammedsaidckr-chatgpt.enabled-tags",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.enabled_tags_label"),help:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.enabled_tags_help"),options:{requireParentTag:!1,limits:{max:{secondary:0}}}}),m("div",{className:"Form-group"},this.submitButton()))))},n}(t.n(i)());s().initializers.add("muhammedsaidckr-chatgpt",(function(){console.log("Hello, admin!"),s().extensionData.for("muhammedsaidckr-chatgpt").registerPermission({label:s().translator.trans("muhammedsaidckr-chatgpt.admin.permissions.use_chatgpt_assistant_label"),icon:"fas fa-comment",permission:"discussion.useChatGPTAssistant",allowGuest:!1},"start").registerPage(o)}))})(),module.exports=a})(); +(()=>{var t={n:a=>{var e=a&&a.__esModule?()=>a.default:()=>a;return t.d(e,{a:e}),e},d:(a,e)=>{for(var n in e)t.o(e,n)&&!t.o(a,n)&&Object.defineProperty(a,n,{enumerable:!0,get:e[n]})},o:(t,a)=>Object.prototype.hasOwnProperty.call(t,a),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},a={};(()=>{"use strict";t.r(a);const e=flarum.core.compat["common/app"];t.n(e)().initializers.add("muhammedsaidckr/flarum-chatgpt",(function(){console.log("[muhammedsaidckr/flarum-chatgpt] Hello, forum and admin!")}));const n=flarum.core.compat["admin/app"];var s=t.n(n);function r(t,a){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,a){return t.__proto__=a,t},r(t,a)}const o=flarum.core.compat["admin/components/ExtensionPage"];var i=function(t){var a,e;function n(){return t.apply(this,arguments)||this}e=t,(a=n).prototype=Object.create(e.prototype),a.prototype.constructor=a,r(a,e);var o=n.prototype;return o.oninit=function(a){t.prototype.oninit.call(this,a),this.loading=!1},o.content=function(){return m("div",{className:"ExtensionPage-settings"},m("div",{className:"container"},m("div",{className:"Form"},this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.api_key",type:"text",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.api_key_label"),help:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.api_key_help",{a:m("a",{href:"https://platform.openai.com/account/api-keys",target:"_blank",rel:"noopener"})}),placeholder:"sk-..."}),this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.model",type:"dropdown",options:{"gpt-4-turbo":"gpt-4-turbo","gpt-4-turbo-2024-04-09":"gpt-4-turbo-2024-04-09","gpt-4":"gpt-4","gpt-3.5-turbo-0125":"gpt-3.5-turbo-0125","gpt-3.5-turbo":"gpt-3.5-turbo","gpt-3.5-turbo-instruct":"gpt-3.5-turbo-instruct"},label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.model_label"),help:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.model_help",{a:m("a",{href:"https://platform.openai.com/docs/models/overview",target:"_blank",rel:"noopener"})})}),this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.max_tokens",type:"number",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.max_tokens_label"),help:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.max_tokens_help",{a:m("a",{href:"https://help.openai.com/en/articles/4936856",target:"_blank",rel:"noopener"})}),default:100}),this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.user_prompt",type:"text",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.user_prompt_label"),help:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.user_prompt_help")}),this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.user_prompt_badge_text",type:"text",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.user_prompt_badge_label"),help:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.user_prompt_badge_help")}),this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.answer_duration",type:"number",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.answer_duration_label")}),this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.enable_on_reply",type:"boolean",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.enable_on_reply_label")}),this.buildSettingComponent({setting:"muhammedsaidckr-chatgpt.enable_on_discussion_started",type:"boolean",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.enable_on_discussion_started_label"),help:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.enable_on_discussion_started_help")}),this.buildSettingComponent({type:"flarum-tags.select-tags",setting:"muhammedsaidckr-chatgpt.enabled-tags",label:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.enabled_tags_label"),help:s().translator.trans("muhammedsaidckr-chatgpt.admin.settings.enabled_tags_help"),options:{requireParentTag:!1,limits:{max:{secondary:0}}}}),m("div",{className:"Form-group"},this.submitButton()))))},n}(t.n(o)());s().initializers.add("muhammedsaidckr-chatgpt",(function(){console.log("Hello, admin!"),s().extensionData.for("muhammedsaidckr-chatgpt").registerPermission({label:s().translator.trans("muhammedsaidckr-chatgpt.admin.permissions.use_chatgpt_assistant_label"),icon:"fas fa-comment",permission:"discussion.useChatGPTAssistant",allowGuest:!1},"start").registerPage(i)}))})(),module.exports=a})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index ef3a78c..b5ac367 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAA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,WAAe6B,MAAM,kEAG7BT,KAAKK,sBAAsB,CAC1BC,QAAS,0CACTC,KAAM,UACNC,MAAO5B,IAAAA,WAAe6B,MAAM,kEAE7BT,KAAKK,sBAAsB,CAC1BC,QAAS,uDACTC,KAAM,UACNC,MAAO5B,IAAAA,WAAe6B,MAAM,6EAC5BC,KAAM9B,IAAAA,WAAe6B,MAAM,8EAE5BT,KAAKK,sBAAsB,CAC1BE,KAAM,0BACND,QAAS,uCACTE,MAAO5B,IAAAA,WAAe6B,MAAM,6DAC5BC,KAAM9B,IAAAA,WAAe6B,MAAM,4DAC3BM,QAAS,CACPE,kBAAkB,EAClBC,OAAQ,CACNC,IAAK,CACHC,UAAW,OAKnBjB,EAAA,OAAKC,UAAU,cAAcJ,KAAKqB,kBAK5C,EAAChC,CAAA,CAlGiC,C,MAASiC,IEA7C1C,IAAAA,aAAiBC,IAAI,2BAA2B,WAC9CC,QAAQC,IAAI,iBACZH,IAAAA,cAAiB,IACV,2BACJ2C,mBACC,CACEf,MAAO5B,IAAAA,WAAe6B,MAAM,yEAC5Be,KAAM,iBACNC,WAAY,iCACZC,YAAY,GAEd,SACAC,aAAatC,EACnB,G","sources":["webpack://@muhammedsaidckr/flarum-chatgpt/webpack/bootstrap","webpack://@muhammedsaidckr/flarum-chatgpt/webpack/runtime/compat get default export","webpack://@muhammedsaidckr/flarum-chatgpt/webpack/runtime/define property getters","webpack://@muhammedsaidckr/flarum-chatgpt/webpack/runtime/hasOwnProperty shorthand","webpack://@muhammedsaidckr/flarum-chatgpt/webpack/runtime/make namespace object","webpack://@muhammedsaidckr/flarum-chatgpt/external root \"flarum.core.compat['common/app']\"","webpack://@muhammedsaidckr/flarum-chatgpt/./src/common/index.ts","webpack://@muhammedsaidckr/flarum-chatgpt/external root \"flarum.core.compat['admin/app']\"","webpack://@muhammedsaidckr/flarum-chatgpt/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@muhammedsaidckr/flarum-chatgpt/external root \"flarum.core.compat['admin/components/ExtensionPage']\"","webpack://@muhammedsaidckr/flarum-chatgpt/./src/admin/components/ChatGptSettings.tsx","webpack://@muhammedsaidckr/flarum-chatgpt/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@muhammedsaidckr/flarum-chatgpt/./src/admin/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/app'];","import app from 'flarum/common/app';\n\napp.initializers.add('muhammedsaidckr/flarum-chatgpt', () => {\n console.log('[muhammedsaidckr/flarum-chatgpt] Hello, forum and admin!');\n});\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/ExtensionPage'];","import app from \"flarum/admin/app\";\nimport ExtensionPage, {ExtensionPageAttrs} from 'flarum/admin/components/ExtensionPage';\n\nexport default class ChatGptSettings extends ExtensionPage {\n oninit(vnode) {\n super.oninit(vnode);\n this.loading = false;\n }\n\n content() {\n return (\n
\n
\n
\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.api_key',\n type: 'text',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.api_key_label'),\n help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.api_key_help', {\n a: ,\n }),\n placeholder: 'sk-...',\n })}\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.model',\n type: 'dropdown',\n options: {\n 'gpt-3.5-turbo-instruct': 'gpt-3.5-turbo-instruct',\n 'gpt-3.5-turbo-16k-0613': 'gpt-3.5-turbo-16k-0613',\n 'gpt-3.5-turbo-16k': 'gpt-3.5-turbo-16k',\n 'text-davinci-003': 'text-davinci-003',\n 'gpt-4': 'gpt-4',\n 'gpt-4-0613': 'gpt-4-0613',\n 'gpt-4-32k': 'gpt-4-32k',\n 'gpt-4-32k-0613': 'gpt-4-32k-0613',\n 'gpt-4-0314': 'gpt-4-0314',\n 'gpt-4-32k-0314': 'gpt-4-32k-0314',\n },\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.model_label'),\n help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.model_help', {\n a: ,\n }),\n })}\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.max_tokens',\n type: 'number',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.max_tokens_label'),\n help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.max_tokens_help', {\n a: ,\n }),\n default: 100,\n })}\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.user_prompt',\n type: 'text',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.user_prompt_label'),\n help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.user_prompt_help'),\n })}\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.user_prompt_badge_text',\n type: 'text',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.user_prompt_badge_label'),\n help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.user_prompt_badge_help'),\n })}\n {/* new setting for answer duration in minutes (default 5) */}\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.answer_duration',\n type: 'number',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.answer_duration_label'),\n })}\n {/*If any user replied to post, the AI will not reply to that post setting*/}\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.enable_on_reply',\n type: 'boolean',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.enable_on_reply_label'),\n })}\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.enable_on_discussion_started',\n type: 'boolean',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.enable_on_discussion_started_label'),\n help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.enable_on_discussion_started_help'),\n })}\n {this.buildSettingComponent({\n type: 'flarum-tags.select-tags',\n setting: 'muhammedsaidckr-chatgpt.enabled-tags',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.enabled_tags_label'),\n help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.enabled_tags_help'),\n options: {\n requireParentTag: false,\n limits: {\n max: {\n secondary: 0,\n },\n },\n },\n })}\n
{this.submitButton()}
\n
\n
\n
\n );\n }\n}\n","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","import app from 'flarum/admin/app';\nimport ChatGptSettings from \"./components/ChatGptSettings\";\n\napp.initializers.add('muhammedsaidckr-chatgpt', () => {\n console.log('Hello, admin!')\n app.extensionData\n .for('muhammedsaidckr-chatgpt')\n .registerPermission(\n {\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.permissions.use_chatgpt_assistant_label'),\n icon: 'fas fa-comment',\n permission: 'discussion.useChatGPTAssistant',\n allowGuest: false,\n },\n 'start'\n ).registerPage(ChatGptSettings);\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","add","console","log","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","ChatGptSettings","_ExtensionPage","subClass","superClass","apply","arguments","create","constructor","_proto","oninit","vnode","this","loading","content","m","className","buildSettingComponent","setting","type","label","trans","help","href","target","rel","placeholder","options","default","requireParentTag","limits","max","secondary","submitButton","ExtensionPage","registerPermission","icon","permission","allowGuest","registerPage"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,c,MCExDC,GAAAA,aAAiBC,IAAI,kCAAkC,WACrDC,QAAQC,IAAI,2DACd,ICJA,MAAM,EAA+BN,OAAO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,YAAY,GAEd,SACAC,aAAatC,EACnB,G","sources":["webpack://@muhammedsaidckr/flarum-chatgpt/webpack/bootstrap","webpack://@muhammedsaidckr/flarum-chatgpt/webpack/runtime/compat get default export","webpack://@muhammedsaidckr/flarum-chatgpt/webpack/runtime/define property getters","webpack://@muhammedsaidckr/flarum-chatgpt/webpack/runtime/hasOwnProperty shorthand","webpack://@muhammedsaidckr/flarum-chatgpt/webpack/runtime/make namespace object","webpack://@muhammedsaidckr/flarum-chatgpt/external root \"flarum.core.compat['common/app']\"","webpack://@muhammedsaidckr/flarum-chatgpt/./src/common/index.ts","webpack://@muhammedsaidckr/flarum-chatgpt/external root \"flarum.core.compat['admin/app']\"","webpack://@muhammedsaidckr/flarum-chatgpt/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@muhammedsaidckr/flarum-chatgpt/external root \"flarum.core.compat['admin/components/ExtensionPage']\"","webpack://@muhammedsaidckr/flarum-chatgpt/./src/admin/components/ChatGptSettings.tsx","webpack://@muhammedsaidckr/flarum-chatgpt/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@muhammedsaidckr/flarum-chatgpt/./src/admin/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/app'];","import app from 'flarum/common/app';\n\napp.initializers.add('muhammedsaidckr/flarum-chatgpt', () => {\n console.log('[muhammedsaidckr/flarum-chatgpt] Hello, forum and admin!');\n});\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/ExtensionPage'];","import app from \"flarum/admin/app\";\nimport ExtensionPage, {ExtensionPageAttrs} from 'flarum/admin/components/ExtensionPage';\n\nexport default class ChatGptSettings extends ExtensionPage {\n oninit(vnode) {\n super.oninit(vnode);\n this.loading = false;\n }\n\n content() {\n return (\n
\n
\n
\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.api_key',\n type: 'text',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.api_key_label'),\n help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.api_key_help', {\n a: ,\n }),\n placeholder: 'sk-...',\n })}\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.model',\n type: 'dropdown',\n options: {\n 'gpt-4-turbo': 'gpt-4-turbo',\n 'gpt-4-turbo-2024-04-09': 'gpt-4-turbo-2024-04-09',\n 'gpt-4': 'gpt-4',\n 'gpt-3.5-turbo-0125': 'gpt-3.5-turbo-0125',\n 'gpt-3.5-turbo': 'gpt-3.5-turbo',\n 'gpt-3.5-turbo-instruct': 'gpt-3.5-turbo-instruct',\n },\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.model_label'),\n help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.model_help', {\n a: ,\n }),\n })}\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.max_tokens',\n type: 'number',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.max_tokens_label'),\n help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.max_tokens_help', {\n a: ,\n }),\n default: 100,\n })}\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.user_prompt',\n type: 'text',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.user_prompt_label'),\n help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.user_prompt_help'),\n })}\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.user_prompt_badge_text',\n type: 'text',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.user_prompt_badge_label'),\n help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.user_prompt_badge_help'),\n })}\n {/* new setting for answer duration in minutes (default 5) */}\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.answer_duration',\n type: 'number',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.answer_duration_label'),\n })}\n {/*If any user replied to post, the AI will not reply to that post setting*/}\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.enable_on_reply',\n type: 'boolean',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.enable_on_reply_label'),\n })}\n {this.buildSettingComponent({\n setting: 'muhammedsaidckr-chatgpt.enable_on_discussion_started',\n type: 'boolean',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.enable_on_discussion_started_label'),\n help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.enable_on_discussion_started_help'),\n })}\n {this.buildSettingComponent({\n type: 'flarum-tags.select-tags',\n setting: 'muhammedsaidckr-chatgpt.enabled-tags',\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.enabled_tags_label'),\n help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.enabled_tags_help'),\n options: {\n requireParentTag: false,\n limits: {\n max: {\n secondary: 0,\n },\n },\n },\n })}\n
{this.submitButton()}
\n
\n
\n
\n );\n }\n}\n","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","import app from 'flarum/admin/app';\nimport ChatGptSettings from \"./components/ChatGptSettings\";\n\napp.initializers.add('muhammedsaidckr-chatgpt', () => {\n console.log('Hello, admin!')\n app.extensionData\n .for('muhammedsaidckr-chatgpt')\n .registerPermission(\n {\n label: app.translator.trans('muhammedsaidckr-chatgpt.admin.permissions.use_chatgpt_assistant_label'),\n icon: 'fas fa-comment',\n permission: 'discussion.useChatGPTAssistant',\n allowGuest: false,\n },\n 'start'\n ).registerPage(ChatGptSettings);\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","add","console","log","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","ChatGptSettings","_ExtensionPage","subClass","superClass","apply","arguments","create","constructor","_proto","oninit","vnode","this","loading","content","m","className","buildSettingComponent","setting","type","label","trans","help","href","target","rel","placeholder","options","default","requireParentTag","limits","max","secondary","submitButton","ExtensionPage","registerPermission","icon","permission","allowGuest","registerPage"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/admin/components/ChatGptSettings.tsx b/js/src/admin/components/ChatGptSettings.tsx index ae39df0..d25b809 100644 --- a/js/src/admin/components/ChatGptSettings.tsx +++ b/js/src/admin/components/ChatGptSettings.tsx @@ -25,16 +25,12 @@ export default class ChatGptSettings extends ExtensionPage { setting: 'muhammedsaidckr-chatgpt.model', type: 'dropdown', options: { - 'gpt-3.5-turbo-instruct': 'gpt-3.5-turbo-instruct', - 'gpt-3.5-turbo-16k-0613': 'gpt-3.5-turbo-16k-0613', - 'gpt-3.5-turbo-16k': 'gpt-3.5-turbo-16k', - 'text-davinci-003': 'text-davinci-003', + 'gpt-4-turbo': 'gpt-4-turbo', + 'gpt-4-turbo-2024-04-09': 'gpt-4-turbo-2024-04-09', 'gpt-4': 'gpt-4', - 'gpt-4-0613': 'gpt-4-0613', - 'gpt-4-32k': 'gpt-4-32k', - 'gpt-4-32k-0613': 'gpt-4-32k-0613', - 'gpt-4-0314': 'gpt-4-0314', - 'gpt-4-32k-0314': 'gpt-4-32k-0314', + 'gpt-3.5-turbo-0125': 'gpt-3.5-turbo-0125', + 'gpt-3.5-turbo': 'gpt-3.5-turbo', + 'gpt-3.5-turbo-instruct': 'gpt-3.5-turbo-instruct', }, label: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.model_label'), help: app.translator.trans('muhammedsaidckr-chatgpt.admin.settings.model_help', {