浏览代码

Fix: New user can't accept invite without configuring LLM API #4379 (#4736)

### What problem does this PR solve?

Fix: New user can't accept invite without configuring LLM API #4379

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.16.0
balibabu 9 个月前
父节点
当前提交
c1d71e9a3f
没有帐户链接到提交者的电子邮件

+ 1
- 1
web/src/hooks/logic-hooks.ts 查看文件

}; };


export const useFetchModelId = () => { export const useFetchModelId = () => {
const { data: tenantInfo } = useFetchTenantInfo();
const { data: tenantInfo } = useFetchTenantInfo(true);


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

+ 8
- 3
web/src/hooks/user-setting-hooks.tsx 查看文件

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(',') ?? [];

+ 1
- 1
web/src/pages/chat/chat-configuration-modal/assistant-setting.tsx 查看文件



const AssistantSetting = ({ show, form }: ISegmentedContentProps) => { const AssistantSetting = ({ show, form }: ISegmentedContentProps) => {
const { t } = useTranslate('chat'); const { t } = useTranslate('chat');
const { data } = useFetchTenantInfo();
const { data } = useFetchTenantInfo(true);


const normFile = (e: any) => { const normFile = (e: any) => {
if (Array.isArray(e)) { if (Array.isArray(e)) {

正在加载...
取消
保存