MCPcopy Index your code
hub / github.com/algorithmicsuperintelligence/openevolve / api_task_answer

Function api_task_answer

scripts/manual.py:160–177  ·  view source on GitHub ↗
(task_id: str)

Source from the content-addressed store, hash-verified

158
159 @bp.post("/api/tasks/<task_id>/answer")
160 def api_task_answer(task_id: str):
161 run_root = _resolve_run_root(get_visualizer_path())
162 qdir = _queue_dir(run_root)
163
164 # Accept form POST (current UI), optionally JSON too.
165 answer = (request.form.get("answer") or "").strip()
166 if not answer and request.is_json:
167 body = request.get_json(silent=True) or {}
168 answer = str(body.get("answer") or "").strip()
169
170 if not answer:
171 return ("Answer must not be empty", 400)
172
173 if not (qdir / f"{task_id}.json").exists():
174 return ("Task not found", 404)
175
176 _write_answer(qdir, task_id, answer)
177 return jsonify({"ok": True})
178
179 return bp

Callers

nothing calls this directly

Calls 4

_resolve_run_rootFunction · 0.85
_queue_dirFunction · 0.85
_write_answerFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected