feat: Add credential help to Assistant (no-changelog) (#10736)

This commit is contained in:
Mutasem Aldmour
2024-09-11 16:38:39 +02:00
committed by GitHub
parent 50459bacab
commit 2bc983ba32
11 changed files with 284 additions and 80 deletions

View File

@@ -7,19 +7,16 @@ import { useI18n } from '@/composables/useI18n';
import { useUIStore } from '@/stores/ui.store';
import type { ChatRequest } from '@/types/assistant.types';
import { useAssistantStore } from '@/stores/assistant.store';
import { useTelemetry } from '@/composables/useTelemetry';
import { useWorkflowsStore } from '@/stores/workflows.store';
import type { ICredentialType } from 'n8n-workflow';
const i18n = useI18n();
const uiStore = useUIStore();
const assistantStore = useAssistantStore();
const workflowsStore = useWorkflowsStore();
const telemetry = useTelemetry();
const props = defineProps<{
name: string;
data: {
context: ChatRequest.ErrorContext;
context: { errorHelp: ChatRequest.ErrorContext } | { credHelp: { credType: ICredentialType } };
};
}>();
@@ -28,16 +25,16 @@ const close = () => {
};
const startNewSession = async () => {
await assistantStore.initErrorHelper(props.data.context);
telemetry.track('User opened assistant', {
source: 'error',
task: 'error',
has_existing_session: true,
workflow_id: workflowsStore.workflowId,
node_type: props.data.context.node.type,
error: props.data.context.error,
chat_session_id: assistantStore.currentSessionId,
});
if ('errorHelp' in props.data.context) {
await assistantStore.initErrorHelper(props.data.context.errorHelp);
assistantStore.trackUserOpenedAssistant({
source: 'error',
task: 'error',
has_existing_session: true,
});
} else if ('credHelp' in props.data.context) {
await assistantStore.initCredHelp(props.data.context.credHelp.credType);
}
close();
};
</script>