feat: add multi-model support

This commit is contained in:
Yidadaa
2023-09-26 00:19:21 +08:00
parent b90dfb48ee
commit 5610f423d0
62 changed files with 1439 additions and 940 deletions

View File

@@ -1,5 +1,6 @@
import { createWebDavClient } from "./webdav";
import { createUpstashClient } from "./upstash";
import { SyncStore } from "@/app/store/sync";
export enum ProviderType {
WebDAV = "webdav",
@@ -27,7 +28,7 @@ export type SyncClient = {
export function createSyncClient<T extends ProviderType>(
provider: T,
config: SyncClientConfig[T],
store: SyncStore,
): SyncClient {
return SyncClients[provider](config as any) as any;
return SyncClients[provider](store);
}

View File

@@ -57,7 +57,7 @@ export function createUpstashClient(store: SyncStore) {
async get() {
const chunkCount = Number(await this.redisGet(chunkCountKey));
if (!Number.isInteger(chunkCount)) return;
if (!Number.isInteger(chunkCount)) return "";
const chunks = await Promise.all(
new Array(chunkCount)