Files
deer-flow/web/src/app/layout.tsx
DanielWalnut 19fa1e97c3 feat: add deep think feature (#311)
* feat: implement backend logic

* feat: implement api/config endpoint

* rename the symbol

* feat: re-implement configuration at client-side

* feat: add client-side of deep thinking

* fix backend bug

* feat: add reasoning block

* docs: update readme

* fix: translate into English

* fix: change icon to lightbulb

* feat: ignore more bad cases

* feat: adjust thinking layout, and implement auto scrolling

* docs: add comments

---------

Co-authored-by: Henry Li <henry1943@163.com>
2025-06-14 13:12:43 +08:00

69 lines
2.5 KiB
TypeScript

// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
// SPDX-License-Identifier: MIT
import "~/styles/globals.css";
import { type Metadata } from "next";
import { Geist } from "next/font/google";
import Script from "next/script";
import { ThemeProviderWrapper } from "~/components/deer-flow/theme-provider-wrapper";
import { loadConfig } from "~/core/api/config";
import { env } from "~/env";
import { Toaster } from "../components/deer-flow/toaster";
export const metadata: Metadata = {
title: "🦌 DeerFlow",
description:
"Deep Exploration and Efficient Research, an AI tool that combines language models with specialized tools for research tasks.",
icons: [{ rel: "icon", url: "/favicon.ico" }],
};
const geist = Geist({
subsets: ["latin"],
variable: "--font-geist-sans",
});
export default async function RootLayout({
children,
}: Readonly<{ children: React.ReactNode }>) {
const conf = await loadConfig();
return (
<html lang="en" className={`${geist.variable}`} suppressHydrationWarning>
<head>
<script>{`window.__deerflowConfig = ${JSON.stringify(conf)}`}</script>
{/* Define isSpace function globally to fix markdown-it issues with Next.js + Turbopack
https://github.com/markdown-it/markdown-it/issues/1082#issuecomment-2749656365 */}
<Script id="markdown-it-fix" strategy="beforeInteractive">
{`
if (typeof window !== 'undefined' && typeof window.isSpace === 'undefined') {
window.isSpace = function(code) {
return code === 0x20 || code === 0x09 || code === 0x0A || code === 0x0B || code === 0x0C || code === 0x0D;
};
}
`}
</Script>
</head>
<body className="bg-app">
<ThemeProviderWrapper>{children}</ThemeProviderWrapper>
<Toaster />
{
// NO USER BEHAVIOR TRACKING OR PRIVATE DATA COLLECTION BY DEFAULT
//
// When `NEXT_PUBLIC_STATIC_WEBSITE_ONLY` is `true`, the script will be injected
// into the page only when `AMPLITUDE_API_KEY` is provided in `.env`
}
{env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY && env.AMPLITUDE_API_KEY && (
<>
<Script src="https://cdn.amplitude.com/script/d2197dd1df3f2959f26295bb0e7e849f.js"></Script>
<Script id="amplitude-init" strategy="lazyOnload">
{`window.amplitude.init('${env.AMPLITUDE_API_KEY}', {"fetchRemoteConfig":true,"autocapture":true});`}
</Script>
</>
)}
</body>
</html>
);
}