feat(openAiProvider): use find instead of filter

This commit is contained in:
ItzCrazyKns
2025-10-14 13:05:56 +05:30
parent a375de73cc
commit c02e535f4c

View File

@@ -148,7 +148,7 @@ class OpenAIProvider extends BaseModelProvider<OpenAIConfig> {
async loadChatModel(key: string): Promise<BaseChatModel> {
const modelList = await this.getModelList();
const exists = modelList.chat.filter((m) => m.key === key);
const exists = modelList.chat.find((m) => m.key === key);
if (!exists) {
throw new Error(
@@ -168,8 +168,7 @@ class OpenAIProvider extends BaseModelProvider<OpenAIConfig> {
async loadEmbeddingModel(key: string): Promise<Embeddings> {
const modelList = await this.getModelList();
const exists = modelList.chat.filter((m) => m.key === key);
const exists = modelList.embedding.find((m) => m.key === key);
if (!exists) {
throw new Error(