claude-simple 0.2.3 → 0.2.4
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/client.js +7 -1
- package/dist/{app.0.2.3.min.js → app.0.2.4.min.js} +165 -152
- package/dist/index.html +2 -2
- package/dist/{style.0.2.3.min.css → style.0.2.4.min.css} +61 -0
- package/package.json +1 -1
- package/public/chat.js +201 -50
- package/public/shell/templates.js +7 -4
- package/public/style.css +61 -0
- package/public/sw.js +1 -1
package/client.js
CHANGED
|
@@ -93,10 +93,16 @@ function connect() {
|
|
|
93
93
|
delete reqHeaders['Accept-Encoding'];
|
|
94
94
|
reqHeaders['Accept-Encoding'] = 'identity';
|
|
95
95
|
|
|
96
|
+
// Hub may send binary request bodies as base64 (image/file uploads).
|
|
97
|
+
// Without decoding, Node fetch would write the base64 text to disk.
|
|
98
|
+
let reqBody = msg.body || undefined;
|
|
99
|
+
if (reqBody != null && reqBody !== '' && String(msg.encoding || '').toLowerCase() === 'base64') {
|
|
100
|
+
reqBody = Buffer.from(reqBody, 'base64');
|
|
101
|
+
}
|
|
96
102
|
const res = await fetch(url, {
|
|
97
103
|
method: msg.method,
|
|
98
104
|
headers: reqHeaders,
|
|
99
|
-
body:
|
|
105
|
+
body: reqBody,
|
|
100
106
|
});
|
|
101
107
|
const headers = sanitizeProxyHeaders(Object.fromEntries(res.headers.entries()));
|
|
102
108
|
const contentType = res.headers.get('content-type') || '';
|