mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-11 17:26:32 +02:00
feat: add AI Copilot Zustand store for managing product insights and analysis.
This commit is contained in:
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",
|
||||
}
|
||||
)
|
||||
);
|
||||
Reference in new issue
Block a user