feat: close #3187 use CUSTOM_MODELS to control model list

This commit is contained in:
Yidadaa
2023-11-09 03:01:29 +08:00
parent fbc0236748
commit d93f05f511
11 changed files with 112 additions and 42 deletions

16
app/utils/hooks.ts Normal file
View File

@@ -0,0 +1,16 @@
import { useMemo } from "react";
import { useAccessStore, useAppConfig } from "../store";
import { collectModels } from "./model";
export function useAllModels() {
const accessStore = useAccessStore();
const configStore = useAppConfig();
const models = useMemo(() => {
return collectModels(
configStore.models,
[accessStore.customModels, configStore.customModels].join(","),
);
}, [accessStore.customModels, configStore.customModels, configStore.models]);
return models;
}