File tree Expand file tree Collapse file tree
server/api/views/assistant Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
2021from 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. "../../../").
2330sys .path .insert (0 , os .path .abspath (os .path .join (os .path .dirname (__file__ ), "../../../../" )))
2431os .environ .setdefault ("DJANGO_SETTINGS_MODULE" , "balancer_backend.settings" )
2532
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments