forked from Shinonome/dots-hyprland
gpt: remove cycle models
This commit is contained in:
@@ -181,15 +181,6 @@ const GPTSettings = () => MarginRevealer({
|
|||||||
hpack: 'fill',
|
hpack: 'fill',
|
||||||
className: 'sidebar-chat-settings-toggles',
|
className: 'sidebar-chat-settings-toggles',
|
||||||
children: [
|
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({
|
ConfigToggle({
|
||||||
icon: 'model_training',
|
icon: 'model_training',
|
||||||
name: 'Enhancements',
|
name: 'Enhancements',
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ const initMessages =
|
|||||||
// The whole chat will be sent every request anyway.
|
// The whole chat will be sent every request anyway.
|
||||||
Utils.exec(`mkdir -p ${GLib.get_user_cache_dir()}/ags/user/ai`);
|
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 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 {
|
class GPTMessage extends Service {
|
||||||
static {
|
static {
|
||||||
@@ -135,7 +134,6 @@ class GPTService extends Service {
|
|||||||
|
|
||||||
_assistantPrompt = true;
|
_assistantPrompt = true;
|
||||||
_currentProvider = userOptions.ai.defaultGPTProvider;
|
_currentProvider = userOptions.ai.defaultGPTProvider;
|
||||||
_cycleModels = false;
|
|
||||||
_requestCount = 0;
|
_requestCount = 0;
|
||||||
_temperature = userOptions.ai.defaultTemperature;
|
_temperature = userOptions.ai.defaultTemperature;
|
||||||
_messages = [];
|
_messages = [];
|
||||||
@@ -182,15 +180,6 @@ class GPTService extends Service {
|
|||||||
.catch(err => print(err));
|
.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 }
|
get temperature() { return this._temperature }
|
||||||
set temperature(value) { this._temperature = value; }
|
set temperature(value) { this._temperature = value; }
|
||||||
|
|
||||||
@@ -274,12 +263,6 @@ class GPTService extends Service {
|
|||||||
});
|
});
|
||||||
this._messages.push(aiResponse);
|
this._messages.push(aiResponse);
|
||||||
this.emit('newMsg', this._messages.length - 1);
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user