build: 前端构建通过
This commit is contained in:
parent
90e63422da
commit
f87f185bbd
|
|
@ -75,6 +75,8 @@
|
||||||
"nanoid": "^5.1.6",
|
"nanoid": "^5.1.6",
|
||||||
"next": "^16.1.7",
|
"next": "^16.1.7",
|
||||||
"next-themes": "^0.4.6",
|
"next-themes": "^0.4.6",
|
||||||
|
"nextra": "^4.6.1",
|
||||||
|
"nextra-theme-docs": "^4.6.1",
|
||||||
"nuxt-og-image": "^5.1.13",
|
"nuxt-og-image": "^5.1.13",
|
||||||
"ogl": "^1.0.11",
|
"ogl": "^1.0.11",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,9 +1,7 @@
|
||||||
import { generateStaticParamsFor, importPage } from "nextra/pages";
|
import { importPage } from "nextra/pages";
|
||||||
|
|
||||||
import { useMDXComponents as getMDXComponents } from "../../../../mdx-components";
|
import { useMDXComponents as getMDXComponents } from "../../../../mdx-components";
|
||||||
|
|
||||||
export const generateStaticParams = generateStaticParamsFor("mdxPath");
|
|
||||||
|
|
||||||
export async function generateMetadata(props) {
|
export async function generateMetadata(props) {
|
||||||
const params = await props.params;
|
const params = await props.params;
|
||||||
const { metadata } = await importPage(params.mdxPath, params.lang);
|
const { metadata } = await importPage(params.mdxPath, params.lang);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import { getPageMap } from "nextra/page-map";
|
||||||
import { Footer, Layout } from "nextra-theme-docs";
|
import { Footer, Layout } from "nextra-theme-docs";
|
||||||
|
|
||||||
import { Header } from "@/components/landing/header";
|
import { Header } from "@/components/landing/header";
|
||||||
import { getLocaleByLang } from "@/core/i18n/locale";
|
|
||||||
import "nextra-theme-docs/style.css";
|
import "nextra-theme-docs/style.css";
|
||||||
|
|
||||||
const footer = <Footer>MIT {new Date().getFullYear()} © Nextra.</Footer>;
|
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 }) {
|
export default async function DocLayout({ children, params }) {
|
||||||
const { lang } = await params;
|
const { lang } = await params;
|
||||||
const locale = getLocaleByLang(lang);
|
|
||||||
const pages = await getPageMap(`/${lang}`);
|
const pages = await getPageMap(`/${lang}`);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout
|
<Layout
|
||||||
navbar={
|
navbar={<Header />}
|
||||||
<Header
|
|
||||||
className="relative max-w-full px-10"
|
|
||||||
homeURL="/"
|
|
||||||
locale={locale}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
pageMap={formatPageRoute(`/${lang}/docs`, pages)}
|
pageMap={formatPageRoute(`/${lang}/docs`, pages)}
|
||||||
docsRepositoryBase="https://github.com/bytedance/deerflow/tree/main/frontend/src/app/content"
|
docsRepositoryBase="https://github.com/bytedance/deerflow/tree/main/frontend/src/app/content"
|
||||||
footer={footer}
|
footer={footer}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import { BotIcon, PlusSquare } from "lucide-react";
|
import { BotIcon, PlusSquare } from "lucide-react";
|
||||||
import { useParams, useRouter } from "next/navigation";
|
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 type { PromptInputMessage } from "@/components/ai-elements/prompt-input";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
|
@ -11,11 +11,7 @@ import { ArtifactTrigger } from "@/components/workspace/artifacts";
|
||||||
import { ChatBox, useThreadChat } from "@/components/workspace/chats";
|
import { ChatBox, useThreadChat } from "@/components/workspace/chats";
|
||||||
import { ExportTrigger } from "@/components/workspace/export-trigger";
|
import { ExportTrigger } from "@/components/workspace/export-trigger";
|
||||||
import { InputBox } from "@/components/workspace/input-box";
|
import { InputBox } from "@/components/workspace/input-box";
|
||||||
import {
|
import { MessageList } from "@/components/workspace/messages";
|
||||||
MessageList,
|
|
||||||
MESSAGE_LIST_DEFAULT_PADDING_BOTTOM,
|
|
||||||
MESSAGE_LIST_FOLLOWUPS_EXTRA_PADDING_BOTTOM,
|
|
||||||
} from "@/components/workspace/messages";
|
|
||||||
import { ThreadContext } from "@/components/workspace/messages/context";
|
import { ThreadContext } from "@/components/workspace/messages/context";
|
||||||
import { ThreadTitle } from "@/components/workspace/thread-title";
|
import { ThreadTitle } from "@/components/workspace/thread-title";
|
||||||
import { TodoList } from "@/components/workspace/todo-list";
|
import { TodoList } from "@/components/workspace/todo-list";
|
||||||
|
|
@ -24,15 +20,17 @@ import { Tooltip } from "@/components/workspace/tooltip";
|
||||||
import { useAgent } from "@/core/agents";
|
import { useAgent } from "@/core/agents";
|
||||||
import { useI18n } from "@/core/i18n/hooks";
|
import { useI18n } from "@/core/i18n/hooks";
|
||||||
import { useNotification } from "@/core/notification/hooks";
|
import { useNotification } from "@/core/notification/hooks";
|
||||||
import { useThreadSettings } from "@/core/settings";
|
import { useLocalSettings } from "@/core/settings";
|
||||||
import { useThreadStream } from "@/core/threads/hooks";
|
import { useThreadStream } from "@/core/threads/hooks";
|
||||||
import { textOfMessage } from "@/core/threads/utils";
|
import { textOfMessage } from "@/core/threads/utils";
|
||||||
import { env } from "@/env";
|
import { env } from "@/env";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
const MESSAGE_LIST_DEFAULT_PADDING_BOTTOM = 160;
|
||||||
|
const MESSAGE_LIST_FOLLOWUPS_EXTRA_PADDING_BOTTOM = 120;
|
||||||
|
|
||||||
export default function AgentChatPage() {
|
export default function AgentChatPage() {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const [showFollowups, setShowFollowups] = useState(false);
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const { agent_name } = useParams<{
|
const { agent_name } = useParams<{
|
||||||
|
|
@ -42,7 +40,7 @@ export default function AgentChatPage() {
|
||||||
const { agent } = useAgent(agent_name);
|
const { agent } = useAgent(agent_name);
|
||||||
|
|
||||||
const { threadId, isNewThread, setIsNewThread } = useThreadChat();
|
const { threadId, isNewThread, setIsNewThread } = useThreadChat();
|
||||||
const [settings, setSettings] = useThreadSettings(threadId);
|
const [settings, setSettings] = useLocalSettings();
|
||||||
|
|
||||||
const { showNotification } = useNotification();
|
const { showNotification } = useNotification();
|
||||||
const [thread, sendMessage] = useThreadStream({
|
const [thread, sendMessage] = useThreadStream({
|
||||||
|
|
@ -86,13 +84,12 @@ export default function AgentChatPage() {
|
||||||
await thread.stop();
|
await thread.stop();
|
||||||
}, [thread]);
|
}, [thread]);
|
||||||
|
|
||||||
const messageListPaddingBottom = showFollowups
|
const messageListPaddingBottom =
|
||||||
? MESSAGE_LIST_DEFAULT_PADDING_BOTTOM +
|
MESSAGE_LIST_DEFAULT_PADDING_BOTTOM +
|
||||||
MESSAGE_LIST_FOLLOWUPS_EXTRA_PADDING_BOTTOM
|
MESSAGE_LIST_FOLLOWUPS_EXTRA_PADDING_BOTTOM;
|
||||||
: undefined;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThreadContext.Provider value={{ thread }}>
|
<ThreadContext.Provider value={{ thread, threadId }}>
|
||||||
<ChatBox threadId={threadId}>
|
<ChatBox threadId={threadId}>
|
||||||
<div className="relative flex size-full min-h-0 justify-between">
|
<div className="relative flex size-full min-h-0 justify-between">
|
||||||
<header
|
<header
|
||||||
|
|
@ -166,9 +163,10 @@ export default function AgentChatPage() {
|
||||||
|
|
||||||
<InputBox
|
<InputBox
|
||||||
className={cn("bg-background/5 w-full -translate-y-4")}
|
className={cn("bg-background/5 w-full -translate-y-4")}
|
||||||
isNewThread={isNewThread}
|
|
||||||
threadId={threadId}
|
threadId={threadId}
|
||||||
autoFocus={isNewThread}
|
autoFocus={isNewThread}
|
||||||
|
showWelcomeStyle={isNewThread}
|
||||||
|
hasSubmitted={!isNewThread}
|
||||||
status={
|
status={
|
||||||
thread.error
|
thread.error
|
||||||
? "error"
|
? "error"
|
||||||
|
|
@ -184,7 +182,6 @@ export default function AgentChatPage() {
|
||||||
}
|
}
|
||||||
disabled={env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true"}
|
disabled={env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true"}
|
||||||
onContextChange={(context) => setSettings("context", context)}
|
onContextChange={(context) => setSettings("context", context)}
|
||||||
onFollowupsVisibilityChange={setShowFollowups}
|
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
onStop={handleStop}
|
onStop={handleStop}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ export default function NewAgentPage() {
|
||||||
// ── Step 2: chat ───────────────────────────────────────────────────────────
|
// ── Step 2: chat ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThreadContext.Provider value={{ thread }}>
|
<ThreadContext.Provider value={{ thread, threadId }}>
|
||||||
<ArtifactsProvider>
|
<ArtifactsProvider>
|
||||||
<div className="flex size-full flex-col">
|
<div className="flex size-full flex-col">
|
||||||
{header}
|
{header}
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ const ChatBox: React.FC<{
|
||||||
artifactPanelOpen ? "translate-x-0" : "translate-x-full",
|
artifactPanelOpen ? "translate-x-0" : "translate-x-full",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{selectedArtifact ? (
|
{selectedArtifact && threadId ? (
|
||||||
<ArtifactFileDetail
|
<ArtifactFileDetail
|
||||||
// className="size-full"
|
// className="size-full"
|
||||||
filepath={selectedArtifact}
|
filepath={selectedArtifact}
|
||||||
|
|
@ -167,7 +167,7 @@ const ChatBox: React.FC<{
|
||||||
<ArtifactFileList
|
<ArtifactFileList
|
||||||
className="max-w-(--container-width-sm) p-4 pt-12"
|
className="max-w-(--container-width-sm) p-4 pt-12"
|
||||||
files={thread.values.artifacts ?? []}
|
files={thread.values.artifacts ?? []}
|
||||||
threadId={threadId}
|
threadId={threadId ?? ""}
|
||||||
/>
|
/>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ import {
|
||||||
import { useI18n } from "@/core/i18n/hooks";
|
import { useI18n } from "@/core/i18n/hooks";
|
||||||
import type {
|
import type {
|
||||||
SelectedSkillPayloadItem,
|
SelectedSkillPayloadItem,
|
||||||
SuggestionSkillChildren,
|
|
||||||
} from "@/core/i18n/locales/types";
|
} from "@/core/i18n/locales/types";
|
||||||
import { POST_MESSAGE_TYPES, sendToParent } from "@/core/iframe-messages";
|
import { POST_MESSAGE_TYPES, sendToParent } from "@/core/iframe-messages";
|
||||||
import { useModels } from "@/core/models/hooks";
|
import { useModels } from "@/core/models/hooks";
|
||||||
|
|
@ -525,14 +524,13 @@ function SuggestionList({
|
||||||
suggestion: {
|
suggestion: {
|
||||||
prompt: string;
|
prompt: string;
|
||||||
skill_id?: string[];
|
skill_id?: string[];
|
||||||
children?: SuggestionSkillChildren[];
|
children?: SelectedSkillPayloadItem[];
|
||||||
suggestion: string;
|
suggestion: string;
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
// 优先从 children 中提取 skill_id 数组,转换为 selectedSkills 发送给宿主页
|
// 优先从 children 中提取 skill_id 数组,转换为 selectedSkills 发送给宿主页
|
||||||
const childSkillIds = (suggestion.children ?? [])
|
const childSkillIds = (suggestion.children ?? [])
|
||||||
.flatMap((item) => item.skill_id)
|
.map((item) => String(item.id).trim())
|
||||||
.map((item) => item.trim())
|
|
||||||
.filter((id): id is string => Boolean(id));
|
.filter((id): id is string => Boolean(id));
|
||||||
if (childSkillIds.length > 0) {
|
if (childSkillIds.length > 0) {
|
||||||
sendSelectSkill(
|
sendSelectSkill(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue