Skip to content

Commit

Permalink
hotfix: using custom models, create custom provider
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydzhou authored and sijinhui committed Jul 17, 2024
1 parent ffddf93 commit 2cfdf34
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions app/utils/model.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DEFAULT_MODELS } from "../constant";
import { LLMModel } from "../client/api";

const customProvider = (modelName: string) => ({
id: modelName,
providerName: "Custom",
const customProvider = (providerName: string) => ({
id: providerName.toLowerCase(),
providerName: providerName,
providerType: "custom",
});

Expand Down Expand Up @@ -72,10 +72,13 @@ export function collectModelTable(
}
// 2. if model not exists, create new model with available value
if (count === 0) {
const provider = customProvider(name);
modelTable[`${name}@${provider?.id}`] = {
name,
displayName: displayName || name,
const [customModelName, customProviderName] = name.split("@");
const provider = customProvider(
customProviderName || customModelName,
);
modelTable[`${customModelName}@${provider?.id}`] = {
name: customModelName,
displayName: displayName || customModelName,
available,
describe: "",
provider, // Use optional chaining
Expand Down

0 comments on commit 2cfdf34

Please sign in to comment.