feat: add standalone AI assistant window button
- Add ExternalLink button to AI assistant toolbar - New route /ai-assistant-standalone renders AIAssistantPage without sidebar - Opens in new browser window via window.open
This commit is contained in:
@@ -4,7 +4,7 @@ import { ChatWindow } from '@/components/ai/ChatWindow';
|
|||||||
import { ResizablePanel } from '@/components/ui/ResizablePanel';
|
import { ResizablePanel } from '@/components/ui/ResizablePanel';
|
||||||
import { usePluginToolbarStore } from '@/store/pluginToolbarStore';
|
import { usePluginToolbarStore } from '@/store/pluginToolbarStore';
|
||||||
import { fetchAgents, createSession, type AIAgent } from '@/api/ai';
|
import { fetchAgents, createSession, type AIAgent } from '@/api/ai';
|
||||||
import { ChevronLeft, Folder, Plus } from 'lucide-react';
|
import { ChevronLeft, ExternalLink, Folder, Plus } from 'lucide-react';
|
||||||
|
|
||||||
export function AIAssistantPage() {
|
export function AIAssistantPage() {
|
||||||
const [activeSessionId, setActiveSessionId] = useState<string | null>(null);
|
const [activeSessionId, setActiveSessionId] = useState<string | null>(null);
|
||||||
@@ -67,6 +67,19 @@ export function AIAssistantPage() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'open-standalone',
|
||||||
|
plugin: 'ai_assistant',
|
||||||
|
label: 'In neuem Fenster',
|
||||||
|
type: 'button',
|
||||||
|
group: 'actions',
|
||||||
|
icon: (
|
||||||
|
<ExternalLink className="w-3.5 h-3.5" strokeWidth={2} />
|
||||||
|
),
|
||||||
|
onClick: () => {
|
||||||
|
window.open('/ai-assistant-standalone', '_blank', 'width=800,height=600');
|
||||||
|
},
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
return () => unregisterPlugin('ai_assistant');
|
return () => unregisterPlugin('ai_assistant');
|
||||||
}, [agents, selectedAgentId, registerItems, unregisterPlugin]);
|
}, [agents, selectedAgentId, registerItems, unregisterPlugin]);
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { AIAssistantPage } from './AIAssistant';
|
||||||
|
|
||||||
|
export function AIAssistantStandalonePage() {
|
||||||
|
return (
|
||||||
|
<div className="h-screen w-screen overflow-hidden bg-white">
|
||||||
|
<AIAssistantPage />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -36,6 +36,7 @@ const AISettingsPage = React.lazy(() => import('@/pages/AISettings').then(m => (
|
|||||||
const ProactiveAISettings = React.lazy(() => import('@/pages/ProactiveAISettings').then(m => ({ default: m.ProactiveAISettings })));
|
const ProactiveAISettings = React.lazy(() => import('@/pages/ProactiveAISettings').then(m => ({ default: m.ProactiveAISettings })));
|
||||||
const SettingsThemePage = React.lazy(() => import('@/pages/SettingsTheme').then(m => ({ default: m.SettingsThemePage })));
|
const SettingsThemePage = React.lazy(() => import('@/pages/SettingsTheme').then(m => ({ default: m.SettingsThemePage })));
|
||||||
const SettingsMcpPage = React.lazy(() => import('@/pages/SettingsMcp').then(m => ({ default: m.SettingsMcpPage })));
|
const SettingsMcpPage = React.lazy(() => import('@/pages/SettingsMcp').then(m => ({ default: m.SettingsMcpPage })));
|
||||||
|
const AIAssistantStandalonePage = React.lazy(() => import('@/pages/AIAssistantStandalone').then(m => ({ default: m.AIAssistantStandalonePage })));
|
||||||
const SettingsAIPage = React.lazy(() => import('@/pages/SettingsAI').then(m => ({ default: m.SettingsAIPage })));
|
const SettingsAIPage = React.lazy(() => import('@/pages/SettingsAI').then(m => ({ default: m.SettingsAIPage })));
|
||||||
const SettingsMenuOrderPage = React.lazy(() => import('@/pages/SettingsMenuOrder').then(m => ({ default: m.SettingsMenuOrderPage })));
|
const SettingsMenuOrderPage = React.lazy(() => import('@/pages/SettingsMenuOrder').then(m => ({ default: m.SettingsMenuOrderPage })));
|
||||||
const SettingsStammdatenPage = React.lazy(() => import('@/pages/SettingsStammdaten').then(m => ({ default: m.SettingsStammdatenPage })));
|
const SettingsStammdatenPage = React.lazy(() => import('@/pages/SettingsStammdaten').then(m => ({ default: m.SettingsStammdatenPage })));
|
||||||
@@ -65,6 +66,10 @@ const router = createBrowserRouter([
|
|||||||
path: '/login',
|
path: '/login',
|
||||||
element: <LoginPage />,
|
element: <LoginPage />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/ai-assistant-standalone',
|
||||||
|
element: withSuspense(<AIAssistantStandalonePage />),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/password-reset',
|
path: '/password-reset',
|
||||||
element: <PasswordResetRequestPage />,
|
element: <PasswordResetRequestPage />,
|
||||||
|
|||||||
Reference in New Issue
Block a user