mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-20 13:38:08 +02:00
feat: Add AI Copilot Zustand store for managing and persisting product insights.
This commit is contained in:
1 parent
86df5d6f29
commit
99954fb001
2 files changed
+26
-10
No files matched your search
@@ -13,6 +13,7 @@ interface AiInsight {
|
||||
interface AiCopilotState {
|
||||
insights: Record<string, AiInsight>;
|
||||
setInsight: (codein: string, insight: string, isDuplicate?: boolean) => void;
|
||||
batchSetInsights: (entries: { codein: string; insight: string }[]) => void;
|
||||
setLoading: (codein: string) => void;
|
||||
batchSetLoading: (codeins: string[]) => void;
|
||||
setError: (codein: string, error: string) => void;
|
||||
@@ -76,6 +77,16 @@ export const useAiCopilotStore = create<AiCopilotState>()(
|
||||
}));
|
||||
},
|
||||
|
||||
batchSetInsights: (entries) => {
|
||||
set((s) => {
|
||||
const nextInsights = { ...s.insights };
|
||||
entries.forEach(({ codein, insight }) => {
|
||||
nextInsights[codein] = { codein, insight, status: "done" };
|
||||
});
|
||||
return { insights: nextInsights };
|
||||
});
|
||||
},
|
||||
|
||||
setLoading: (codein) => {
|
||||
set((s) => ({
|
||||
insights: {
|
||||
|
||||
Reference in new issue
Block a user