Merge branch 'dhk-1' of http://192.168.0.200/knowledge-base-bj/deerflow-code into dhk-1
This commit is contained in:
commit
56740ecf56
6 files changed
+40
-13
No files matched your search
@@ -15,6 +15,7 @@ import {
|
|||||||
} from "@/components/ui/dropdown-menu";
|
} from "@/components/ui/dropdown-menu";
|
||||||
import { useTheme, type ThemeType } from "@/contexts/ThemeContext";
|
import { useTheme, type ThemeType } from "@/contexts/ThemeContext";
|
||||||
import { useAppearanceSettings, useLayoutMode } from "@/core/system-settings/hooks";
|
import { useAppearanceSettings, useLayoutMode } from "@/core/system-settings/hooks";
|
||||||
|
import { isHideChromeActive } from "@/core/embed/embed-session";
|
||||||
import { env } from "@/env";
|
import { env } from "@/env";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { buildLightAppUrl } from "@/strategy-components/lib/light-app";
|
import { buildLightAppUrl } from "@/strategy-components/lib/light-app";
|
||||||
@@ -97,7 +98,7 @@ export function ThemeSwitcher({ tone }: { tone: AppearanceControlTone }) {
|
|||||||
|
|
||||||
useEffect(() => () => cancelClose(), []);
|
useEffect(() => () => cancelClose(), []);
|
||||||
|
|
||||||
if (env.FORCE_COLLAPSED_SIDEBAR) return null;
|
if (env.FORCE_COLLAPSED_SIDEBAR || isHideChromeActive()) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -189,7 +190,7 @@ export function LayoutModeSwitcher({
|
|||||||
const current = mode ?? fallback;
|
const current = mode ?? fallback;
|
||||||
const TriggerIcon = current === "full" ? PanelLeftIcon : LayoutIcon;
|
const TriggerIcon = current === "full" ? PanelLeftIcon : LayoutIcon;
|
||||||
|
|
||||||
if (env.FORCE_COLLAPSED_SIDEBAR) return null;
|
if (env.FORCE_COLLAPSED_SIDEBAR || isHideChromeActive()) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
|
|||||||
@@ -151,6 +151,10 @@ export function isChromeHidden(): boolean {
|
|||||||
return s?.embed === true || s?.hideChrome === true;
|
return s?.embed === true || s?.hideChrome === true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isHideChromeActive(): boolean {
|
||||||
|
return readEmbedSession()?.hideChrome === true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 本标签页是否处于独立会话态:鉴权身份按标签页隔离(走 sessionStorage)。
|
* 本标签页是否处于独立会话态:鉴权身份按标签页隔离(走 sessionStorage)。
|
||||||
* `embed` 已隐含同样的隔离,故 `authStorage()` 取「embed || isolate」之并;这里只判 `isolate`,
|
* `embed` 已隐含同样的隔离,故 `authStorage()` 取「embed || isolate」之并;这里只判 `isolate`,
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import { Welcome } from "@/components/workspace/welcome";
|
|||||||
import { CompactWelcome } from "@/components/workspace/compact-welcome";
|
import { CompactWelcome } from "@/components/workspace/compact-welcome";
|
||||||
import { readSidebarEnabled } from "@/core/page-layout/sidebar-enabled";
|
import { readSidebarEnabled } from "@/core/page-layout/sidebar-enabled";
|
||||||
import { isChatsIframeWorkspacePath } from "@/core/page-layout/chats-iframe-route";
|
import { isChatsIframeWorkspacePath } from "@/core/page-layout/chats-iframe-route";
|
||||||
|
import { isHideChromeActive } from "@/core/embed/embed-session";
|
||||||
import { useSidebar } from "@/components/ui/sidebar";
|
import { useSidebar } from "@/components/ui/sidebar";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { PanelLeftOpen } from "lucide-react";
|
import { PanelLeftOpen } from "lucide-react";
|
||||||
@@ -459,6 +460,7 @@ export default function ChatPage() {
|
|||||||
const compactChrome =
|
const compactChrome =
|
||||||
chromeByPreference && !isChatsIframeWorkspacePath(pathname);
|
chromeByPreference && !isChatsIframeWorkspacePath(pathname);
|
||||||
const compactLanding = isLandingState && compactChrome;
|
const compactLanding = isLandingState && compactChrome;
|
||||||
|
const compactActionsHidden = isHideChromeActive();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThreadContext.Provider value={{ thread, isMock }}>
|
<ThreadContext.Provider value={{ thread, isMock }}>
|
||||||
@@ -483,7 +485,7 @@ export default function ChatPage() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{/* 仅在收起态显示「展开历史」钮;展开后由侧栏内(新对话右侧)的收起钮负责收起。 */}
|
{/* 仅在收起态显示「展开历史」钮;展开后由侧栏内(新对话右侧)的收起钮负责收起。 */}
|
||||||
{compactChrome && !historySidebarOpen && (
|
{compactChrome && !historySidebarOpen && !compactActionsHidden && (
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
@@ -507,7 +509,7 @@ export default function ChatPage() {
|
|||||||
与全量模式 Header 右上角保持一致。全量模式已有顶栏则不重复展示。 */}
|
与全量模式 Header 右上角保持一致。全量模式已有顶栏则不重复展示。 */}
|
||||||
{/* 简洁模式无全局顶栏:把换肤 + 界面模式切换搬到页面级顶栏右上角,
|
{/* 简洁模式无全局顶栏:把换肤 + 界面模式切换搬到页面级顶栏右上角,
|
||||||
与全量模式 Header 右上角保持一致(content 配色贴浅底顶栏)。 */}
|
与全量模式 Header 右上角保持一致(content 配色贴浅底顶栏)。 */}
|
||||||
{!compactChrome && (
|
{!compactChrome && !compactActionsHidden && (
|
||||||
<>
|
<>
|
||||||
<CompactShortcutButtons tone="content" />
|
<CompactShortcutButtons tone="content" />
|
||||||
<ThemeSwitcher tone="content" />
|
<ThemeSwitcher tone="content" />
|
||||||
|
|||||||
@@ -123,7 +123,10 @@ export default function LoginPage() {
|
|||||||
// taskId,无需把它编进 redirect 值里。目标已自带的同名参数优先(不覆盖);登录鉴权类参数
|
// taskId,无需把它编进 redirect 值里。目标已自带的同名参数优先(不覆盖);登录鉴权类参数
|
||||||
// (token/authToken/ticket 等)一律**不透传**,避免泄漏到应用页地址栏。
|
// (token/authToken/ticket 等)一律**不透传**,避免泄漏到应用页地址栏。
|
||||||
const redirectTo = useMemo(() => {
|
const redirectTo = useMemo(() => {
|
||||||
const raw = searchParams.get('redirect')?.trim() ?? '';
|
const raw =
|
||||||
|
searchParams.get('redirect')?.trim() ||
|
||||||
|
searchParams.get('route')?.trim() ||
|
||||||
|
'';
|
||||||
if (!raw) return '';
|
if (!raw) return '';
|
||||||
if (/^[a-z][a-z0-9+.-]*:/i.test(raw) || raw.startsWith('//') || raw.includes('\\')) return '';
|
if (/^[a-z][a-z0-9+.-]*:/i.test(raw) || raw.startsWith('//') || raw.includes('\\')) return '';
|
||||||
const normalized = raw.startsWith('/') ? raw : `/${raw}`;
|
const normalized = raw.startsWith('/') ? raw : `/${raw}`;
|
||||||
@@ -131,7 +134,7 @@ export default function LoginPage() {
|
|||||||
const target = new URLSearchParams(ownQuery);
|
const target = new URLSearchParams(ownQuery);
|
||||||
// 登录流程自身消费的参数,不透传到目标页(尤以鉴权类为甚)。
|
// 登录流程自身消费的参数,不透传到目标页(尤以鉴权类为甚)。
|
||||||
const LOGIN_OWNED = new Set([
|
const LOGIN_OWNED = new Set([
|
||||||
'redirect', 'ticket', 'userId', 'env', 'theme', 'yUserId',
|
'redirect', 'route', 'ticket', 'userId', 'env', 'theme', 'yUserId',
|
||||||
'token', 'access_token', 'password', 'authToken', 'goPath', 'from',
|
'token', 'access_token', 'password', 'authToken', 'goPath', 'from',
|
||||||
]);
|
]);
|
||||||
new URLSearchParams(searchParams.toString()).forEach((value, key) => {
|
new URLSearchParams(searchParams.toString()).forEach((value, key) => {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { isWujieEnv } from "@/core/embed/wujie";
|
|||||||
import {
|
import {
|
||||||
isEmbedActive,
|
isEmbedActive,
|
||||||
isChromeHidden,
|
isChromeHidden,
|
||||||
|
isHideChromeActive,
|
||||||
readEmbedParam,
|
readEmbedParam,
|
||||||
readHideChromeParam,
|
readHideChromeParam,
|
||||||
} from "@/core/embed/embed-session";
|
} from "@/core/embed/embed-session";
|
||||||
@@ -64,6 +65,10 @@ function PageLayout() {
|
|||||||
() => isChromeHidden() || readHideChromeParam(location.search) === "on",
|
() => isChromeHidden() || readHideChromeParam(location.search) === "on",
|
||||||
[location.pathname, location.search],
|
[location.pathname, location.search],
|
||||||
);
|
);
|
||||||
|
const hideChromeActive = useMemo(
|
||||||
|
() => isHideChromeActive() || readHideChromeParam(location.search) === "on",
|
||||||
|
[location.pathname, location.search],
|
||||||
|
);
|
||||||
// 「大屏绘制」独立页(/page/strategy/dashboard-agent)本就是「带导航栏 + 侧边栏」的独立页,
|
// 「大屏绘制」独立页(/page/strategy/dashboard-agent)本就是「带导航栏 + 侧边栏」的独立页,
|
||||||
// 但它常被深链「上一步」从去 chrome 的工作区/新标签打开——那里 chromeByPreference 可能为 false
|
// 但它常被深链「上一步」从去 chrome 的工作区/新标签打开——那里 chromeByPreference 可能为 false
|
||||||
// (界面模式非全量、或会话级 sidebar 未置位),导致整页没有顶栏/侧栏。故对该路由**强制全局 chrome**
|
// (界面模式非全量、或会话级 sidebar 未置位),导致整页没有顶栏/侧栏。故对该路由**强制全局 chrome**
|
||||||
@@ -120,8 +125,10 @@ function PageLayout() {
|
|||||||
<WorkspaceRoutes
|
<WorkspaceRoutes
|
||||||
pageSidebarCollapsed={collapsed}
|
pageSidebarCollapsed={collapsed}
|
||||||
pageSidebarHidden={!pageSidebarAllowed}
|
pageSidebarHidden={!pageSidebarAllowed}
|
||||||
|
workspaceSidebarHidden={hideChromeActive}
|
||||||
headerHidden={!pageSidebarAllowed}
|
headerHidden={!pageSidebarAllowed}
|
||||||
compactWorkspaceSidebar={pageSidebarAllowed}
|
compactWorkspaceSidebar={pageSidebarAllowed}
|
||||||
|
compactActionsHidden={hideChromeActive}
|
||||||
pageSidebarDark={isDark}
|
pageSidebarDark={isDark}
|
||||||
forceWorkspaceSidebarCollapsed={forceCollapsedSidebar}
|
forceWorkspaceSidebarCollapsed={forceCollapsedSidebar}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ export function WorkspaceLayout({
|
|||||||
pageSidebarHidden = false,
|
pageSidebarHidden = false,
|
||||||
workspaceSidebarHidden = false,
|
workspaceSidebarHidden = false,
|
||||||
headerHidden = false,
|
headerHidden = false,
|
||||||
|
compactActionsHidden = false,
|
||||||
compactWorkspaceSidebar = false,
|
compactWorkspaceSidebar = false,
|
||||||
defaultHistorySidebarOpen,
|
defaultHistorySidebarOpen,
|
||||||
wrapperOverflowHidden = false,
|
wrapperOverflowHidden = false,
|
||||||
@@ -130,6 +131,7 @@ export function WorkspaceLayout({
|
|||||||
pageSidebarHidden?: boolean;
|
pageSidebarHidden?: boolean;
|
||||||
workspaceSidebarHidden?: boolean;
|
workspaceSidebarHidden?: boolean;
|
||||||
headerHidden?: boolean;
|
headerHidden?: boolean;
|
||||||
|
compactActionsHidden?: boolean;
|
||||||
compactWorkspaceSidebar?: boolean;
|
compactWorkspaceSidebar?: boolean;
|
||||||
/** 全量模式下通用问答等页:聊天记录侧栏默认展开;未指定时紧凑模式仍默认收起。 */
|
/** 全量模式下通用问答等页:聊天记录侧栏默认展开;未指定时紧凑模式仍默认收起。 */
|
||||||
defaultHistorySidebarOpen?: boolean;
|
defaultHistorySidebarOpen?: boolean;
|
||||||
@@ -144,7 +146,7 @@ export function WorkspaceLayout({
|
|||||||
const pathname = useLocation().pathname;
|
const pathname = useLocation().pathname;
|
||||||
const isGeneralQa = pathname.startsWith('/page/workspace/chats');
|
const isGeneralQa = pathname.startsWith('/page/workspace/chats');
|
||||||
const showCompactTopActions =
|
const showCompactTopActions =
|
||||||
headerHidden && shouldShowCompactTopActions(pathname);
|
headerHidden && !compactActionsHidden && shouldShowCompactTopActions(pathname);
|
||||||
|
|
||||||
const pageSidebarWidth = pageSidebarHidden
|
const pageSidebarWidth = pageSidebarHidden
|
||||||
? '0rem'
|
? '0rem'
|
||||||
@@ -236,8 +238,10 @@ function NewChatEntryRoute({
|
|||||||
layoutProps: {
|
layoutProps: {
|
||||||
pageSidebarCollapsed: boolean;
|
pageSidebarCollapsed: boolean;
|
||||||
pageSidebarHidden: boolean;
|
pageSidebarHidden: boolean;
|
||||||
|
workspaceSidebarHidden: boolean;
|
||||||
headerHidden: boolean;
|
headerHidden: boolean;
|
||||||
compactWorkspaceSidebar: boolean;
|
compactWorkspaceSidebar: boolean;
|
||||||
|
compactActionsHidden: boolean;
|
||||||
pageSidebarDark: boolean;
|
pageSidebarDark: boolean;
|
||||||
forceWorkspaceSidebarCollapsed: boolean;
|
forceWorkspaceSidebarCollapsed: boolean;
|
||||||
};
|
};
|
||||||
@@ -258,14 +262,18 @@ function NewChatEntryRoute({
|
|||||||
export default function WorkspaceRoutes({
|
export default function WorkspaceRoutes({
|
||||||
pageSidebarCollapsed = false,
|
pageSidebarCollapsed = false,
|
||||||
pageSidebarHidden = false,
|
pageSidebarHidden = false,
|
||||||
|
workspaceSidebarHidden = false,
|
||||||
headerHidden = false,
|
headerHidden = false,
|
||||||
|
compactActionsHidden = false,
|
||||||
compactWorkspaceSidebar = false,
|
compactWorkspaceSidebar = false,
|
||||||
pageSidebarDark = false,
|
pageSidebarDark = false,
|
||||||
forceWorkspaceSidebarCollapsed = false,
|
forceWorkspaceSidebarCollapsed = false,
|
||||||
}: {
|
}: {
|
||||||
pageSidebarCollapsed?: boolean;
|
pageSidebarCollapsed?: boolean;
|
||||||
pageSidebarHidden?: boolean;
|
pageSidebarHidden?: boolean;
|
||||||
|
workspaceSidebarHidden?: boolean;
|
||||||
headerHidden?: boolean;
|
headerHidden?: boolean;
|
||||||
|
compactActionsHidden?: boolean;
|
||||||
compactWorkspaceSidebar?: boolean;
|
compactWorkspaceSidebar?: boolean;
|
||||||
pageSidebarDark?: boolean;
|
pageSidebarDark?: boolean;
|
||||||
forceWorkspaceSidebarCollapsed?: boolean;
|
forceWorkspaceSidebarCollapsed?: boolean;
|
||||||
@@ -273,7 +281,9 @@ export default function WorkspaceRoutes({
|
|||||||
const layoutProps = {
|
const layoutProps = {
|
||||||
pageSidebarCollapsed,
|
pageSidebarCollapsed,
|
||||||
pageSidebarHidden,
|
pageSidebarHidden,
|
||||||
|
workspaceSidebarHidden,
|
||||||
headerHidden,
|
headerHidden,
|
||||||
|
compactActionsHidden,
|
||||||
compactWorkspaceSidebar,
|
compactWorkspaceSidebar,
|
||||||
pageSidebarDark,
|
pageSidebarDark,
|
||||||
forceWorkspaceSidebarCollapsed,
|
forceWorkspaceSidebarCollapsed,
|
||||||
@@ -287,7 +297,7 @@ export default function WorkspaceRoutes({
|
|||||||
path="chats"
|
path="chats"
|
||||||
element={
|
element={
|
||||||
<WorkspaceLayout {...layoutProps}>
|
<WorkspaceLayout {...layoutProps}>
|
||||||
<ChatsPage compactChrome={headerHidden} />
|
<ChatsPage compactChrome={headerHidden && !compactActionsHidden} />
|
||||||
</WorkspaceLayout>
|
</WorkspaceLayout>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -373,7 +383,7 @@ export default function WorkspaceRoutes({
|
|||||||
<AgentChatPage
|
<AgentChatPage
|
||||||
showAgentList
|
showAgentList
|
||||||
compactAppearanceActions={
|
compactAppearanceActions={
|
||||||
headerHidden ? <CompactAppearanceActions /> : undefined
|
headerHidden && !compactActionsHidden ? <CompactAppearanceActions /> : undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</ChatRuntime>
|
</ChatRuntime>
|
||||||
@@ -410,7 +420,7 @@ export default function WorkspaceRoutes({
|
|||||||
<WorkspaceLayout {...layoutProps}>
|
<WorkspaceLayout {...layoutProps}>
|
||||||
<AIWritingPage
|
<AIWritingPage
|
||||||
hideAdvancedFields
|
hideAdvancedFields
|
||||||
compactChrome={headerHidden}
|
compactChrome={headerHidden && !compactActionsHidden}
|
||||||
/>
|
/>
|
||||||
</WorkspaceLayout>
|
</WorkspaceLayout>
|
||||||
}
|
}
|
||||||
@@ -444,7 +454,7 @@ export default function WorkspaceRoutes({
|
|||||||
element={
|
element={
|
||||||
<WorkspaceLayout {...layoutProps}>
|
<WorkspaceLayout {...layoutProps}>
|
||||||
<ChatRuntime>
|
<ChatRuntime>
|
||||||
<RoundtablePlanningPage compactChrome={headerHidden} />
|
<RoundtablePlanningPage compactChrome={headerHidden && !compactActionsHidden} />
|
||||||
</ChatRuntime>
|
</ChatRuntime>
|
||||||
</WorkspaceLayout>
|
</WorkspaceLayout>
|
||||||
}
|
}
|
||||||
@@ -454,7 +464,7 @@ export default function WorkspaceRoutes({
|
|||||||
element={
|
element={
|
||||||
<WorkspaceLayout {...layoutProps}>
|
<WorkspaceLayout {...layoutProps}>
|
||||||
<ChatRuntime>
|
<ChatRuntime>
|
||||||
<PositionRoundtablePage compactChrome={headerHidden} />
|
<PositionRoundtablePage compactChrome={headerHidden && !compactActionsHidden} />
|
||||||
</ChatRuntime>
|
</ChatRuntime>
|
||||||
</WorkspaceLayout>
|
</WorkspaceLayout>
|
||||||
}
|
}
|
||||||
@@ -516,7 +526,7 @@ export default function WorkspaceRoutes({
|
|||||||
path="scheduled/tasks"
|
path="scheduled/tasks"
|
||||||
element={
|
element={
|
||||||
<WorkspaceLayout {...layoutProps}>
|
<WorkspaceLayout {...layoutProps}>
|
||||||
<ScheduledTasksPage compactChrome={headerHidden} />
|
<ScheduledTasksPage compactChrome={headerHidden && !compactActionsHidden} />
|
||||||
</WorkspaceLayout>
|
</WorkspaceLayout>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in new issue
Block a user