build: 前端构建通过

This commit is contained in:
肖应宇 2026-04-08 13:49:45 +08:00
parent 36c32f382f
commit 82784c9413
8 changed files with 1325 additions and 44 deletions

View File

@ -75,6 +75,8 @@
"nanoid": "^5.1.6",
"next": "^16.1.7",
"next-themes": "^0.4.6",
"nextra": "^4.6.1",
"nextra-theme-docs": "^4.6.1",
"nuxt-og-image": "^5.1.13",
"ogl": "^1.0.11",
"react": "^19.0.0",

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,7 @@
import { generateStaticParamsFor, importPage } from "nextra/pages";
import { importPage } from "nextra/pages";
import { useMDXComponents as getMDXComponents } from "../../../../mdx-components";
export const generateStaticParams = generateStaticParamsFor("mdxPath");
export async function generateMetadata(props) {
const params = await props.params;
const { metadata } = await importPage(params.mdxPath, params.lang);

View File

@ -3,7 +3,6 @@ import { getPageMap } from "nextra/page-map";
import { Footer, Layout } from "nextra-theme-docs";
import { Header } from "@/components/landing/header";
import { getLocaleByLang } from "@/core/i18n/locale";
import "nextra-theme-docs/style.css";
const footer = <Footer>MIT {new Date().getFullYear()} © Nextra.</Footer>;
@ -27,18 +26,11 @@ function formatPageRoute(base: string, items: PageMapItem[]): PageMapItem[] {
export default async function DocLayout({ children, params }) {
const { lang } = await params;
const locale = getLocaleByLang(lang);
const pages = await getPageMap(`/${lang}`);
return (
<Layout
navbar={
<Header
className="relative max-w-full px-10"
homeURL="/"
locale={locale}
/>
}
navbar={<Header />}
pageMap={formatPageRoute(`/${lang}/docs`, pages)}
docsRepositoryBase="https://github.com/bytedance/deerflow/tree/main/frontend/src/app/content"
footer={footer}

View File

@ -2,7 +2,7 @@
import { BotIcon, PlusSquare } from "lucide-react";
import { useParams, useRouter } from "next/navigation";
import { useCallback, useState } from "react";
import { useCallback } from "react";
import type { PromptInputMessage } from "@/components/ai-elements/prompt-input";
import { Button } from "@/components/ui/button";
@ -11,11 +11,7 @@ import { ArtifactTrigger } from "@/components/workspace/artifacts";
import { ChatBox, useThreadChat } from "@/components/workspace/chats";
import { ExportTrigger } from "@/components/workspace/export-trigger";
import { InputBox } from "@/components/workspace/input-box";
import {
MessageList,
MESSAGE_LIST_DEFAULT_PADDING_BOTTOM,
MESSAGE_LIST_FOLLOWUPS_EXTRA_PADDING_BOTTOM,
} from "@/components/workspace/messages";
import { MessageList } from "@/components/workspace/messages";
import { ThreadContext } from "@/components/workspace/messages/context";
import { ThreadTitle } from "@/components/workspace/thread-title";
import { TodoList } from "@/components/workspace/todo-list";
@ -24,15 +20,17 @@ import { Tooltip } from "@/components/workspace/tooltip";
import { useAgent } from "@/core/agents";
import { useI18n } from "@/core/i18n/hooks";
import { useNotification } from "@/core/notification/hooks";
import { useThreadSettings } from "@/core/settings";
import { useLocalSettings } from "@/core/settings";
import { useThreadStream } from "@/core/threads/hooks";
import { textOfMessage } from "@/core/threads/utils";
import { env } from "@/env";
import { cn } from "@/lib/utils";
const MESSAGE_LIST_DEFAULT_PADDING_BOTTOM = 160;
const MESSAGE_LIST_FOLLOWUPS_EXTRA_PADDING_BOTTOM = 120;
export default function AgentChatPage() {
const { t } = useI18n();
const [showFollowups, setShowFollowups] = useState(false);
const router = useRouter();
const { agent_name } = useParams<{
@ -42,7 +40,7 @@ export default function AgentChatPage() {
const { agent } = useAgent(agent_name);
const { threadId, isNewThread, setIsNewThread } = useThreadChat();
const [settings, setSettings] = useThreadSettings(threadId);
const [settings, setSettings] = useLocalSettings();
const { showNotification } = useNotification();
const [thread, sendMessage] = useThreadStream({
@ -86,13 +84,12 @@ export default function AgentChatPage() {
await thread.stop();
}, [thread]);
const messageListPaddingBottom = showFollowups
? MESSAGE_LIST_DEFAULT_PADDING_BOTTOM +
MESSAGE_LIST_FOLLOWUPS_EXTRA_PADDING_BOTTOM
: undefined;
const messageListPaddingBottom =
MESSAGE_LIST_DEFAULT_PADDING_BOTTOM +
MESSAGE_LIST_FOLLOWUPS_EXTRA_PADDING_BOTTOM;
return (
<ThreadContext.Provider value={{ thread }}>
<ThreadContext.Provider value={{ thread, threadId }}>
<ChatBox threadId={threadId}>
<div className="relative flex size-full min-h-0 justify-between">
<header
@ -166,9 +163,10 @@ export default function AgentChatPage() {
<InputBox
className={cn("bg-background/5 w-full -translate-y-4")}
isNewThread={isNewThread}
threadId={threadId}
autoFocus={isNewThread}
showWelcomeStyle={isNewThread}
hasSubmitted={!isNewThread}
status={
thread.error
? "error"
@ -184,7 +182,6 @@ export default function AgentChatPage() {
}
disabled={env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true"}
onContextChange={(context) => setSettings("context", context)}
onFollowupsVisibilityChange={setShowFollowups}
onSubmit={handleSubmit}
onStop={handleStop}
/>

View File

@ -186,7 +186,7 @@ export default function NewAgentPage() {
// ── Step 2: chat ───────────────────────────────────────────────────────────
return (
<ThreadContext.Provider value={{ thread }}>
<ThreadContext.Provider value={{ thread, threadId }}>
<ArtifactsProvider>
<div className="flex size-full flex-col">
{header}

View File

@ -133,7 +133,7 @@ const ChatBox: React.FC<{
artifactPanelOpen ? "translate-x-0" : "translate-x-full",
)}
>
{selectedArtifact ? (
{selectedArtifact && threadId ? (
<ArtifactFileDetail
// className="size-full"
filepath={selectedArtifact}
@ -167,7 +167,7 @@ const ChatBox: React.FC<{
<ArtifactFileList
className="max-w-(--container-width-sm) p-4 pt-12"
files={thread.values.artifacts ?? []}
threadId={threadId}
threadId={threadId ?? ""}
/>
</main>
</div>

View File

@ -59,7 +59,6 @@ import {
import { useI18n } from "@/core/i18n/hooks";
import type {
SelectedSkillPayloadItem,
SuggestionSkillChildren,
} from "@/core/i18n/locales/types";
import { POST_MESSAGE_TYPES, sendToParent } from "@/core/iframe-messages";
import { useModels } from "@/core/models/hooks";
@ -525,14 +524,13 @@ function SuggestionList({
suggestion: {
prompt: string;
skill_id?: string[];
children?: SuggestionSkillChildren[];
children?: SelectedSkillPayloadItem[];
suggestion: string;
},
) => {
// 优先从 children 中提取 skill_id 数组,转换为 selectedSkills 发送给宿主页
const childSkillIds = (suggestion.children ?? [])
.flatMap((item) => item.skill_id)
.map((item) => item.trim())
.map((item) => String(item.id).trim())
.filter((id): id is string => Boolean(id));
if (childSkillIds.length > 0) {
sendSelectSkill(