Spaces:
Runtime error
Runtime error
refactor: remove deprecated EXPOSE_API environment variable
Browse files- .env +0 -1
- chart/env/prod.yaml +0 -1
- src/hooks.server.ts +6 -4
.env
CHANGED
|
@@ -133,7 +133,6 @@ ENABLE_ASSISTANTS=false #set to true to enable assistants feature
|
|
| 133 |
ENABLE_ASSISTANTS_RAG=false # /!\ This will let users specify arbitrary URLs that the server will then request. Make sure you have the proper firewall rules in place.
|
| 134 |
REQUIRE_FEATURED_ASSISTANTS=false # require featured assistants to show in the list
|
| 135 |
COMMUNITY_TOOLS=false # set to true to enable community tools
|
| 136 |
-
EXPOSE_API=true # make the /api routes available
|
| 137 |
ALLOW_IFRAME=true # Allow the app to be embedded in an iframe
|
| 138 |
|
| 139 |
|
|
|
|
| 133 |
ENABLE_ASSISTANTS_RAG=false # /!\ This will let users specify arbitrary URLs that the server will then request. Make sure you have the proper firewall rules in place.
|
| 134 |
REQUIRE_FEATURED_ASSISTANTS=false # require featured assistants to show in the list
|
| 135 |
COMMUNITY_TOOLS=false # set to true to enable community tools
|
|
|
|
| 136 |
ALLOW_IFRAME=true # Allow the app to be embedded in an iframe
|
| 137 |
|
| 138 |
|
chart/env/prod.yaml
CHANGED
|
@@ -38,7 +38,6 @@ envVars:
|
|
| 38 |
COOKIE_SECURE: "true"
|
| 39 |
ENABLE_ASSISTANTS: "true"
|
| 40 |
ENABLE_ASSISTANTS_RAG: "true"
|
| 41 |
-
EXPOSE_API: "true"
|
| 42 |
METRICS_PORT: 5565
|
| 43 |
LOG_LEVEL: "debug"
|
| 44 |
METRICS_ENABLED: "true"
|
|
|
|
| 38 |
COOKIE_SECURE: "true"
|
| 39 |
ENABLE_ASSISTANTS: "true"
|
| 40 |
ENABLE_ASSISTANTS_RAG: "true"
|
|
|
|
| 41 |
METRICS_PORT: 5565
|
| 42 |
LOG_LEVEL: "debug"
|
| 43 |
METRICS_ENABLED: "true"
|
src/hooks.server.ts
CHANGED
|
@@ -36,6 +36,12 @@ if (!building) {
|
|
| 36 |
|
| 37 |
// Init AbortedGenerations refresh process
|
| 38 |
AbortedGenerations.getInstance();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
export const handleError: HandleServerError = async ({ error, event, status, message }) => {
|
|
@@ -79,10 +85,6 @@ export const handle: Handle = async ({ event, resolve }) => {
|
|
| 79 |
request: event.request,
|
| 80 |
});
|
| 81 |
|
| 82 |
-
if (event.url.pathname.startsWith(`${base}/api/`) && env.EXPOSE_API !== "true") {
|
| 83 |
-
return new Response("API is disabled", { status: 403 });
|
| 84 |
-
}
|
| 85 |
-
|
| 86 |
function errorResponse(status: number, message: string) {
|
| 87 |
const sendJson =
|
| 88 |
event.request.headers.get("accept")?.includes("application/json") ||
|
|
|
|
| 36 |
|
| 37 |
// Init AbortedGenerations refresh process
|
| 38 |
AbortedGenerations.getInstance();
|
| 39 |
+
|
| 40 |
+
if (env.EXPOSE_API) {
|
| 41 |
+
logger.warn(
|
| 42 |
+
"The EXPOSE_API flag has been deprecated. The API is now required for chat-ui to work."
|
| 43 |
+
);
|
| 44 |
+
}
|
| 45 |
}
|
| 46 |
|
| 47 |
export const handleError: HandleServerError = async ({ error, event, status, message }) => {
|
|
|
|
| 85 |
request: event.request,
|
| 86 |
});
|
| 87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
function errorResponse(status: number, message: string) {
|
| 89 |
const sendJson =
|
| 90 |
event.request.headers.get("accept")?.includes("application/json") ||
|