diff --git a/app/components/exporter.tsx b/app/components/exporter.tsx
index f3f085721547..20e240d93b0d 100644
--- a/app/components/exporter.tsx
+++ b/app/components/exporter.tsx
@@ -40,6 +40,7 @@ import { EXPORT_MESSAGE_CLASS_NAME, ModelProvider } from "../constant";
import { getClientConfig } from "../config/client";
import { ClientApi } from "../client/api";
import { getMessageTextContent } from "../utils";
+import { identifyDefaultClaudeModel } from "../utils/checkers";
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
loading: () => ,
@@ -315,7 +316,7 @@ export function PreviewActions(props: {
var api: ClientApi;
if (config.modelConfig.model.startsWith("gemini")) {
api = new ClientApi(ModelProvider.GeminiPro);
- } else if (config.modelConfig.model.startsWith("claude")) {
+ } else if (identifyDefaultClaudeModel(config.modelConfig.model)) {
api = new ClientApi(ModelProvider.Claude);
} else {
api = new ClientApi(ModelProvider.GPT);
diff --git a/app/components/home.tsx b/app/components/home.tsx
index 26bb3a44c199..ffac64fdac0c 100644
--- a/app/components/home.tsx
+++ b/app/components/home.tsx
@@ -29,6 +29,7 @@ import { AuthPage } from "./auth";
import { getClientConfig } from "../config/client";
import { ClientApi } from "../client/api";
import { useAccessStore } from "../store";
+import { identifyDefaultClaudeModel } from "../utils/checkers";
export function Loading(props: { noLogo?: boolean }) {
return (
@@ -173,7 +174,7 @@ export function useLoadData() {
var api: ClientApi;
if (config.modelConfig.model.startsWith("gemini")) {
api = new ClientApi(ModelProvider.GeminiPro);
- } else if (config.modelConfig.model.startsWith("claude")) {
+ } else if (identifyDefaultClaudeModel(config.modelConfig.model)) {
api = new ClientApi(ModelProvider.Claude);
} else {
api = new ClientApi(ModelProvider.GPT);
diff --git a/app/constant.ts b/app/constant.ts
index ce9b08d14297..1ad76870f45c 100644
--- a/app/constant.ts
+++ b/app/constant.ts
@@ -367,4 +367,14 @@ export const DEFAULT_MODELS = [
export const CHAT_PAGE_SIZE = 15;
export const MAX_RENDER_MSG_COUNT = 45;
-export const internalWhiteWebDavEndpoints = ["https://dav.jianguoyun.com"];
+// some famous webdav endpoints
+export const internalWhiteWebDavEndpoints = [
+ "https://dav.jianguoyun.com/dav/",
+ "https://dav.dropdav.com/",
+ "https://dav.box.com/dav",
+ "https://nanao.teracloud.jp/dav/",
+ "https://webdav.4shared.com/",
+ "https://dav.idrivesync.com",
+ "https://webdav.yandex.com",
+ "https://app.koofr.net/dav/Koofr",
+];
diff --git a/app/layout.tsx b/app/layout.tsx
index 2c89ba4944e4..5898b21a1fa3 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -36,6 +36,7 @@ export default function RootLayout({
+
diff --git a/app/store/chat.ts b/app/store/chat.ts
index 53ec11dbf6bb..eeddd8463f94 100644
--- a/app/store/chat.ts
+++ b/app/store/chat.ts
@@ -20,6 +20,7 @@ import { prettyObject } from "../utils/format";
import { estimateTokenLength } from "../utils/token";
import { nanoid } from "nanoid";
import { createPersistStore } from "../utils/store";
+import { identifyDefaultClaudeModel } from "../utils/checkers";
export type ChatMessage = RequestMessage & {
date: string;
@@ -353,7 +354,7 @@ export const useChatStore = createPersistStore(
var api: ClientApi;
if (modelConfig.model.startsWith("gemini")) {
api = new ClientApi(ModelProvider.GeminiPro);
- } else if (modelConfig.model.startsWith("claude")) {
+ } else if (identifyDefaultClaudeModel(modelConfig.model)) {
api = new ClientApi(ModelProvider.Claude);
} else {
api = new ClientApi(ModelProvider.GPT);
@@ -539,7 +540,7 @@ export const useChatStore = createPersistStore(
var api: ClientApi;
if (modelConfig.model.startsWith("gemini")) {
api = new ClientApi(ModelProvider.GeminiPro);
- } else if (modelConfig.model.startsWith("claude")) {
+ } else if (identifyDefaultClaudeModel(modelConfig.model)) {
api = new ClientApi(ModelProvider.Claude);
} else {
api = new ClientApi(ModelProvider.GPT);
diff --git a/app/utils/checkers.ts b/app/utils/checkers.ts
new file mode 100644
index 000000000000..4496e1039fc5
--- /dev/null
+++ b/app/utils/checkers.ts
@@ -0,0 +1,21 @@
+import { useAccessStore } from "../store/access";
+import { useAppConfig } from "../store/config";
+import { collectModels } from "./model";
+
+export function identifyDefaultClaudeModel(modelName: string) {
+ const accessStore = useAccessStore.getState();
+ const configStore = useAppConfig.getState();
+
+ const allModals = collectModels(
+ configStore.models,
+ [configStore.customModels, accessStore.customModels].join(","),
+ );
+
+ const modelMeta = allModals.find((m) => m.name === modelName);
+
+ return (
+ modelName.startsWith("claude") &&
+ modelMeta &&
+ modelMeta.provider?.providerType === "anthropic"
+ );
+}
diff --git a/app/utils/model.ts b/app/utils/model.ts
index b2a42ef022ad..378fc498e5fa 100644
--- a/app/utils/model.ts
+++ b/app/utils/model.ts
@@ -22,6 +22,12 @@ export function collectModelTable(
};
});
+ const customProvider = (modelName: string) => ({
+ id: modelName,
+ providerName: "",
+ providerType: "custom",
+ });
+
// server custom models
customModels
.split(",")
@@ -34,13 +40,15 @@ export function collectModelTable(
// enable or disable all models
if (name === "all") {
- Object.values(modelTable).forEach((model) => (model.available = available));
+ Object.values(modelTable).forEach(
+ (model) => (model.available = available),
+ );
} else {
modelTable[name] = {
name,
displayName: displayName || name,
available,
- provider: modelTable[name]?.provider, // Use optional chaining
+ provider: modelTable[name]?.provider ?? customProvider(name), // Use optional chaining
};
}
});