From 360cb03975dd1be83b3bb0c667bcd5067f1d653e Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 2 Apr 2024 18:48:08 +0700 Subject: [PATCH] gpt: remove cycle models --- .config/ags/modules/sideleft/apis/chatgpt.js | 9 --------- .config/ags/services/gpt.js | 19 +------------------ 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/.config/ags/modules/sideleft/apis/chatgpt.js b/.config/ags/modules/sideleft/apis/chatgpt.js index 3c15983a9..a223b1227 100644 --- a/.config/ags/modules/sideleft/apis/chatgpt.js +++ b/.config/ags/modules/sideleft/apis/chatgpt.js @@ -181,15 +181,6 @@ const GPTSettings = () => MarginRevealer({ hpack: 'fill', className: 'sidebar-chat-settings-toggles', children: [ - ConfigToggle({ - icon: 'cycle', - name: 'Cycle models', - desc: 'Helps avoid exceeding the API rate of 3 messages per minute.\nTurn this on if you message rapidly.', - initValue: GPTService.cycleModels, - onChange: (self, newValue) => { - GPTService.cycleModels = newValue; - }, - }), ConfigToggle({ icon: 'model_training', name: 'Enhancements', diff --git a/.config/ags/services/gpt.js b/.config/ags/services/gpt.js index d0cc8ac15..0ced55ade 100644 --- a/.config/ags/services/gpt.js +++ b/.config/ags/services/gpt.js @@ -60,7 +60,6 @@ const initMessages = // The whole chat will be sent every request anyway. Utils.exec(`mkdir -p ${GLib.get_user_cache_dir()}/ags/user/ai`); const CHAT_MODELS = ["gpt-3.5-turbo-1106", "gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-0613"] -const ONE_CYCLE_COUNT = 3; class GPTMessage extends Service { static { @@ -135,7 +134,6 @@ class GPTService extends Service { _assistantPrompt = true; _currentProvider = userOptions.ai.defaultGPTProvider; - _cycleModels = false; _requestCount = 0; _temperature = userOptions.ai.defaultTemperature; _messages = []; @@ -143,7 +141,7 @@ class GPTService extends Service { _key = ''; _key_file_location = `${GLib.get_user_cache_dir()}/ags/user/ai/${PROVIDERS[this._currentProvider]['key_file']}`; _url = GLib.Uri.parse(PROVIDERS[this._currentProvider]['base_url'], GLib.UriFlags.NONE); - + _decoder = new TextDecoder(); _initChecks() { @@ -182,15 +180,6 @@ class GPTService extends Service { .catch(err => print(err)); } - get cycleModels() { return this._cycleModels } - set cycleModels(value) { - this._cycleModels = value; - if (!value) this._modelIndex = 0; - else { - this._modelIndex = (this._requestCount - (this._requestCount % ONE_CYCLE_COUNT)) % CHAT_MODELS.length; - } - } - get temperature() { return this._temperature } set temperature(value) { this._temperature = value; } @@ -274,12 +263,6 @@ class GPTService extends Service { }); this._messages.push(aiResponse); this.emit('newMsg', this._messages.length - 1); - - if (this._cycleModels) { - this._requestCount++; - if (this._cycleModels) - this._modelIndex = (this._requestCount - (this._requestCount % ONE_CYCLE_COUNT)) % CHAT_MODELS.length; - } } }