mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-10 11:13:42 +08:00
feat: chat panel redesigned ui
This commit is contained in:
25
app/hooks/useLoadData.ts
Normal file
25
app/hooks/useLoadData.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { useEffect } from "react";
|
||||
import { useAppConfig } from "@/app/store/config";
|
||||
import { ClientApi } from "@/app/client/api";
|
||||
import { ModelProvider } from "@/app/constant";
|
||||
import { identifyDefaultClaudeModel } from "@/app/utils/checkers";
|
||||
|
||||
export function useLoadData() {
|
||||
const config = useAppConfig();
|
||||
|
||||
var api: ClientApi;
|
||||
if (config.modelConfig.model.startsWith("gemini")) {
|
||||
api = new ClientApi(ModelProvider.GeminiPro);
|
||||
} else if (identifyDefaultClaudeModel(config.modelConfig.model)) {
|
||||
api = new ClientApi(ModelProvider.Claude);
|
||||
} else {
|
||||
api = new ClientApi(ModelProvider.GPT);
|
||||
}
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const models = await api.llm.models();
|
||||
config.mergeModels(models);
|
||||
})();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
}
|
||||
Reference in New Issue
Block a user