mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-26 20:02:26 -08:00
20 lines
679 B
TypeScript
20 lines
679 B
TypeScript
|
import { defineStore } from 'pinia';
|
||
|
import * as aiApi from '@/api/ai';
|
||
|
import type { DebugErrorPayload } from '@/api/ai';
|
||
|
import { useRootStore } from '@/stores/n8nRoot.store';
|
||
|
import { useSettingsStore } from '@/stores/settings.store';
|
||
|
import { computed } from 'vue';
|
||
|
|
||
|
export const useAIStore = defineStore('ai', () => {
|
||
|
const rootStore = useRootStore();
|
||
|
const settingsStore = useSettingsStore();
|
||
|
|
||
|
const isErrorDebuggingEnabled = computed(() => settingsStore.settings.ai.errorDebugging);
|
||
|
|
||
|
async function debugError(payload: DebugErrorPayload) {
|
||
|
return await aiApi.debugError(rootStore.getRestApiContext, payload);
|
||
|
}
|
||
|
|
||
|
return { isErrorDebuggingEnabled, debugError };
|
||
|
});
|