mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 12:22:09 +00:00
ai: store data in state dir instead of cache
This commit is contained in:
parent
97999cd4e4
commit
8d9d127731
2 changed files with 7 additions and 7 deletions
|
|
@ -6,7 +6,7 @@ import GLib from 'gi://GLib';
|
|||
import Soup from 'gi://Soup?version=3.0';
|
||||
import { fileExists } from '../modules/.miscutils/files.js';
|
||||
|
||||
const HISTORY_DIR = `${GLib.get_user_cache_dir()}/ags/user/ai/chats/`;
|
||||
const HISTORY_DIR = `${GLib.get_user_state_dir()}/ags/user/ai/chats/`;
|
||||
const HISTORY_FILENAME = `gemini.txt`;
|
||||
const HISTORY_PATH = HISTORY_DIR + HISTORY_FILENAME;
|
||||
const initMessages =
|
||||
|
|
@ -34,9 +34,9 @@ if (!fileExists(`${GLib.get_user_config_dir()}/gemini_history.json`)) {
|
|||
Utils.writeFile('[ ]', `${GLib.get_user_config_dir()}/gemini_history.json`).catch(print);
|
||||
}
|
||||
|
||||
Utils.exec(`mkdir -p ${GLib.get_user_cache_dir()}/ags/user/ai`);
|
||||
const KEY_FILE_LOCATION = `${GLib.get_user_cache_dir()}/ags/user/ai/google_key.txt`;
|
||||
const APIDOM_FILE_LOCATION = `${GLib.get_user_cache_dir()}/ags/user/ai/google_api_dom.txt`;
|
||||
Utils.exec(`mkdir -p ${GLib.get_user_state_dir()}/ags/user/ai`);
|
||||
const KEY_FILE_LOCATION = `${GLib.get_user_state_dir()}/ags/user/ai/google_key.txt`;
|
||||
const APIDOM_FILE_LOCATION = `${GLib.get_user_state_dir()}/ags/user/ai/google_api_dom.txt`;
|
||||
function replaceapidom(URL) {
|
||||
if (fileExists(APIDOM_FILE_LOCATION)) {
|
||||
var contents = Utils.readFile(APIDOM_FILE_LOCATION).trim();
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ const initMessages =
|
|||
{ role: "assistant", content: "## Skeuomorphism\n- A design philosophy- From early days of interface designing- Tries to imitate real-life objects- It's in fact still used by Apple in their icons until today.", },
|
||||
];
|
||||
|
||||
Utils.exec(`mkdir -p ${GLib.get_user_cache_dir()}/ags/user/ai`);
|
||||
Utils.exec(`mkdir -p ${GLib.get_user_state_dir()}/ags/user/ai`);
|
||||
|
||||
class GPTMessage extends Service {
|
||||
static {
|
||||
|
|
@ -139,13 +139,13 @@ class GPTService extends Service {
|
|||
_temperature = userOptions.ai.defaultTemperature;
|
||||
_messages = [];
|
||||
_key = '';
|
||||
_key_file_location = `${GLib.get_user_cache_dir()}/ags/user/ai/${PROVIDERS[this._currentProvider]['key_file']}`;
|
||||
_key_file_location = `${GLib.get_user_state_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() {
|
||||
this._key_file_location = `${GLib.get_user_cache_dir()}/ags/user/ai/${PROVIDERS[this._currentProvider]['key_file']}`;
|
||||
this._key_file_location = `${GLib.get_user_state_dir()}/ags/user/ai/${PROVIDERS[this._currentProvider]['key_file']}`;
|
||||
if (fileExists(this._key_file_location)) this._key = Utils.readFile(this._key_file_location).trim();
|
||||
else this.emit('hasKey', false);
|
||||
this._url = GLib.Uri.parse(PROVIDERS[this._currentProvider]['base_url'], GLib.UriFlags.NONE);
|
||||
|
|
|
|||
Loading…
Reference in a new issue