2023-11-03 18:02:39 -07:00
|
|
|
// Get Danswer Web Version
|
2023-11-03 18:37:01 -07:00
|
|
|
const { version: package_version } = require("./package.json"); // version from package.json
|
2023-11-03 18:02:39 -07:00
|
|
|
const env_version = process.env.DANSWER_VERSION; // version from env variable
|
|
|
|
// Use env version if set & valid, otherwise default to package version
|
2023-11-03 18:37:01 -07:00
|
|
|
const version = env_version || package_version;
|
2023-11-03 18:02:39 -07:00
|
|
|
|
2023-04-28 22:40:46 -07:00
|
|
|
/** @type {import('next').NextConfig} */
|
|
|
|
const nextConfig = {
|
2023-05-05 16:48:36 -07:00
|
|
|
output: "standalone",
|
2023-05-30 19:59:57 -07:00
|
|
|
rewrites: async () => {
|
|
|
|
// In production, something else (nginx in the one box setup) should take
|
|
|
|
// care of this rewrite. TODO (chris): better support setups where
|
|
|
|
// web_server and api_server are on different machines.
|
|
|
|
if (process.env.NODE_ENV === "production") return [];
|
|
|
|
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
source: "/api/:path*",
|
|
|
|
destination: "http://127.0.0.1:8080/:path*", // Proxy to Backend
|
|
|
|
},
|
|
|
|
];
|
|
|
|
},
|
2023-05-05 16:48:36 -07:00
|
|
|
redirects: async () => {
|
2023-05-17 15:48:46 -07:00
|
|
|
// In production, something else (nginx in the one box setup) should take
|
2023-05-22 19:49:49 -07:00
|
|
|
// care of this redirect. TODO (chris): better support setups where
|
2023-05-22 14:01:20 -07:00
|
|
|
// web_server and api_server are on different machines.
|
2023-12-05 18:17:53 -08:00
|
|
|
const defaultRedirects = [
|
|
|
|
{
|
|
|
|
source: "/",
|
|
|
|
destination: "/search",
|
|
|
|
permanent: true,
|
|
|
|
},
|
|
|
|
];
|
2023-05-22 14:01:20 -07:00
|
|
|
|
2023-12-05 18:17:53 -08:00
|
|
|
if (process.env.NODE_ENV === "production") return defaultRedirects;
|
|
|
|
|
|
|
|
return defaultRedirects.concat([
|
2023-05-17 15:48:46 -07:00
|
|
|
{
|
2023-12-05 18:17:53 -08:00
|
|
|
source: "/api/chat/send-message:params*",
|
|
|
|
destination: "http://127.0.0.1:8080/chat/send-message:params*", // Proxy to Backend
|
2023-05-17 15:48:46 -07:00
|
|
|
permanent: true,
|
|
|
|
},
|
2023-09-01 20:32:22 -07:00
|
|
|
{
|
2023-12-05 18:17:53 -08:00
|
|
|
source: "/api/query/stream-answer-with-quote:params*",
|
|
|
|
destination:
|
|
|
|
"http://127.0.0.1:8080/query/stream-answer-with-quote:params*", // Proxy to Backend
|
2023-09-01 20:32:22 -07:00
|
|
|
permanent: true,
|
|
|
|
},
|
2023-12-05 18:17:53 -08:00
|
|
|
{
|
|
|
|
source: "/api/query/stream-query-validation:params*",
|
|
|
|
destination:
|
|
|
|
"http://127.0.0.1:8080/query/stream-query-validation:params*", // Proxy to Backend
|
|
|
|
permanent: true,
|
|
|
|
},
|
|
|
|
]);
|
2023-05-05 16:48:36 -07:00
|
|
|
},
|
2023-11-03 18:02:39 -07:00
|
|
|
publicRuntimeConfig: {
|
|
|
|
version,
|
|
|
|
},
|
2023-04-28 22:40:46 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = nextConfig;
|