route.ts 625 B

1234567891011121314151617181920212223242526
  1. import { NextResponse } from "next/server";
  2. import { getServerSideConfig } from "../../config/server";
  3. const serverConfig = getServerSideConfig();
  4. // Danger! Don not write any secret value here!
  5. // 警告!不要在这里写入任何敏感信息!
  6. const DANGER_CONFIG = {
  7. needCode: serverConfig.needCode,
  8. hideUserApiKey: serverConfig.hideUserApiKey,
  9. enableGPT4: serverConfig.enableGPT4,
  10. };
  11. declare global {
  12. type DangerConfig = typeof DANGER_CONFIG;
  13. }
  14. async function handle() {
  15. return NextResponse.json(DANGER_CONFIG);
  16. }
  17. export const GET = handle;
  18. export const POST = handle;
  19. export const runtime = "edge";