Fix avatar API to return all fields, add TMPDIR workaround to import script
- Use to_encoach_dict() for /api/exam/avatars so voiceId, voiceProvider, canvas are included in the response - Set TMPDIR=/tmp in import script for PyTorch compatibility in Docker Made-with: Cursor
This commit is contained in:
@@ -208,12 +208,7 @@ class ExamsController(EncoachMixin, http.Controller):
|
|||||||
return self._error_response('Unauthorized', 401)
|
return self._error_response('Unauthorized', 401)
|
||||||
|
|
||||||
avatars = request.env['encoach.elai.avatar'].sudo().search([])
|
avatars = request.env['encoach.elai.avatar'].sudo().search([])
|
||||||
data = [{
|
data = [a.to_encoach_dict() for a in avatars]
|
||||||
'name': a.name,
|
|
||||||
'avatar_code': a.avatar_code,
|
|
||||||
'avatar_url': a.avatar_url or '',
|
|
||||||
'gender': a.gender or '',
|
|
||||||
} for a in avatars]
|
|
||||||
return self._json_response(data)
|
return self._json_response(data)
|
||||||
except Exception:
|
except Exception:
|
||||||
_logger.exception("List avatars error")
|
_logger.exception("List avatars error")
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
"""Import training tips from pathways JSON into encoach.training.tip model.
|
"""Import training tips from pathways JSON into encoach.training.tip model.
|
||||||
|
|
||||||
Run inside the Odoo container via:
|
Run inside the Odoo container via:
|
||||||
odoo shell -d encoach < /mnt/custom/scripts/import_training_tips.py
|
odoo shell -d encoach --db_host=db --db_user=odoo --db_password=<pw> \
|
||||||
|
--no-http --addons-path=... < /mnt/custom/scripts/import_training_tips.py
|
||||||
|
|
||||||
This script:
|
This script:
|
||||||
1. Reads pathways_2_rw.json
|
1. Reads pathways_2_rw.json
|
||||||
@@ -13,6 +14,8 @@ import os
|
|||||||
import pickle
|
import pickle
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
os.environ.setdefault("TMPDIR", "/tmp")
|
||||||
|
|
||||||
JSON_PATH = os.environ.get(
|
JSON_PATH = os.environ.get(
|
||||||
"TIPS_JSON_PATH",
|
"TIPS_JSON_PATH",
|
||||||
"/mnt/custom/scripts/pathways_2_rw.json",
|
"/mnt/custom/scripts/pathways_2_rw.json",
|
||||||
|
|||||||
Reference in New Issue
Block a user