Closed FurryR closed 1 month ago
This bug is done by a mistake. Bro really needs an AI code approval ๐
window.ai.generateText works fine.
window.ai.generateText
window.ai.generateText fails when document.title contains any non ISO-8859-1 code point character.
document.title
https://github.com/alexanderatallah/window.ai/blob/fa05ec564d47a93c0ae46e9386368fd3ae76486c/apps/extension/src/core/llm/model.ts#L355 didn't use encodeURIComponent.
encodeURIComponent
Related: https://github.com/alexanderatallah/window.ai/blob/fa05ec564d47a93c0ae46e9386368fd3ae76486c/apps/extension/src/core/model-router.ts#L51
windowai.io
document.title = 'ไฝ ๅฅฝใใใซใกใฏ๐ฆ๐ฆ'
await window.ai.generateText( { messages: [{role: "user", content: "I guess you are dead arent you"}] } )
Before any request, set document.title to a ISO-8859-1 (aka Latin-1) only string.
Uncaught Unknown error: TypeError: Failed to construct 'Headers': String contains non ISO-8859-1 code point.
This bug is done by a mistake. Bro really needs an AI code approval ๐
Expected behavior
window.ai.generateText
works fine.Actual behavior
window.ai.generateText
fails whendocument.title
contains any non ISO-8859-1 code point character.Where?
https://github.com/alexanderatallah/window.ai/blob/fa05ec564d47a93c0ae46e9386368fd3ae76486c/apps/extension/src/core/llm/model.ts#L355 didn't use
encodeURIComponent
.Related: https://github.com/alexanderatallah/window.ai/blob/fa05ec564d47a93c0ae46e9386368fd3ae76486c/apps/extension/src/core/model-router.ts#L51
Step to produce
windowai.io
.Possible Workaround
Before any request, set
document.title
to a ISO-8859-1 (aka Latin-1) only string.Exception message