diff --git a/api/app/clients/tools/manifest.json b/api/app/clients/tools/manifest.json index 55c1b1c51..664434f21 100644 --- a/api/app/clients/tools/manifest.json +++ b/api/app/clients/tools/manifest.json @@ -49,7 +49,7 @@ "pluginKey": "image_gen_oai", "toolkit": true, "description": "Image Generation and Editing using OpenAI's latest state-of-the-art models", - "icon": "/assets/image_gen_oai.png", + "icon": "assets/image_gen_oai.png", "authConfig": [ { "authField": "IMAGE_GEN_OAI_API_KEY", @@ -75,7 +75,7 @@ "name": "Browser", "pluginKey": "web-browser", "description": "Scrape and summarize webpage data", - "icon": "/assets/web-browser.svg", + "icon": "assets/web-browser.svg", "authConfig": [ { "authField": "OPENAI_API_KEY", @@ -170,7 +170,7 @@ "name": "OpenWeather", "pluginKey": "open_weather", "description": "Get weather forecasts and historical data from the OpenWeather API", - "icon": "/assets/openweather.png", + "icon": "assets/openweather.png", "authConfig": [ { "authField": "OPENWEATHER_API_KEY", diff --git a/api/server/index.js b/api/server/index.js index c28418b86..76fa5b7ae 100644 --- a/api/server/index.js +++ b/api/server/index.js @@ -52,7 +52,20 @@ const startServer = async () => { const appConfig = await getAppConfig(); await updateInterfacePermissions(appConfig); const indexPath = path.join(appConfig.paths.dist, 'index.html'); - const indexHTML = fs.readFileSync(indexPath, 'utf8'); + let indexHTML = fs.readFileSync(indexPath, 'utf8'); + + // In order to provide support to serving the application in a sub-directory + // We need to update the base href if the DOMAIN_CLIENT is specified and not the root path + if (process.env.DOMAIN_CLIENT) { + const clientUrl = new URL(process.env.DOMAIN_CLIENT); + const baseHref = clientUrl.pathname.endsWith('/') + ? clientUrl.pathname + : `${clientUrl.pathname}/`; + if (baseHref !== '/') { + logger.info(`Setting base href to ${baseHref}`); + indexHTML = indexHTML.replace(/base href="\/"/, `base href="${baseHref}"`); + } + } app.get('/health', (_req, res) => res.status(200).send('OK')); @@ -135,7 +148,8 @@ const startServer = async () => { const lang = req.cookies.lang || req.headers['accept-language']?.split(',')[0] || 'en-US'; const saneLang = lang.replace(/"/g, '"'); - const updatedIndexHtml = indexHTML.replace(/lang="en-US"/g, `lang="${saneLang}"`); + let updatedIndexHtml = indexHTML.replace(/lang="en-US"/g, `lang="${saneLang}"`); + res.type('html'); res.send(updatedIndexHtml); }); diff --git a/client/index.html b/client/index.html index c05fbea5a..c94c3981b 100644 --- a/client/index.html +++ b/client/index.html @@ -2,15 +2,16 @@ + LibreChat - - - + + +