Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
79 lines
2.4 KiB
Python
79 lines
2.4 KiB
Python
"""Config loading for the Boardroom Map orchestrator.
|
|
|
|
Defaults mirror startos/file-models/config.ts. The StartOS actions only persist
|
|
the fields the user actually touched, and Python (unlike the zod schema) does not
|
|
auto-fill defaults — so we apply them here. Keep in sync with the zod schema.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
import spark_client as sc
|
|
|
|
DATA_DIR = os.environ.get("BM_DATA_DIR", "/data")
|
|
HF_TOKEN_PATH = os.path.join(DATA_DIR, "secrets", "hf_token")
|
|
|
|
DEFAULT_RUBRIC = (
|
|
"Review the attached document(s). Produce a structured report: a 3-5 sentence "
|
|
"summary, the key findings and insights, risks or red flags, open questions, "
|
|
"and concrete recommendations. Cite the document and section for each point. "
|
|
"Be honest about uncertainty; never invent facts not present in the documents."
|
|
)
|
|
|
|
CONFIG_DEFAULTS = {
|
|
# Spark connection
|
|
"primarySparkHost": "",
|
|
"primarySparkUser": "nvidia",
|
|
"sshPort": 22,
|
|
"secondarySparkHost": None,
|
|
"useBothSparks": False,
|
|
"headInternalHost": "127.0.0.1",
|
|
"remoteWorkDir": "/home/nvidia/boardroom-map",
|
|
# Images
|
|
"servingImage": "boardroom-vllm:latest",
|
|
"graderImage": "boardroom-grader:latest",
|
|
# Serving
|
|
"gpuMemoryUtilization": "0.85",
|
|
"maxModelLen": 32768,
|
|
"toolCallParser": "hermes",
|
|
"proxyPort": 4000,
|
|
"maxConcurrentModels": 1,
|
|
"models": [
|
|
{"alias": "reviewer-a", "hfModel": "Qwen/Qwen3-32B-FP8", "spark": "primary", "port": 8001},
|
|
],
|
|
# Review panel
|
|
"reviewers": [
|
|
{"name": "reviewer-1", "model": "reviewer-a", "persona": "", "temperature": None},
|
|
],
|
|
# Review job settings
|
|
"reviewInstructions": DEFAULT_RUBRIC,
|
|
"networkMode": "airgapped",
|
|
"searxngUrl": "",
|
|
"synthesisEnabled": True,
|
|
"synthesisModel": "",
|
|
"synthesisPersona": "",
|
|
"wipeRemoteDocs": True,
|
|
"autoRunOnDrop": False,
|
|
"networkName": "boardroom-net",
|
|
# Flags
|
|
"hfTokenSet": False,
|
|
}
|
|
|
|
|
|
def load() -> dict:
|
|
"""Return the merged config (defaults <- saved), or just defaults if unset."""
|
|
merged = dict(CONFIG_DEFAULTS)
|
|
try:
|
|
saved = sc.load_config()
|
|
except FileNotFoundError:
|
|
return merged
|
|
merged.update({k: v for k, v in saved.items() if v is not None})
|
|
return merged
|
|
|
|
|
|
def hf_token() -> str | None:
|
|
if os.path.exists(HF_TOKEN_PATH):
|
|
t = open(HF_TOKEN_PATH).read().strip()
|
|
return t or None
|
|
return None
|