@nanogpt/private-mode 0.2.7 → 0.2.8
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/lib/server.js +2 -4
- package/package.json +1 -1
package/lib/server.js
CHANGED
|
@@ -183,9 +183,8 @@ async function runPreflight({ apiBase, apiKey, model, req, requestBodyBytes }) {
|
|
|
183
183
|
try {
|
|
184
184
|
const data = await response.json();
|
|
185
185
|
const cacheScope = typeof data?.cacheScope === 'string' ? data.cacheScope.trim() : '';
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return { ok: true, cacheScope, preflightTicket };
|
|
186
|
+
if (/^[a-f0-9]{64}$/i.test(cacheScope)) {
|
|
187
|
+
return { ok: true, cacheScope };
|
|
189
188
|
}
|
|
190
189
|
} catch {}
|
|
191
190
|
|
|
@@ -313,7 +312,6 @@ async function handleChatCompletion({ apiBase, apiKey, secureState, req, res, co
|
|
|
313
312
|
'x-nanogpt-private-model': model.id,
|
|
314
313
|
'x-nanogpt-private-stream': privateStreamRequested ? 'true' : 'false',
|
|
315
314
|
'x-nanogpt-private-cache-scope': buildPrivateModeCacheScopeProof(preflight.cacheScope),
|
|
316
|
-
'x-nanogpt-private-preflight-ticket': preflight.preflightTicket,
|
|
317
315
|
'x-query-source': 'api',
|
|
318
316
|
...copyLocalHeaders(req),
|
|
319
317
|
},
|