From 3554872d9a1394d04cfe6990f6842ff7c1ca6f3b Mon Sep 17 00:00:00 2001 From: Leo Li Date: Thu, 25 Jan 2024 15:09:48 -0500 Subject: [PATCH 1/6] Add gpt-4-0125-preview --- app/constant.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/constant.ts b/app/constant.ts index 53d47540ac6..af64c92dc9c 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -108,6 +108,7 @@ export const SUMMARIZE_MODEL = "gpt-3.5-turbo"; export const KnowledgeCutOffDate: Record = { default: "2021-09", "gpt-4-1106-preview": "2023-04", + "gpt-4-0125-preview": "2023-04", "gpt-4-vision-preview": "2023-04", }; @@ -175,6 +176,15 @@ export const DEFAULT_MODELS = [ providerType: "openai", }, }, + { + name: "gpt-4-0125-preview", + available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, + }, { name: "gpt-4-vision-preview", available: true, From 6319f41b2cc22148b1d63bbc0dcc73d33dca8709 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 10 Apr 2024 05:18:39 -0400 Subject: [PATCH 2/6] add new turbo --- app/constant.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/constant.ts b/app/constant.ts index 1ad76870f45..6de3b66ed92 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -127,6 +127,7 @@ export const GEMINI_SUMMARIZE_MODEL = "gemini-pro"; export const KnowledgeCutOffDate: Record = { default: "2021-09", + "gpt-4-turbo": "2023-12", "gpt-4-turbo-preview": "2023-12", "gpt-4-1106-preview": "2023-04", "gpt-4-0125-preview": "2023-12", @@ -191,6 +192,24 @@ export const DEFAULT_MODELS = [ providerType: "openai", }, }, + { + name: "gpt-4-turbo", + available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, + }, + { + name: "gpt-4-turbo-2024-04-09", + available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, + }, { name: "gpt-4-turbo-preview", available: true, From f101ee3c4f24396a4c091947a0f65bb44f0404a4 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 10 Apr 2024 05:33:54 -0400 Subject: [PATCH 3/6] support new vision models --- app/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/utils.ts b/app/utils.ts index 2745f5ca2db..b3155697738 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -290,8 +290,8 @@ export function getMessageImages(message: RequestMessage): string[] { } export function isVisionModel(model: string) { - // Note: This is a better way using the TypeScript feature instead of `&&` or `||` (ts v5.5.0-dev.20240314 I've been using) const visionKeywords = ["vision", "claude-3"]; + const isGpt4Turbo = model.includes("gpt-4-turbo") && !model.includes("preview"); - return visionKeywords.some((keyword) => model.includes(keyword)); + return visionKeywords.some((keyword) => model.includes(keyword)) || isGpt4Turbo; } From ee15c140499ca222bd1f5d08526de9f251c89374 Mon Sep 17 00:00:00 2001 From: butterfly Date: Fri, 12 Apr 2024 13:40:37 +0800 Subject: [PATCH 4/6] =?UTF-8?q?feat:=20fix=20webdav=20=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/webdav/[...path]/route.ts | 21 +++++++++++++++------ app/store/sync.ts | 1 + app/utils/cloud/webdav.ts | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/api/webdav/[...path]/route.ts b/app/api/webdav/[...path]/route.ts index f64a9ef1354..b0083fd692d 100644 --- a/app/api/webdav/[...path]/route.ts +++ b/app/api/webdav/[...path]/route.ts @@ -42,7 +42,7 @@ async function handle( } const endpointPath = params.path.join("/"); - const targetPath = `${endpoint}/${endpointPath}`; + const targetPath = `${endpoint}${endpointPath}`; // only allow MKCOL, GET, PUT if (req.method !== "MKCOL" && req.method !== "GET" && req.method !== "PUT") { @@ -96,7 +96,7 @@ async function handle( ); } - const targetUrl = `${endpoint}/${endpointPath}`; + const targetUrl = targetPath; const method = req.method; const shouldNotHaveBody = ["get", "head"].includes( @@ -114,13 +114,22 @@ async function handle( duplex: "half", }; - const fetchResult = await fetch(targetUrl, fetchOptions); - console.log("[Any Proxy]", targetUrl, { - status: fetchResult.status, - statusText: fetchResult.statusText, + method: req.method, + params: req.body, }); + let fetchResult; + + try { + fetchResult = await fetch(targetUrl, fetchOptions); + } finally { + console.log("[Any Proxy]", targetUrl, { + status: fetchResult?.status, + statusText: fetchResult?.statusText, + }); + } + return fetchResult; } diff --git a/app/store/sync.ts b/app/store/sync.ts index 674ff674420..8ee6c1819f4 100644 --- a/app/store/sync.ts +++ b/app/store/sync.ts @@ -104,6 +104,7 @@ export const useSyncStore = createPersistStore( setLocalAppState(localState); } catch (e) { console.log("[Sync] failed to get remote state", e); + throw e; } await client.set(config.username, JSON.stringify(localState)); diff --git a/app/utils/cloud/webdav.ts b/app/utils/cloud/webdav.ts index e01c193fea2..71d452b4af1 100644 --- a/app/utils/cloud/webdav.ts +++ b/app/utils/cloud/webdav.ts @@ -76,7 +76,7 @@ export function createWebDavClient(store: SyncStore) { let url; if (proxyUrl.length > 0 || proxyUrl === "/") { - let u = new URL(proxyUrl + "/api/webdav/" + path); + let u = new URL(proxyUrl + "api/webdav/" + path); // add query params u.searchParams.append("endpoint", config.endpoint); url = u.toString(); From b72d7fbeda8fa9cb8f020b1dea6188075a92a3bf Mon Sep 17 00:00:00 2001 From: butterfly Date: Fri, 12 Apr 2024 13:46:37 +0800 Subject: [PATCH 5/6] =?UTF-8?q?feat:=20fix=20webdav=20=E9=80=BB=E8=BE=912?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/webdav/[...path]/route.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/api/webdav/[...path]/route.ts b/app/api/webdav/[...path]/route.ts index b0083fd692d..3dd9ca3cda8 100644 --- a/app/api/webdav/[...path]/route.ts +++ b/app/api/webdav/[...path]/route.ts @@ -114,20 +114,22 @@ async function handle( duplex: "half", }; - console.log("[Any Proxy]", targetUrl, { - method: req.method, - params: req.body, - }); - let fetchResult; try { fetchResult = await fetch(targetUrl, fetchOptions); } finally { - console.log("[Any Proxy]", targetUrl, { - status: fetchResult?.status, - statusText: fetchResult?.statusText, - }); + console.log( + "[Any Proxy]", + targetUrl, + { + method: req.method, + }, + { + status: fetchResult?.status, + statusText: fetchResult?.statusText, + }, + ); } return fetchResult; From 55d70143018d6b285c1d7ae57fd16ceb27f815a2 Mon Sep 17 00:00:00 2001 From: butterfly Date: Fri, 12 Apr 2024 14:02:05 +0800 Subject: [PATCH 6/6] feat: fix the logtics of client joining webdav url --- app/utils/cloud/webdav.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/utils/cloud/webdav.ts b/app/utils/cloud/webdav.ts index 71d452b4af1..f7d48dd0393 100644 --- a/app/utils/cloud/webdav.ts +++ b/app/utils/cloud/webdav.ts @@ -63,9 +63,9 @@ export function createWebDavClient(store: SyncStore) { }; }, path(path: string, proxyUrl: string = "") { - if (!path.endsWith("/")) { - path += "/"; - } + // if (!path.endsWith("/")) { + // path += "/"; + // } if (path.startsWith("/")) { path = path.slice(1); }