feat: Solve the problem of using openai interface protocol for user-defined claude model & add some famous webdav endpoints

This commit is contained in:
butterfly
2024-04-09 20:49:51 +08:00
parent 908ce3bbd9
commit 79f342439a
6 changed files with 49 additions and 7 deletions

View File

@@ -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
};
}
});