summaryrefslogtreecommitdiff
path: root/extension/react-app/src/redux/store.ts
blob: b6eb55b3c57576a92c013235e7d6af4c2b0d8802 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { configureStore } from "@reduxjs/toolkit";
import debugStateReducer from "./slices/debugContexSlice";
import chatReducer from "./slices/chatSlice";
import configReducer from "./slices/configSlice";
import miscReducer from "./slices/miscSlice";
import { RangeInFile, SerializedDebugContext } from "../../../src/client";

export interface ChatMessage {
  role: "system" | "user" | "assistant";
  content: string;
}

export interface RootStore {
  debugState: {
    debugContext: SerializedDebugContext;
    rangesMask: boolean[];
  };
  config: {
    workspacePath: string | undefined;
    apiUrl: string;
    vscMachineId: string | undefined;
    sessionId: string | undefined;
    sessionStarted: number | undefined;
    vscMediaUrl: string | undefined;
    dataSwitchOn: boolean | undefined;
  };
  chat: {
    messages: ChatMessage[];
    isStreaming: boolean;
  };
  misc: {
    highlightedCode: RangeInFile | undefined;
  };
}

const store = configureStore({
  reducer: {
    debugState: debugStateReducer,
    chat: chatReducer,
    config: configReducer,
    misc: miscReducer,
  },
});

export default store;