MCPcopy Create free account
hub / github.com/agent0ai/agent-zero / process

Method process

api/backup_create.py:15–58  ·  view source on GitHub ↗
(self, input: dict, request: Request)

Source from the content-addressed store, hash-verified

13 return False
14
15 async def process(self, input: dict, request: Request) -> dict | Response:
16 try:
17 # Get input parameters
18 include_patterns = input.get("include_patterns", [])
19 exclude_patterns = input.get("exclude_patterns", [])
20 include_hidden = input.get("include_hidden", True)
21 backup_name = input.get("backup_name", "agent-zero-backup")
22
23 # Support legacy string patterns format for backward compatibility
24 patterns_string = input.get("patterns", "")
25 if patterns_string and not include_patterns and not exclude_patterns:
26 # Parse legacy format
27 lines = [line.strip() for line in patterns_string.split('\n') if line.strip() and not line.strip().startswith('#')]
28 for line in lines:
29 if line.startswith('!'):
30 exclude_patterns.append(line[1:])
31 else:
32 include_patterns.append(line)
33
34 # Save all chats to the chats folder
35 save_tmp_chats()
36
37 # Create backup service and generate backup
38 backup_service = BackupService()
39 zip_path = await backup_service.create_backup(
40 include_patterns=include_patterns,
41 exclude_patterns=exclude_patterns,
42 include_hidden=include_hidden,
43 backup_name=backup_name
44 )
45
46 # Return file for download
47 return send_file(
48 zip_path,
49 as_attachment=True,
50 download_name=f"{backup_name}.zip",
51 mimetype='application/zip'
52 )
53
54 except Exception as e:
55 return {
56 "success": False,
57 "error": str(e)
58 }

Callers

nothing calls this directly

Calls 5

create_backupMethod · 0.95
save_tmp_chatsFunction · 0.90
BackupServiceClass · 0.90
send_fileFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected