File size: 2,100 Bytes
97a1afe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Agent Deployment Information

This file informs further agents about deployment best practices and tricks for the UserSyncFrontend on Hugging Face Spaces.

## 1. Deployment Configuration

### Target Space
- **Profile:** Leon4gr45
- **Space:** UserSyncFrontend
- **Full Identifier:** Leon4gr45/UserSyncFrontend
- **Frontend Port:** 7860

### Deployment Method
- **Docker SDK**

### Mandatory Endpoints
- `/health`: Returns HTTP 200 when the app is ready.
- `/api-docs`: Documents all available API endpoints. Reachable at `https://leon4gr45-usersyncfrontend.hf.space/api-docs`.

## 2. API Endpoints

### /api/craft
- **Method:** POST
- **Purpose:** Run model inference via Blablador API to craft content.
- **Request:** `{"content": "string", "variation": "string"}`
- **Response:** `{"result": "string"}`

### /api/config
- **Method:** GET
- **Purpose:** Retrieve OAuth configuration.

### /login
- **Method:** GET
- **Purpose:** Initiate Hugging Face OAuth login flow.

### /oauth/callback
- **Method:** GET
- **Purpose:** OAuth callback handler.

### /api/user
- **Method:** GET
- **Purpose:** Get authenticated user information.

### /api/logout
- **Method:** GET
- **Purpose:** Logout user and clear session.

### /api/save-data
- **Method:** POST
- **Purpose:** Save simulation data.
- **Request:** `{"type": "string", "data": "any", "user": "string"}`

### /api/list-data
- **Method:** GET
- **Purpose:** List saved simulation data.

### /health
- **Method:** GET
- **Purpose:** Health check endpoint.

## 3. Deployment Workflow

### Clean Remote Space
```bash
hf repos ls --repo-type space Leon4gr45/UserSyncFrontend
hf repos delete-files Leon4gr45/UserSyncFrontend <file> --repo-type space
```

### Standard Deployment Command
```bash
hf upload Leon4gr45/UserSyncFrontend --repo-type=space
```

### Monitoring Logs
```bash
# Build logs
curl -N -H "Authorization: Bearer <HF_TOKEN>" "https://huggingface.co/api/spaces/Leon4gr45/UserSyncFrontend/logs/build"

# Run logs
curl -N -H "Authorization: Bearer <HF_TOKEN>" "https://huggingface.co/api/spaces/Leon4gr45/UserSyncFrontend/logs/run"
```