@spacex110/core 0.1.11 → 0.1.12
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/dist/index.js +51 -46
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/strategies.ts +3 -1
package/package.json
CHANGED
package/src/strategies.ts
CHANGED
|
@@ -123,7 +123,9 @@ const openaiStrategy: ProviderStrategy = {
|
|
|
123
123
|
// OpenRouter compatibility & Best Practices
|
|
124
124
|
if (typeof window !== 'undefined' && window.location) {
|
|
125
125
|
headers['HTTP-Referer'] = window.location.origin;
|
|
126
|
-
|
|
126
|
+
// document.title 可能含中文等非 ASCII 字符,HTTP header 只允许 ISO-8859-1
|
|
127
|
+
const safeTitle = document.title ? document.title.replace(/[^\x20-\x7E]/g, '').slice(0, 80) : 'AI Selector';
|
|
128
|
+
headers['X-Title'] = safeTitle || 'AI Selector';
|
|
127
129
|
}
|
|
128
130
|
return headers;
|
|
129
131
|
},
|