MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / _update_workflow_id

Function _update_workflow_id

server/services/workflow_storage.py:20–34  ·  view source on GitHub ↗
(content: str, workflow_id: str)

Source from the content-addressed store, hash-verified

18
19
20def _update_workflow_id(content: str, workflow_id: str) -> str:
21 pattern = re.compile(r"^(id:\\s*).*$", re.MULTILINE)
22 match = pattern.search(content)
23 if match:
24 return pattern.sub(rf"\\1{workflow_id}", content, count=1)
25
26 lines = content.splitlines()
27 insert_index = 0
28 if lines and lines[0].strip() == "---":
29 insert_index = 1
30 lines.insert(insert_index, f"id: {workflow_id}")
31 updated = "\n".join(lines)
32 if content.endswith("\n"):
33 updated += "\n"
34 return updated
35
36
37def validate_workflow_filename(filename: str, *, require_yaml_extension: bool = True) -> str:

Callers 1

rename_workflowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected