Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ customizations.
Vimini manages global settings and model provider backends in `~/.var/vimini/config.json`. If this file does not exist, Vimini automatically generates a default configuration on startup:
```json
{
"active_backend": "Gemini",
"default_backend": "Gemini",
"backends": {
"Gemini": {
"api": "genai",
Expand Down Expand Up @@ -193,7 +193,7 @@ Opens an interactive configuration editor in a new split window to configure glo

**How to use the global configuration manager:**
* Move the cursor to any configuration option or backend line.
* **`<Enter>` or `e`**: Edits the selected value. On `active_backend`, enter one of the configured backend names. On a backend header, rename the backend. Under `UI PREFERENCES`, customize colors (e.g. `thinking_color`, `prompt_color`, `waiting_color`, `service_color`, `error_color`, `prompt_hint_color`).
* **`<Enter>` or `e`**: Edits the selected value. On `default_backend`, enter one of the configured backend names. On a backend header, rename the backend. Under `UI PREFERENCES`, customize colors (e.g. `thinking_color`, `prompt_color`, `waiting_color`, `service_color`, `error_color`, `prompt_hint_color`).
* **`a`**: Adds a new backend and prompts for API type, default model, API key file, and base URL for OpenAI-compatible or Anthropic backends.
* **`d`**: Clears the selected backend field, deletes a backend after confirmation, or resets a UI preference back to default. The last backend cannot be deleted.
* **`r`**: Resets all global configuration options to their last saved state.
Expand Down
7 changes: 7 additions & 0 deletions python3/vimini/agent/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import signal
import atexit
from vimini.common.backends import get_client
from vimini.common.config import load_global_config

MAX_RECEIVE_BUFFER_SIZE = 1024 * 1024
AGENT_CONFIG = {}
Expand Down Expand Up @@ -60,6 +61,7 @@ def execute_function(req_id, method, params, result_queue, conn):
logger.info(f"Executing method: {method} (id: {req_id})")
try:
if method == "setup":
load_global_config()
if isinstance(params, dict):
safe_params = dict(params)
safe_params.pop("api_key_file", None)
Expand Down Expand Up @@ -198,6 +200,11 @@ def cleanup(self):

def start(self):
logger.info(f"Starting AgentServer on socket: {self.socket_path}")
try:
load_global_config()
except Exception as e:
logger.error(f"Failed to load global config on agent startup: {e}")

if os.path.exists(self.socket_path):
try:
os.unlink(self.socket_path)
Expand Down
16 changes: 9 additions & 7 deletions python3/vimini/common/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
convert_tools_to_anthropic,
)
from vimini.common.config import (
get_global_config,
load_global_config,
get_active_backend,
get_default_backend,
load_backend_api_key,
validate_global_config,
backend_requires_api_key,
Expand All @@ -41,22 +42,23 @@ def get_backend(
api_key_file: Optional[str] = None,
) -> BaseClient:
"""
Factory function returning a BaseClient instance for the requested or active backend.
Factory function returning a BaseClient instance for the requested or default backend.
Confines all backend selection logic within generic backend methods.
"""
if isinstance(config, dict) and "backends" in config:
validate_global_config(config)
global_cfg = config
if backend_name is None:
backend_name = (
config.get("active_backend") or config.get("backend") or "Gemini"
)
backend_name = config.get("backend") or get_default_backend(global_cfg)
else:
global_cfg = load_global_config(config_path=config_path)
if config_path is not None:
global_cfg = load_global_config(config_path=config_path)
else:
global_cfg = get_global_config()
if backend_name is None and isinstance(config, dict):
backend_name = config.get("backend")
if backend_name is None:
backend_name = get_active_backend(global_cfg)
backend_name = get_default_backend(global_cfg)

backends = global_cfg.get("backends", {})
if backend_name not in backends:
Expand Down
Loading
Loading