chat-nest-server 1.1.1 → 1.1.2
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/README.md +11 -2
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,12 +78,21 @@ The handler sends SSE-formatted events:
|
|
|
78
78
|
|
|
79
79
|
Profiles (`constrained`, `balanced`, `expanded`) control limits. HARD_CAPS clamp all profiles. Server enforces:
|
|
80
80
|
|
|
81
|
-
- Maximum tokens per request (profile
|
|
82
|
-
- Daily token limit (
|
|
81
|
+
- **Maximum tokens per request** – Profile-based; client can override via `maxTokensPerRequest` (server applies `min(profile limit, client value)`)
|
|
82
|
+
- **Daily token limit** – Profile-based; client can override via `dailyTokenLimit` (same `min` rule)
|
|
83
83
|
- Request rate limiting (profile)
|
|
84
84
|
- Prompt size trimming (profile)
|
|
85
85
|
- Retry classification
|
|
86
86
|
|
|
87
|
+
### Request body options
|
|
88
|
+
|
|
89
|
+
| Field | Type | Description |
|
|
90
|
+
| ------------------- | ------ | --------------------------------------------------------------------------- |
|
|
91
|
+
| `messages` | array | Chat messages (required) |
|
|
92
|
+
| `profile` / `aiUsageProfile` | string | Profile: `constrained`, `balanced`, `expanded` (legacy: `budget`, `moderate`, `free`) |
|
|
93
|
+
| `dailyTokenLimit` | number | Optional. Cap daily tokens; server uses `min(profile limit, this)` |
|
|
94
|
+
| `maxTokensPerRequest` | number | Optional. Cap tokens per request; server uses `min(profile limit, this)` |
|
|
95
|
+
|
|
87
96
|
This prevents accidental overspending and abuse.
|
|
88
97
|
|
|
89
98
|
## 🔄 Server-Side Events (SSE)
|
package/dist/index.js
CHANGED
|
@@ -57,7 +57,8 @@ var PROFILES = {
|
|
|
57
57
|
maxMessages: 12,
|
|
58
58
|
temperature: 0.8,
|
|
59
59
|
dailyTokenLimit: 2e5,
|
|
60
|
-
maxTokensPerRequest:
|
|
60
|
+
maxTokensPerRequest: 12e3,
|
|
61
|
+
// input (~9k) + output (3k) for 12 msgs
|
|
61
62
|
rateLimit: { windowMs: 6e4, maxRequests: 60 }
|
|
62
63
|
})
|
|
63
64
|
};
|
package/package.json
CHANGED