feat: add initial uipath explainator implementation

Scaffold project with pyproject.toml and environment configuration
Implement core modules including CLI, Gemini integration, and scanner
This commit is contained in:
2026-04-02 10:10:56 +08:00
parent aca26fceb5
commit 7003dfa0df
11 changed files with 792 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing import Self
from dotenv import load_dotenv
import os
@dataclass(slots=True)
class Settings:
api_key: str | None
base_url: str | None
model: str
@classmethod
def from_env(cls, env_file: Path | None = None, model_override: str | None = None) -> Self:
if env_file:
load_dotenv(env_file)
else:
load_dotenv()
return cls(
api_key=os.getenv("GEMINI_API_KEY") or os.getenv("GOOGLE_API_KEY"),
base_url=os.getenv("GEMINI_BASE_URL") or None,
model=model_override or os.getenv("GEMINI_MODEL") or "gemini-2.5-flash",
)
def require_api_key(self) -> None:
if not self.api_key:
raise ValueError("Missing GEMINI_API_KEY (or GOOGLE_API_KEY) in the environment.")