Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion hindsight_server/config.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import os
import platform
import json
from pathlib import Path

BASE_DIR = Path(os.path.dirname(os.path.abspath(__file__)))

HOME = Path.home()

HINDSIGHT_SERVER_DIR = HOME / ".hindsight_server"

DATA_DIR = HINDSIGHT_SERVER_DIR / "data"
USER_SETTINGS_FILE = HINDSIGHT_SERVER_DIR / "user_settings.json"
API_KEY_FILE = HINDSIGHT_SERVER_DIR / "secret_api_key.txt"

SCREENSHOTS_TMP_DIR = DATA_DIR / "raw_screenshots_tmp"
RAW_SCREENSHOTS_DIR = DATA_DIR / "raw_screenshots"
SERVER_LOG_FILE = DATA_DIR / "hindsight_server.log"
ANDROID_IDENTIFIERS_ALIAS_FILE = DATA_DIR / "android_identifiers.json"

API_KEY_FILE = HINDSIGHT_SERVER_DIR / "secret_api_key.txt"
if os.path.exists(API_KEY_FILE):
with open(API_KEY_FILE, 'r') as infile:
SECRET_API_KEY = infile.read().strip()
Expand All @@ -32,3 +36,11 @@
https://github.com/taylorai/mlx_embedding_models/blob/main/src/mlx_embedding_models/registry.py
"""
MLX_EMBDEDDING_MODEL = "bge-large"

if os.path.isfile(USER_SETTINGS_FILE):
with open(USER_SETTINGS_FILE) as user_file:
user_settings = json.load(user_file)
print('Applying user settings to configuration:', user_settings)
LLM_MODEL_NAME = user_settings['LLM_MODEL_NAME']
else:
print('Using default configuration')