Migrate Copilot local persistence (toggle and prompt history) to new local storage infrastructure (#1948)

* Migrate copilot persistence to AppState

* Migrate persistence of toggle and history to new infra

* Save toggle value as boolean

* Fix compile bug

* Fix unit tests
This commit is contained in:
Laurent Nguyen
2024-09-13 12:01:14 +02:00
committed by GitHub
parent d7647b2ecf
commit 91649d2f52
11 changed files with 207 additions and 70 deletions

View File

@@ -1,7 +1,11 @@
import { LocalStorageUtility, StorageKey } from "Shared/StorageUtility";
// The component name whose state is being saved. Component name must not include special characters.
export type ComponentName = "DocumentsTab";
export enum AppStateComponentNames {
DocumentsTab = "DocumentsTab",
QueryCopilot = "QueryCopilot",
}
export const PATH_SEPARATOR = "/"; // export for testing purposes
const SCHEMA_VERSION = 1;
@@ -14,8 +18,9 @@ export interface StateData {
data: unknown;
}
type StorePath = {
componentName: string;
// Export for testing purposes
export type StorePath = {
componentName: AppStateComponentNames;
subComponentName?: string;
globalAccountName?: string;
databaseName?: string;