Download patch_api_docs.py from Leon4gr45/automaker: direct link, hf CLI and curl.
- Browser
- Download file 614 Bytes
-
https://huggingface.co/spaces/Leon4gr45/automaker/resolve/main/patch_api_docs.py
- Command line
-
hf download hf://spaces/Leon4gr45/automaker/patch_api_docs.py
-
curl -L -o patch_api_docs.py https://huggingface.co/spaces/Leon4gr45/automaker/resolve/main/patch_api_docs.py
614 Bytes
| import re | |
| with open('apps/server/src/api-docs.ts', 'r') as f: | |
| content = f.read() | |
| new_endpoint = """ | |
| { | |
| method: 'POST', | |
| path: '/api/agent/chat', | |
| purpose: 'Send a message to the AI agent', | |
| request: { message: 'Hello agent', projectPath: '/app/data/projects/my-project' }, | |
| response: { sessionId: 'session-123', status: 'started' }, | |
| },""" | |
| # Insert before /api/projects | |
| content = re.sub( | |
| r"(\s*\{\s*method: 'GET',\s*path: '/api/projects',)", | |
| new_endpoint + r"\1", | |
| content | |
| ) | |
| with open('apps/server/src/api-docs.ts', 'w') as f: | |
| f.write(content) | |