hooks.ts 505 B

12345678910111213141516
  1. import { useMemo } from "react";
  2. import { useAccessStore, useAppConfig } from "../store";
  3. import { collectModels } from "./model";
  4. export function useAllModels() {
  5. const accessStore = useAccessStore();
  6. const configStore = useAppConfig();
  7. const models = useMemo(() => {
  8. return collectModels(
  9. configStore.models,
  10. [configStore.customModels, accessStore.customModels].join(","),
  11. );
  12. }, [accessStore.customModels, configStore.customModels, configStore.models]);
  13. return models;
  14. }