thebird 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +22 -17
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -42,24 +42,28 @@ Some providers need field adjustments:
|
|
|
42
42
|
|
|
43
43
|
Applied automatically during request building.
|
|
44
44
|
|
|
45
|
-
## gembird — Image Generation via
|
|
45
|
+
## gembird — Image Generation via Hybrid Approach
|
|
46
46
|
|
|
47
|
-
**gembird** generates 4-view product images (front, back, left-side, right-side) using Gemini's web UI.
|
|
47
|
+
**gembird** generates 4-view product images (front, back, left-side, right-side) using Gemini's web UI + HTTP API hybrid approach.
|
|
48
48
|
|
|
49
|
-
###
|
|
49
|
+
### Workflow
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
1. **Auth via Browser**: Playwright CDP connects to Chrome on `localhost:9222` and navigates to gemini.google.com. User is already logged in.
|
|
52
|
+
2. **Session Capture**: Intercept network requests to extract session: `{ cookies, xsrf, fsid, template }`. One-time capture, cached in `.gemini-session.json`.
|
|
53
|
+
3. **HTTP Generation**: For each view, POST prompt to Cloud Code Assist API with captured session. Stream response.
|
|
54
|
+
4. **Parse Response**: Extract image URLs from streaming response via regex.
|
|
55
|
+
5. **Download**: Download PNG from `lh3.googleusercontent.com` with cookies. Save to disk.
|
|
52
56
|
|
|
53
|
-
###
|
|
57
|
+
### Why Hybrid?
|
|
58
|
+
|
|
59
|
+
Gemini API free tier has 0 quota for image generation. Browser provides free auth. HTTP API (Cloud Code Assist) provides faster generation than DOM polling + canvas extraction. Hybrid = free auth + fast generation + no quota limits.
|
|
60
|
+
|
|
61
|
+
### Performance
|
|
54
62
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
- Poll for new `<img alt="AI generated">` (120s timeout)
|
|
60
|
-
- Extract via canvas: `canvas.drawImage(img) → canvas.toDataURL('image/png')`
|
|
61
|
-
- POST base64 to local HTTP save server
|
|
62
|
-
4. Save 4 PNGs to output dir
|
|
63
|
+
- Browser connection: one-time, 30s
|
|
64
|
+
- HTTP generation per image: ~30-60s (Gemini's generation time, not polling overhead)
|
|
65
|
+
- Download per image: ~5s
|
|
66
|
+
- Total: ~4 images in 2-3 minutes (vs ~8 minutes with browser polling + canvas extraction)
|
|
63
67
|
|
|
64
68
|
### CLI
|
|
65
69
|
|
|
@@ -69,13 +73,14 @@ node index.js --image ref.png "prompt"
|
|
|
69
73
|
node index.js --output ./dir "prompt"
|
|
70
74
|
```
|
|
71
75
|
|
|
72
|
-
Arguments parsed in index.js lines
|
|
76
|
+
Arguments parsed in index.js lines 88-115.
|
|
73
77
|
|
|
74
78
|
### Observability
|
|
75
79
|
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
80
|
+
- Session cached in `.gemini-session.json` (expires after 1 hour)
|
|
81
|
+
- HTTP response streamed and parsed for image URLs
|
|
82
|
+
- Download errors logged with context
|
|
83
|
+
- Progress logged per view: `[1/4] front view...`
|
|
79
84
|
|
|
80
85
|
## Development Constraints
|
|
81
86
|
|
package/package.json
CHANGED