File size: 682 Bytes
d594e0f
4086c42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d594e0f
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { useFetchLlmList } from '@/hooks/llmHooks';
import {
  useFetchTenantInfo,
  useSelectTenantInfo,
} from '@/hooks/userSettingHook';
import { useEffect } from 'react';

export const useFetchModelId = (visible: boolean) => {
  const fetchTenantInfo = useFetchTenantInfo(false);
  const tenantInfo = useSelectTenantInfo();

  useEffect(() => {
    if (visible) {
      fetchTenantInfo();
    }
  }, [visible, fetchTenantInfo]);

  return tenantInfo?.llm_id ?? '';
};

export const useFetchLlmModelOnVisible = (visible: boolean) => {
  const fetchLlmList = useFetchLlmList();

  useEffect(() => {
    if (visible) {
      fetchLlmList();
    }
  }, [fetchLlmList, visible]);
};