feat(webui): refine automation calendar workflows

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-13 05:43:05 +08:00
1 parent 98b0c3858b
commit 37e29c36e5
25 files changed
+1789 -487

No files matched your search

+39
View File
@@ -46,6 +46,7 @@ import { useSkills } from "@/hooks/useSkills";
import { useLogoFallback } from "@/hooks/useLogoFallback";
import { usePageVisibility } from "@/hooks/usePageVisibility";
import { useMediaQuery } from "@/hooks/useMediaQuery";
import type { SendAttachment, SendOptions } from "@/hooks/useNanobotStream";
import { ThemeProvider, useTheme } from "@/hooks/useTheme";
import { logoFallbackUrls } from "@/lib/provider-brand";
import { cn } from "@/lib/utils";
@@ -1126,6 +1127,13 @@ function Shell({
const skills = useSkills(getToken);
const pageVisible = usePageVisibility();
const [settingsSnapshot, setSettingsSnapshot] = useState<SettingsPayload | null>(null);
const [pendingAutomationMessage, setPendingAutomationMessage] = useState<{
id: string;
chatId: string;
content: string;
images?: SendAttachment[];
options?: SendOptions;
} | null>(null);
const settingsExitGuardRef = useRef<SettingsExitGuard | null>(null);
const currentShellRouteRef = useRef<ShellRoute>({ view, activeKey, settingsSection: settingsInitialSection });
currentShellRouteRef.current = { view, activeKey, settingsSection: settingsInitialSection };
@@ -1581,6 +1589,32 @@ function Shell({
}
}, [activeWorkspaceScope, createChat, navigate, t]);
const onStartAutomationChat = useCallback(async (
content: string,
images?: SendAttachment[],
options?: SendOptions,
modelPreset?: string | null,
) => {
const chatId = await onCreateChat(
options?.workspaceScope ?? activeWorkspaceScope,
content,
modelPreset,
);
if (!chatId) return false;
setPendingAutomationMessage({
id: crypto.randomUUID(),
chatId,
content,
images,
options,
});
return true;
}, [activeWorkspaceScope, onCreateChat]);
const onPendingAutomationMessageConsumed = useCallback((id: string) => {
setPendingAutomationMessage((current) => current?.id === id ? null : current);
}, []);
const onCreateTemporaryChat = useCallback(
async (
workspaceScope?: WorkspaceScopePayload | null,
@@ -2754,6 +2788,8 @@ function Shell({
onCreateChat={
temporaryChatEnabled ? onCreateTemporaryChat : onCreateChat
}
pendingFirstMessage={pendingAutomationMessage}
onPendingFirstMessageConsumed={onPendingAutomationMessageConsumed}
onForkChat={temporaryChatActive ? undefined : onForkChat}
onTurnEnd={onTurnEnd}
theme={theme}
@@ -2790,6 +2826,8 @@ function Shell({
onToggleSidebar={toggleSidebar}
onNewChat={onNewChat}
onCreateChat={onCreateChat}
pendingFirstMessage={pendingAutomationMessage}
onPendingFirstMessageConsumed={onPendingAutomationMessageConsumed}
onForkChat={onForkChat}
onTurnEnd={context.active ? onTurnEnd : () => void refresh()}
theme={theme}
@@ -2847,6 +2885,7 @@ function Shell({
onModelNameChange={onModelNameChange}
onSettingsChange={setSettingsSnapshot}
skills={skills}
onStartAutomationChat={onStartAutomationChat}
titleOverrides={sidebarState.title_overrides}
onSectionChange={onSettingsSectionChange}
onLogout={onLogout}