fix: update README for deployment instructions and improve code formatting
This commit is contained in:
parent
1d49a39c6a
commit
eb8f283e44
3 changed files with 28 additions and 14 deletions
|
|
@ -37,7 +37,12 @@ betterbot-specific files are:
|
|||
| `compose/` | Docker compose for RackNerd with site-dir mounts |
|
||||
| `scripts/deploy-betterbot.sh` | Deploy script targeting RackNerd + Infisical |
|
||||
|
||||
To sync upstream changes, copy updated framework files from `code_anywhere/`.
|
||||
Deploys on RackNerd pull from the BetterBot Forgejo repo only. They do not
|
||||
pull directly from CodeAnywhere during deploy.
|
||||
|
||||
If CodeAnywhere framework files change, sync those changes into this repo
|
||||
first, commit them here, and then deploy BetterBot from its own `master`
|
||||
branch.
|
||||
|
||||
## Deployment
|
||||
|
||||
|
|
|
|||
27
main.py
27
main.py
|
|
@ -35,9 +35,12 @@ def _get_advisor_usage(thread_id: str | None) -> dict | None:
|
|||
return None
|
||||
try:
|
||||
from tools.advisor import get_advisor_usage
|
||||
|
||||
return get_advisor_usage(thread_id)
|
||||
except ImportError:
|
||||
return None
|
||||
|
||||
|
||||
from local_media_store import LocalMediaStore
|
||||
from model_selection import (
|
||||
ModelSelection,
|
||||
|
|
@ -912,7 +915,9 @@ async def send_thread_message(thread_id: str, request: Request):
|
|||
getattr(getattr(result, "data", None), "content", None) or getattr(result, "content", None) or ""
|
||||
)
|
||||
usage = extract_usage_and_cost(
|
||||
selection.model, selection.provider, result,
|
||||
selection.model,
|
||||
selection.provider,
|
||||
result,
|
||||
advisor_usage=_get_advisor_usage(thread_id),
|
||||
)
|
||||
web_store.add_usage(thread_id, usage)
|
||||
|
|
@ -1071,15 +1076,19 @@ async def stream_thread_message(thread_id: str, request: Request):
|
|||
# Emit advisor trace events if any
|
||||
try:
|
||||
from tools.advisor import get_advisor_traces
|
||||
|
||||
for trace in get_advisor_traces(thread_id):
|
||||
yield _sse_event("progress", {
|
||||
"kind": "advisor_trace",
|
||||
"question": trace.get("question", ""),
|
||||
"answer": trace.get("answer", ""),
|
||||
"stakes": trace.get("stakes", "medium"),
|
||||
"model": trace.get("model", ""),
|
||||
"duration_ms": trace.get("duration_ms", 0),
|
||||
})
|
||||
yield _sse_event(
|
||||
"progress",
|
||||
{
|
||||
"kind": "advisor_trace",
|
||||
"question": trace.get("question", ""),
|
||||
"answer": trace.get("answer", ""),
|
||||
"stakes": trace.get("stakes", "medium"),
|
||||
"model": trace.get("model", ""),
|
||||
"duration_ms": trace.get("duration_ms", 0),
|
||||
},
|
||||
)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@ logger = logging.getLogger(__name__)
|
|||
def _build_projects() -> dict[str, dict[str, Any]]:
|
||||
"""Build the project map from environment-configured directories."""
|
||||
site_dir = pathlib.Path(settings.SITE_DIR) if hasattr(settings, "SITE_DIR") else pathlib.Path("/site")
|
||||
memoraiz_dir = pathlib.Path(settings.MEMORAIZ_DIR) if hasattr(settings, "MEMORAIZ_DIR") else pathlib.Path("/memoraiz")
|
||||
memoraiz_dir = (
|
||||
pathlib.Path(settings.MEMORAIZ_DIR) if hasattr(settings, "MEMORAIZ_DIR") else pathlib.Path("/memoraiz")
|
||||
)
|
||||
|
||||
projects: dict[str, dict[str, Any]] = {}
|
||||
if site_dir.exists():
|
||||
|
|
@ -102,9 +104,7 @@ def handle_tool_call(name: str, args: dict) -> str:
|
|||
target = _resolve(base, subdir) if subdir else base
|
||||
files = []
|
||||
for p in sorted(target.rglob("*")):
|
||||
if p.is_file() and not any(
|
||||
part in (".git", "node_modules", "__pycache__") for part in p.parts
|
||||
):
|
||||
if p.is_file() and not any(part in (".git", "node_modules", "__pycache__") for part in p.parts):
|
||||
files.append(str(p.relative_to(base)))
|
||||
return "\n".join(files[:200]) if files else "(no files found)"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue