mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-04-27 12:18:14 +00:00
* fix: make SSE buffer size configurable to prevent overflow during multi-round searches (Issue #664) - Add NEXT_PUBLIC_MAX_STREAM_BUFFER_SIZE environment variable for frontend SSE stream buffer - Default to 1MB for backward compatibility, users can increase to 5-10MB for large searches - Enhance error message with actual buffer sizes and guidance on configuration - Add validation schema in env.js with positive integer requirement - Document configuration in .env.example with clear examples and use cases * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
53 lines
1.9 KiB
JavaScript
53 lines
1.9 KiB
JavaScript
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import { createEnv } from "@t3-oss/env-nextjs";
|
|
import { z } from "zod";
|
|
|
|
export const env = createEnv({
|
|
/**
|
|
* Specify your server-side environment variables schema here. This way you can ensure the app
|
|
* isn't built with invalid env vars.
|
|
*/
|
|
server: {
|
|
NODE_ENV: z.enum(["development", "test", "production"]),
|
|
AMPLITUDE_API_KEY: z.string().optional(),
|
|
GITHUB_OAUTH_TOKEN: z.string().optional(),
|
|
},
|
|
|
|
/**
|
|
* Specify your client-side environment variables schema here. This way you can ensure the app
|
|
* isn't built with invalid env vars. To expose them to the client, prefix them with
|
|
* `NEXT_PUBLIC_`.
|
|
*/
|
|
client: {
|
|
NEXT_PUBLIC_API_URL: z.string().optional(),
|
|
NEXT_PUBLIC_STATIC_WEBSITE_ONLY: z.boolean().optional(),
|
|
NEXT_PUBLIC_MAX_STREAM_BUFFER_SIZE: z.coerce.number().int().positive().optional(),
|
|
},
|
|
|
|
/**
|
|
* You can't destruct `process.env` as a regular object in the Next.js edge runtimes (e.g.
|
|
* middlewares) or client-side so we need to destruct manually.
|
|
*/
|
|
runtimeEnv: {
|
|
NODE_ENV: process.env.NODE_ENV,
|
|
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
|
|
NEXT_PUBLIC_STATIC_WEBSITE_ONLY:
|
|
process.env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true",
|
|
NEXT_PUBLIC_MAX_STREAM_BUFFER_SIZE: process.env.NEXT_PUBLIC_MAX_STREAM_BUFFER_SIZE,
|
|
AMPLITUDE_API_KEY: process.env.AMPLITUDE_API_KEY,
|
|
GITHUB_OAUTH_TOKEN: process.env.GITHUB_OAUTH_TOKEN,
|
|
},
|
|
/**
|
|
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially
|
|
* useful for Docker builds.
|
|
*/
|
|
skipValidation: !!process.env.SKIP_ENV_VALIDATION,
|
|
/**
|
|
* Makes it so that empty strings are treated as undefined. `SOME_VAR: z.string()` and
|
|
* `SOME_VAR=''` will throw an error.
|
|
*/
|
|
emptyStringAsUndefined: true,
|
|
});
|