forked from XiaoMo/ChatGPT-Next-Web
fix: #2280 auto-detect models from 'list/models'
This commit is contained in:
parent
9b61fe9df2
commit
28c457730a
@ -257,12 +257,14 @@ export class ChatGPTApi implements LLMApi {
|
|||||||
const chatModels = resJson.data?.filter((m) => m.id.startsWith("gpt-"));
|
const chatModels = resJson.data?.filter((m) => m.id.startsWith("gpt-"));
|
||||||
console.log("[Models]", chatModels);
|
console.log("[Models]", chatModels);
|
||||||
|
|
||||||
return (
|
if (!chatModels) {
|
||||||
chatModels?.map((m) => ({
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return chatModels.map((m) => ({
|
||||||
name: m.id,
|
name: m.id,
|
||||||
available: true,
|
available: true,
|
||||||
})) || []
|
}));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export { OpenaiPath };
|
export { OpenaiPath };
|
||||||
|
@ -117,6 +117,10 @@ export const useAppConfig = create<ChatConfigStore>()(
|
|||||||
},
|
},
|
||||||
|
|
||||||
mergeModels(newModels) {
|
mergeModels(newModels) {
|
||||||
|
if (!newModels || newModels.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const oldModels = get().models;
|
const oldModels = get().models;
|
||||||
const modelMap: Record<string, LLMModel> = {};
|
const modelMap: Record<string, LLMModel> = {};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user