feat: Add Ask assistant behind feature flag (#9995)

Co-authored-by: Ricardo Espinoza <ricardo@n8n.io>
Co-authored-by: Milorad Filipovic <milorad@n8n.io>
This commit is contained in:
Mutasem Aldmour
2024-08-14 14:59:11 +02:00
committed by GitHub
parent e4c88e75f9
commit 5ed2a77740
70 changed files with 3414 additions and 60 deletions

View File

@@ -41,6 +41,7 @@ import { useWorkflowHelpers } from '@/composables/useWorkflowHelpers';
import { useI18n } from '@/composables/useI18n';
import { useTelemetry } from '@/composables/useTelemetry';
import type { PushMessageQueueItem } from '@/types';
import { useAssistantStore } from '@/stores/assistant.store';
export function usePushConnection({ router }: { router: ReturnType<typeof useRouter> }) {
const workflowHelpers = useWorkflowHelpers({ router });
@@ -57,6 +58,7 @@ export function usePushConnection({ router }: { router: ReturnType<typeof useRou
const settingsStore = useSettingsStore();
const uiStore = useUIStore();
const workflowsStore = useWorkflowsStore();
const assistantStore = useAssistantStore();
const retryTimeout = ref<NodeJS.Timeout | null>(null);
const pushMessageQueue = ref<PushMessageQueueItem[]>([]);
@@ -535,6 +537,7 @@ export function usePushConnection({ router }: { router: ReturnType<typeof useRou
const pushData = receivedData.data;
workflowsStore.addNodeExecutionData(pushData);
workflowsStore.removeExecutingNode(pushData.nodeName);
void assistantStore.onNodeExecution(pushData);
} else if (receivedData.type === 'nodeExecuteBefore') {
// A node started to be executed. Set it as executing.
const pushData = receivedData.data;

View File

@@ -20,6 +20,10 @@ export interface NotificationErrorWithNodeAndDescription extends ApplicationErro
const messageDefaults: Partial<Omit<NotificationOptions, 'message'>> = {
dangerouslyUseHTMLString: false,
position: 'bottom-right',
zIndex: 3000, // above NDV and chat window
offset: 64,
appendTo: '#node-view-root',
customClass: 'content-toast',
};
const stickyNotificationQueue: NotificationHandle[] = [];
@@ -154,7 +158,9 @@ export function useToast() {
}
function showAlert(config: NotificationOptions): NotificationHandle {
return Notification(config);
return Notification({
...config,
});
}
function causedByCredential(message: string | undefined) {