feat: add AI Copilot Zustand store for managing product insights and analysis.

This commit is contained in:
Michael committed 2026-02-22 13:12:34 +01:00
1 parent c23f74d32d
commit 8767b1cf1e
1 file changed
+11 -3
@@ -1,6 +1,7 @@
"use client";
import { create } from "zustand";
import { persist } from "zustand/middleware";
interface AiInsight {
codein: string;
@@ -24,7 +25,9 @@ interface AiCopilotState {
}) => Promise<void>;
}
export const useAiCopilotStore = create<AiCopilotState>((set) => ({
export const useAiCopilotStore = create<AiCopilotState>()(
persist(
(set, get) => ({
insights: {},
setInsight: (codein, insight, isDuplicate = false) => {
@@ -37,7 +40,7 @@ export const useAiCopilotStore = create<AiCopilotState>((set) => ({
},
analyzeProduct: async (payload) => {
const { codein, score } = payload;
const { codein } = payload;
// Mark as loading
set((s) => ({
@@ -69,4 +72,9 @@ export const useAiCopilotStore = create<AiCopilotState>((set) => ({
}));
}
},
}));
}),
{
name: "collectflow-ai-storage",
}
)
);