mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-10-27 05:30:39 +00:00
* feat(scheduler): create conversation schedules and support agent self-stop * fix(scheduler): validate goals and trial requests before dispatch --------- Co-authored-by: Totoro-qaq <279883115+Totoro-qaq@users.noreply.github.com>
14 lines
539 B
Python
14 lines
539 B
Python
"""Dependency-free goal objective validation shared by admission and execution."""
|
|
|
|
MAX_GOAL_OBJECTIVE_CHARS = 4000
|
|
|
|
|
|
def normalize_goal_objective(objective: str) -> str:
|
|
"""Normalize and validate user-provided goal text."""
|
|
normalized = " ".join(objective.strip().split())
|
|
if not normalized:
|
|
raise ValueError("Goal objective must not be empty.")
|
|
if len(normalized) > MAX_GOAL_OBJECTIVE_CHARS:
|
|
raise ValueError(f"Goal objective must be at most {MAX_GOAL_OBJECTIVE_CHARS} characters.")
|
|
return normalized
|