refactor add modal

This commit is contained in:
n4ze3m
2024-10-13 16:10:52 +05:30
parent 405adc0d31
commit d83ba79035
5 changed files with 82 additions and 71 deletions

View File

@@ -10,6 +10,7 @@ type Model = {
name: string
provider_id: string
lookup: string
model_type: string
db_type: string
}
export const generateID = () => {
@@ -140,7 +141,8 @@ export const createManyModels = async (
lookup: `${item.model_id}_${item.provider_id}`,
id: `${item.model_id}_${generateID()}`,
db_type: "openai_model",
name: item.name.replaceAll(/accounts\/[^\/]+\/models\//g, "")
name: item.name.replaceAll(/accounts\/[^\/]+\/models\//g, ""),
model_type: "chat"
}
})
@@ -168,7 +170,8 @@ export const createModel = async (
name,
provider_id,
lookup: `${model_id}_${provider_id}`,
db_type: "openai_model"
db_type: "openai_model",
model_type: "chat"
}
await db.create(model)
return model