@worktango/ai-assistant 0.0.40 → 0.0.42
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 +4 -1
- package/express.d.ts +8 -0
- package/package.json +1 -1
package/dist/express.js
CHANGED
|
@@ -11190,7 +11190,7 @@ function setupAiAssistantRoutes(args) {
|
|
|
11190
11190
|
const logger = coalesce(args.logger, console);
|
|
11191
11191
|
const routePath = args.route ?? "/ai-assistant";
|
|
11192
11192
|
const port = args.targetPort ?? 80;
|
|
11193
|
-
const protocol = "http";
|
|
11193
|
+
const protocol = args.targetProtocol ?? "http";
|
|
11194
11194
|
args.app.use(routePath, (req, res, next) => {
|
|
11195
11195
|
args.getBearerToken(req.headers).then((bearerToken) => {
|
|
11196
11196
|
req.headers.Authorization = `Bearer ${bearerToken}`;
|
|
@@ -11203,6 +11203,8 @@ function setupAiAssistantRoutes(args) {
|
|
|
11203
11203
|
const proxyOptions = {
|
|
11204
11204
|
target: `${protocol}://${args.targetHost}:${port}`,
|
|
11205
11205
|
changeOrigin: true,
|
|
11206
|
+
followRedirects: args.followRedirects ?? true,
|
|
11207
|
+
secure: protocol === "https",
|
|
11206
11208
|
pathRewrite: (path, req) => {
|
|
11207
11209
|
const expressRequest = req;
|
|
11208
11210
|
return args.getTargetPath(expressRequest.originalUrl || path);
|
|
@@ -11228,6 +11230,7 @@ function setupAiAssistantRoutes(args) {
|
|
|
11228
11230
|
}
|
|
11229
11231
|
}
|
|
11230
11232
|
};
|
|
11233
|
+
logger.debug("Setting up AI Assistant proxy", proxyOptions);
|
|
11231
11234
|
const proxy = (0, import_http_proxy_middleware.createProxyMiddleware)(proxyOptions);
|
|
11232
11235
|
args.app.use(routePath, ...coalesce(args.preflightMiddlewares, []), proxy);
|
|
11233
11236
|
}
|
package/express.d.ts
CHANGED
|
@@ -18,6 +18,14 @@ export function setupAiAssistantRoutes(args: {
|
|
|
18
18
|
* The port of the application to proxy requests to. Defaults to 80.
|
|
19
19
|
*/
|
|
20
20
|
targetPort?: number;
|
|
21
|
+
/**
|
|
22
|
+
* The protocol of the application to proxy requests to. Defaults to "http".
|
|
23
|
+
*/
|
|
24
|
+
targetProtocol?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to follow redirects. Defaults to true.
|
|
27
|
+
*/
|
|
28
|
+
followRedirects?: boolean;
|
|
21
29
|
/**
|
|
22
30
|
* The route path to the local service's AI assistant. Defaults to
|
|
23
31
|
* "/ai-assistant".
|