From ca73b05c70252f3570519b8230b616f69bf2d215 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sun, 6 Apr 2025 01:37:38 +0200 Subject: [PATCH] ai: fix user option, clean up models --- .../ags/assets/icons/deepseek-symbolic.svg | 47 +++++++++++ .../.configuration/default_options.jsonc | 20 +++-- .../modules/.configuration/user_options.js | 4 +- .config/ags/services/gpt.js | 82 +++++++++---------- 4 files changed, 102 insertions(+), 51 deletions(-) create mode 100644 .config/ags/assets/icons/deepseek-symbolic.svg diff --git a/.config/ags/assets/icons/deepseek-symbolic.svg b/.config/ags/assets/icons/deepseek-symbolic.svg new file mode 100644 index 000000000..029e12663 --- /dev/null +++ b/.config/ags/assets/icons/deepseek-symbolic.svg @@ -0,0 +1,47 @@ + + + + + + + + + diff --git a/.config/ags/modules/.configuration/default_options.jsonc b/.config/ags/modules/.configuration/default_options.jsonc index 074067d35..af3b86bf8 100644 --- a/.config/ags/modules/.configuration/default_options.jsonc +++ b/.config/ags/modules/.configuration/default_options.jsonc @@ -89,15 +89,17 @@ "sidebar": { "ai": { "extraGptModels": { - "oxygen3": { - "name": "Oxygen (GPT-3.5)", - "logo_name": "ai-oxygen-symbolic", - "description": "An API from Tornado Softwares\nPricing: Free: 100/day\nRequires you to join their Discord for a key", - "base_url": "https://app.oxyapi.uk/v1/chat/completions", - "key_get_url": "https://discord.com/invite/kM6MaCqGKA", - "key_file": "oxygen_key.txt", - "model": "gpt-3.5-turbo" - } + // Below is an example. Copy to user_options.jsonc and edit it + // The base url is conveniently ollama's btw + // "model_id": { + // "name": "User-added model", + // "logo_name": "ollama-symbolic", + // "description": "A model added by the user", + // "base_url": "http://localhost:11434/v1/chat/completions", + // "key_get_url": "", + // "key_file": "api_key_file.txt", + // "model": "model-name" + // }, } }, "image": { diff --git a/.config/ags/modules/.configuration/user_options.js b/.config/ags/modules/.configuration/user_options.js index e6726b128..878070b66 100644 --- a/.config/ags/modules/.configuration/user_options.js +++ b/.config/ags/modules/.configuration/user_options.js @@ -4,7 +4,9 @@ import { parseJSONC } from '../.miscutils/jsonc.js'; function overrideConfigRecursive(userOverrides, configOptions = {}) { for (const [key, value] of Object.entries(userOverrides)) { - if (typeof value === 'object' && !(value instanceof Array)) { + if (typeof value === 'object' + && !(value instanceof Array) + && configOptions[key]) { overrideConfigRecursive(value, configOptions[key]); } else { diff --git a/.config/ags/services/gpt.js b/.config/ags/services/gpt.js index d5cbb25f9..54463bfe0 100644 --- a/.config/ags/services/gpt.js +++ b/.config/ags/services/gpt.js @@ -6,51 +6,51 @@ import GLib from 'gi://GLib'; import Soup from 'gi://Soup?version=3.0'; import { fileExists } from '../modules/.miscutils/files.js'; -const PROVIDERS = Object.assign({ // There's this list hmm https://github.com/zukixa/cool-ai-stuff/ - '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', +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', - 'description': getString('Official Ollama API.\nPricing: Free.'), - 'base_url': 'http://localhost:11434/v1/chat/completions', - 'key_get_url': 'it\'s just ollama', - 'key_file': 'ollama_key.txt', - 'model': 'llama3:instruct', + "ollama": { + "name": "Ollama - Llama 3", + "logo_name": "ollama-symbolic", + "description": getString('Ollama - Llama-3'), + "base_url": 'http://localhost:11434/v1/chat/completions', + "key_get_url": "", + "key_file": "ollama_key.txt", + "model": "llama3:instruct", }, - 'openrouter': { - 'name': 'OpenRouter (Llama-3-70B)', - 'logo_name': 'openrouter-symbolic', - 'description': getString('A unified interface for LLMs'), - 'base_url': 'https://openrouter.ai/api/v1/chat/completions', - 'key_get_url': 'https://openrouter.ai/keys', - 'key_file': 'openrouter_key.txt', - 'model': 'meta-llama/llama-3-70b-instruct', + "ollama_deepseek_r1": { + "name": "Ollama - DeepSeek R1", + "logo_name": "deepseek-symbolic", + "description": getString('That popular Chinese model that thinks thoroughly'), + "base_url": "http://localhost:11434/v1/chat/completions", + "key_get_url": "", + "key_file": "ollama_key.txt", + "model": "deepseek-r1", }, - 'oxygen4o': { - 'name': 'Oxygen (GPT-4o)', - 'logo_name': 'ai-oxygen-symbolic', - 'description': getString('An API from Tornado Softwares\nPricing: Free: 100/day\nRequires you to join their Discord for a key'), - 'base_url': 'https://app.oxyapi.uk/v1/chat/completions', - 'key_get_url': 'https://discord.com/invite/kM6MaCqGKA', - 'key_file': 'oxygen_key.txt', - 'model': 'gpt-4o', + "ollama_gemma3": { + "name": "Ollama - Gemma 3", + "logo_name": "google-gemini-symbolic", + "description": getString('Gemma 3 from Google. Runs on a single GPU.'), + "base_url": "http://localhost:11434/v1/chat/completions", + "key_get_url": "", + "key_file": "ollama_key.txt", + "model": "gemma3", }, - 'zukijourney': { - 'name': 'zukijourney (GPT-3.5)', - 'logo_name': 'ai-zukijourney', - 'description': getString("An API from @zukixa on GitHub.\nNote: Keys are IP-locked so it's buggy sometimes\nPricing: Free: 10/min, 800/day.\nRequires you to join their Discord for a key"), - 'base_url': 'https://zukijourney.xyzbot.net/v1/chat/completions', - 'key_get_url': 'https://discord.com/invite/Y4J6XXnmQ6', - 'key_file': 'zuki_key.txt', - 'model': 'gpt-3.5-turbo', + "openrouter": { + "name": "OpenRouter (Llama-3-70B)", + "logo_name": "openrouter-symbolic", + "description": getString('A unified interface for LLMs'), + "base_url": "https://openrouter.ai/api/v1/chat/completions", + "key_get_url": "https://openrouter.ai/keys", + "key_file": "openrouter_key.txt", + "model": "meta-llama/llama-3-70b-instruct", }, }, userOptions.sidebar.ai.extraGptModels)