Initial TrueGrowth source import

This commit is contained in:
2026-07-07 09:36:36 +08:00
commit 3b6781d695
2283 changed files with 691996 additions and 0 deletions

33
tools/whistle/README.md Normal file
View File

@@ -0,0 +1,33 @@
# Whistle Base64 Image Mock
This folder contains a Whistle ruleset for reproducing image-model responses
that return raw base64 image payloads instead of normal remote URLs.
## Files
- `mock-image-base64.rules`: paste this into Whistle Rules.
## Supported scenarios
- `__mock_b64_single__`: returns one image in `data[0].b64_json`
- `__mock_b64_duplicate__`: returns two identical images in `data[].b64_json`
- `__mock_b64_url_field__`: returns one image whose raw base64 is placed in `data[0].url`
## How to use
1. Open Whistle and paste the contents of `mock-image-base64.rules` into the
Rules editor.
2. Make sure HTTPS capture is enabled for `api.tu-zi.com`.
3. In AITU, keep the image Base URL pointed at `https://api.tu-zi.com/v1`
unless you intentionally use another domain.
4. Add one of the marker strings above to the prompt text and submit an image
generation request.
## Notes
- The rules match both `/v1/images/generations` and `/images/generations`.
- If you use a non-default API host, replace `api.tu-zi.com` in the rules.
- If you want to stress-test large payload handling, replace the embedded
base64 string with the real raw payload from your captured response text.
- The duplicate scenario is useful for verifying that identical base64 payloads
are deduplicated into the same local cache file.

View File

@@ -0,0 +1,67 @@
# Mock AITU image-generation responses so we can reproduce models returning raw
# base64 image payloads instead of normal remote URLs.
#
# Recommended usage:
# 1. Paste this file into Whistle's Rules editor.
# 2. Keep only the scenario(s) you want enabled.
# 3. Add the corresponding marker token to the prompt text.
#
# Markers:
# - __mock_b64_single__ => one image, raw base64 in data[0].b64_json
# - __mock_b64_duplicate__ => two identical images in data[].b64_json
# - __mock_b64_url_field__ => one image, raw base64 in data[0].url
#
# Note:
# - The app usually posts to /v1/images/generations when Base URL is
# https://api.tu-zi.com/v1, but we keep both path variants here.
# - If you use a different API domain, replace api.tu-zi.com below.
api.tu-zi.com/v1/images/generations file://{mock-image-b64-single.json} lineProps://important includeFilter://b:/__mock_b64_single__/
api.tu-zi.com/images/generations file://{mock-image-b64-single.json} lineProps://important includeFilter://b:/__mock_b64_single__/
api.tu-zi.com/v1/images/generations file://{mock-image-b64-duplicate.json} lineProps://important includeFilter://b:/__mock_b64_duplicate__/
api.tu-zi.com/images/generations file://{mock-image-b64-duplicate.json} lineProps://important includeFilter://b:/__mock_b64_duplicate__/
api.tu-zi.com/v1/images/generations file://{mock-image-b64-url-field.json} lineProps://important includeFilter://b:/__mock_b64_url_field__/
api.tu-zi.com/images/generations file://{mock-image-b64-url-field.json} lineProps://important includeFilter://b:/__mock_b64_url_field__/
# Uncomment these two lines if you want to mock every image request without
# adding a prompt marker. Leave only one scenario enabled at a time.
# api.tu-zi.com/v1/images/generations file://{mock-image-b64-single.json} lineProps://important
# api.tu-zi.com/images/generations file://{mock-image-b64-single.json} lineProps://important
``` mock-image-b64-single.json
{
"created": 1773799200,
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
}
]
}
```
``` mock-image-b64-duplicate.json
{
"created": 1773799201,
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
},
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
}
]
}
```
``` mock-image-b64-url-field.json
{
"created": 1773799202,
"data": [
{
"url": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
}
]
}
```