Skip to content

Commit ecd9a72

Browse files
committed
Documentation-only follow-ups from the branch review
1 parent 84f64c4 commit ecd9a72

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

server/api/views/assistant/eval_assistant.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
# ///
1010

1111
# uv script (or plain Python) to generate results to CSV, run from the terminal
12-
# Run from inside the container: docker compose exec backend python eval_assistant.py
12+
# Run from inside the container (working dir is /usr/src/server):
13+
# docker compose exec backend python api/views/assistant/eval_assistant.py
1314
#
1415

1516

@@ -20,6 +21,12 @@
2021
from concurrent.futures import ThreadPoolExecutor, as_completed
2122

2223
# Django setup must come before any imports that touch the ORM
24+
# NOTE: from api/views/assistant/, "../../../../" resolves four levels up to
25+
# /usr/src (not /usr/src/server, where balancer_backend lives). So this insert
26+
# alone does not put the settings package on sys.path — running the script
27+
# relies on the container already having /usr/src/server on PYTHONPATH. Sanity-
28+
# check this the first time the eval is run for real; the path depth may need
29+
# adjusting (e.g. "../../../").
2330
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../")))
2431
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "balancer_backend.settings")
2532

server/api/views/assistant/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ def post(self, request):
3737
try:
3838
user = request.user
3939

40+
# TODO: validate message and return a 400 when it is omitted or blank.
41+
# @extend_schema documents message as required, but that schema is not
42+
# enforced at runtime, so a missing/empty message reaches run_assistant
43+
# and becomes the literal string "None" (str(None)) in the model input —
44+
# producing confusing model behavior. Add a 400 to the responses schema
45+
# when implementing.
4046
message = request.data.get("message", None)
4147
previous_response_id = request.data.get("previous_response_id", None)
4248

0 commit comments

Comments
 (0)