@maintainer-pro/ai-server 0.1.10 → 0.1.11
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/package.json +1 -1
- package/src/server.mjs +14 -2
package/package.json
CHANGED
package/src/server.mjs
CHANGED
|
@@ -425,8 +425,8 @@ export async function startAiServer(options = {}) {
|
|
|
425
425
|
pickEnv(env, "NEXT_PUBLIC_MAINTAINER_PRO_CLIENT_API_KEY"),
|
|
426
426
|
versions,
|
|
427
427
|
};
|
|
428
|
-
logger.debug({ aiServerUrl }, "embed-config");
|
|
429
428
|
outHeaders["content-type"] = "text/javascript; charset=utf-8";
|
|
429
|
+
outHeaders["cache-control"] = "private, max-age=60";
|
|
430
430
|
return {
|
|
431
431
|
status: 200,
|
|
432
432
|
headers: outHeaders,
|
|
@@ -482,6 +482,10 @@ export async function startAiServer(options = {}) {
|
|
|
482
482
|
});
|
|
483
483
|
return { status: response.status, headers: outHeaders, body: buf };
|
|
484
484
|
}
|
|
485
|
+
if (pathname.endsWith(".map")) {
|
|
486
|
+
outHeaders["content-type"] = "text/plain; charset=utf-8";
|
|
487
|
+
return { status: 404, headers: outHeaders, body: Buffer.from("Not found") };
|
|
488
|
+
}
|
|
485
489
|
const file = resolveUiFile(uiDir, pathname);
|
|
486
490
|
if (!file) {
|
|
487
491
|
if (pathname === "/ai-ui.iife.js") {
|
|
@@ -493,7 +497,15 @@ export async function startAiServer(options = {}) {
|
|
|
493
497
|
return { status: 404, headers: outHeaders, body: Buffer.from("Not found") };
|
|
494
498
|
}
|
|
495
499
|
outHeaders["content-type"] = contentType(file);
|
|
496
|
-
|
|
500
|
+
let fileBody = fs.readFileSync(file);
|
|
501
|
+
if (pathname === "/ai-ui.iife.js") {
|
|
502
|
+
fileBody = Buffer.from(
|
|
503
|
+
fileBody
|
|
504
|
+
.toString("utf8")
|
|
505
|
+
.replace(/\r?\n\/\/[#@] sourceMappingURL=.*$/g, "")
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
return { status: 200, headers: outHeaders, body: fileBody };
|
|
497
509
|
}
|
|
498
510
|
|
|
499
511
|
async function historyForTurn(conversationId, userMessage, userMessageId) {
|