first commit
This commit is contained in:
45
bg_agent/config.py
Normal file
45
bg_agent/config.py
Normal file
@@ -0,0 +1,45 @@
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class Settings:
|
||||
# Hotkeys (Windows format for `keyboard` lib)
|
||||
shortcut_capture: str = "alt+shift+1"
|
||||
shortcut_send: str = "alt+shift+2"
|
||||
shortcut_action3: str = "alt+shift+3"
|
||||
shortcut_reset: str = "alt+shift+4"
|
||||
shortcut_quit: str = "alt+shift+5"
|
||||
shortcut_toggle_mode: str = "alt+shift+6"
|
||||
|
||||
# OpenAI
|
||||
model: str = "gpt-4o-mini"
|
||||
prompt: str = (
|
||||
"You are a helpful assistant. Analyze the images and answer clearly."
|
||||
)
|
||||
retries: int = 3
|
||||
request_timeout_s: int = 60
|
||||
|
||||
# Typing and clipboard behavior
|
||||
type_interval_s: float = 0.015
|
||||
|
||||
# Data storage
|
||||
app_dir: str = os.path.join(
|
||||
os.environ.get("LOCALAPPDATA", os.path.expanduser("~/.local/share")),
|
||||
"BgVisionAgent",
|
||||
)
|
||||
captures_dir_name: str = "captures"
|
||||
response_file_name: str = "response.txt"
|
||||
log_file_name: str = "agent.log"
|
||||
|
||||
|
||||
def ensure_dirs(cfg: Settings) -> None:
|
||||
os.makedirs(cfg.app_dir, exist_ok=True)
|
||||
os.makedirs(os.path.join(cfg.app_dir, cfg.captures_dir_name), exist_ok=True)
|
||||
|
||||
|
||||
def data_paths(cfg: Settings):
|
||||
captures_dir = os.path.join(cfg.app_dir, cfg.captures_dir_name)
|
||||
response_path = os.path.join(cfg.app_dir, cfg.response_file_name)
|
||||
log_path = os.path.join(cfg.app_dir, cfg.log_file_name)
|
||||
return captures_dir, response_path, log_path
|
||||
Reference in New Issue
Block a user