|
|
|
|
|
|
|
|
return { data, loading }; |
|
|
return { data, loading }; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
export const useFetchTenantInfo = (): ResponseGetType<ITenantInfo> => { |
|
|
|
|
|
|
|
|
export const useFetchTenantInfo = ( |
|
|
|
|
|
showEmptyModelWarn = false, |
|
|
|
|
|
): ResponseGetType<ITenantInfo> => { |
|
|
const { t } = useTranslation(); |
|
|
const { t } = useTranslation(); |
|
|
const { data, isFetching: loading } = useQuery({ |
|
|
const { data, isFetching: loading } = useQuery({ |
|
|
queryKey: ['tenantInfo'], |
|
|
queryKey: ['tenantInfo'], |
|
|
|
|
|
|
|
|
// llm_id is chat_id |
|
|
// llm_id is chat_id |
|
|
// asr_id is speech2txt |
|
|
// asr_id is speech2txt |
|
|
const { data } = res; |
|
|
const { data } = res; |
|
|
if (isEmpty(data.embd_id) || isEmpty(data.llm_id)) { |
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
showEmptyModelWarn && |
|
|
|
|
|
(isEmpty(data.embd_id) || isEmpty(data.llm_id)) |
|
|
|
|
|
) { |
|
|
Modal.warning({ |
|
|
Modal.warning({ |
|
|
title: t('common.warn'), |
|
|
title: t('common.warn'), |
|
|
content: ( |
|
|
content: ( |
|
|
|
|
|
|
|
|
value: string; |
|
|
value: string; |
|
|
label: string; |
|
|
label: string; |
|
|
}> => { |
|
|
}> => { |
|
|
const { data: tenantInfo } = useFetchTenantInfo(); |
|
|
|
|
|
|
|
|
const { data: tenantInfo } = useFetchTenantInfo(true); |
|
|
|
|
|
|
|
|
const parserList = useMemo(() => { |
|
|
const parserList = useMemo(() => { |
|
|
const parserArray: Array<string> = tenantInfo?.parser_ids?.split(',') ?? []; |
|
|
const parserArray: Array<string> = tenantInfo?.parser_ids?.split(',') ?? []; |