@worktango/ai-assistant 0.0.51-ryantest → 0.0.51
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/express.js +11 -7
- package/package.json +1 -1
- package/react.d.ts +0 -1
package/dist/express.js
CHANGED
|
@@ -11193,7 +11193,9 @@ function setupAiAssistantRoutes(args) {
|
|
|
11193
11193
|
const protocol = args.targetProtocol ?? "http";
|
|
11194
11194
|
const bearerTokenMiddleware = (req, res, next) => {
|
|
11195
11195
|
args.getBearerToken(req.headers).then((bearerToken) => {
|
|
11196
|
-
|
|
11196
|
+
getRequestWithNewAuthHeader(
|
|
11197
|
+
req
|
|
11198
|
+
).newAuthHeader = `Bearer ${bearerToken}`;
|
|
11197
11199
|
next();
|
|
11198
11200
|
}).catch((error) => {
|
|
11199
11201
|
logger.error("Error getting bearer token:", error);
|
|
@@ -11211,12 +11213,11 @@ function setupAiAssistantRoutes(args) {
|
|
|
11211
11213
|
},
|
|
11212
11214
|
on: {
|
|
11213
11215
|
proxyReq: (proxyReq, req) => {
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
}
|
|
11218
|
-
|
|
11219
|
-
});
|
|
11216
|
+
const newAuthHeader = getRequestWithNewAuthHeader(req).newAuthHeader;
|
|
11217
|
+
if (newAuthHeader) {
|
|
11218
|
+
proxyReq.setHeader("Authorization", newAuthHeader);
|
|
11219
|
+
}
|
|
11220
|
+
(0, import_http_proxy_middleware.fixRequestBody)(proxyReq, req);
|
|
11220
11221
|
},
|
|
11221
11222
|
proxyRes: (proxyRes, req, res) => {
|
|
11222
11223
|
if (req.headers.accept === "text/event-stream") {
|
|
@@ -11246,6 +11247,9 @@ function setupAiAssistantRoutes(args) {
|
|
|
11246
11247
|
proxy
|
|
11247
11248
|
);
|
|
11248
11249
|
}
|
|
11250
|
+
function getRequestWithNewAuthHeader(req) {
|
|
11251
|
+
return req;
|
|
11252
|
+
}
|
|
11249
11253
|
// Annotate the CommonJS export names for ESM import in node:
|
|
11250
11254
|
0 && (module.exports = {
|
|
11251
11255
|
setupAiAssistantRoutes
|
package/package.json
CHANGED