diff --git a/.config/ags/modules/.configuration/default_options.jsonc b/.config/ags/modules/.configuration/default_options.jsonc index 79d0835b..6a1db468 100644 --- a/.config/ags/modules/.configuration/default_options.jsonc +++ b/.config/ags/modules/.configuration/default_options.jsonc @@ -6,6 +6,7 @@ "defaultGPTProvider": "openai", "defaultTemperature": 0.5, "enhancements": true, + "keep_alive": -1, // For ollama. -1 means forever "useHistory": false, "safety": true, "writingCursor": " ...", // Warning: Using weird characters can mess up Markdown rendering diff --git a/.config/ags/services/gpt.js b/.config/ags/services/gpt.js index 76d95ec5..70a0a93d 100644 --- a/.config/ags/services/gpt.js +++ b/.config/ags/services/gpt.js @@ -7,15 +7,6 @@ import Soup from 'gi://Soup?version=3.0'; import { fileExists } from '../modules/.miscutils/files.js'; const PROVIDERS = Object.assign({ - "openai": { - "name": "OpenAI", - "logo_name": "openai-symbolic", - "description": getString('Official OpenAI API.\nPricing: Free for the first $5 or 3 months, whichever is less.'), - "base_url": "https://api.openai.com/v1/chat/completions", - "key_get_url": "https://platform.openai.com/api-keys", - "key_file": "openai_key.txt", - "model": "gpt-3.5-turbo", - }, "ollama": { "name": "Ollama - Llama 3", "logo_name": "ollama-symbolic", @@ -52,6 +43,15 @@ const PROVIDERS = Object.assign({ "key_file": "openrouter_key.txt", "model": "meta-llama/llama-3-70b-instruct", }, + "openai": { + "name": "OpenAI - GPT-3.5", + "logo_name": "openai-symbolic", + "description": getString('Official OpenAI API.\nPricing: Free for the first $5 or 3 months, whichever is less.'), + "base_url": "https://api.openai.com/v1/chat/completions", + "key_get_url": "https://platform.openai.com/api-keys", + "key_file": "openai_key.txt", + "model": "gpt-3.5-turbo", + }, }, userOptions.ai.extraGptModels) // Custom prompt @@ -249,11 +249,11 @@ class GPTService extends Service { const aiResponse = new GPTMessage('assistant', '', true, false) const body = { - model: PROVIDERS[this._currentProvider]['model'], - messages: this._messages.map(msg => { let m = { role: msg.role, content: msg.content }; return m; }), - temperature: this._temperature, - // temperature: 2, // <- Nuts - stream: true, + "model": PROVIDERS[this._currentProvider]['model'], + "messages": this._messages.map(msg => { let m = { role: msg.role, content: msg.content }; return m; }), + "temperature": this._temperature, + "stream": true, + "keep_alive": userOptions.ai.keepAlive, }; const proxyResolver = new Gio.SimpleProxyResolver({ 'default-proxy': userOptions.ai.proxyUrl }); const session = new Soup.Session({ 'proxy-resolver': proxyResolver });