Skip to content

Commit

Permalink
Fix: New user can't accept invite without configuring LLM API #4379 (#…
Browse files Browse the repository at this point in the history
…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)
  • Loading branch information
cike8899 authored Feb 6, 2025
1 parent 2a07eb6 commit c1d71e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion web/src/hooks/logic-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ export const useSelectItem = (defaultId?: string) => {
};

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

return tenantInfo?.llm_id ?? '';
};
Expand Down
11 changes: 8 additions & 3 deletions web/src/hooks/user-setting-hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ export const useFetchUserInfo = (): ResponseGetType<IUserInfo> => {
return { data, loading };
};

export const useFetchTenantInfo = (): ResponseGetType<ITenantInfo> => {
export const useFetchTenantInfo = (
showEmptyModelWarn = false,
): ResponseGetType<ITenantInfo> => {
const { t } = useTranslation();
const { data, isFetching: loading } = useQuery({
queryKey: ['tenantInfo'],
Expand All @@ -58,7 +60,10 @@ export const useFetchTenantInfo = (): ResponseGetType<ITenantInfo> => {
// llm_id is chat_id
// asr_id is speech2txt
const { data } = res;
if (isEmpty(data.embd_id) || isEmpty(data.llm_id)) {
if (
showEmptyModelWarn &&
(isEmpty(data.embd_id) || isEmpty(data.llm_id))
) {
Modal.warning({
title: t('common.warn'),
content: (
Expand Down Expand Up @@ -90,7 +95,7 @@ export const useSelectParserList = (): Array<{
value: string;
label: string;
}> => {
const { data: tenantInfo } = useFetchTenantInfo();
const { data: tenantInfo } = useFetchTenantInfo(true);

const parserList = useMemo(() => {
const parserArray: Array<string> = tenantInfo?.parser_ids?.split(',') ?? [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import styles from './index.less';

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

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

0 comments on commit c1d71e9

Please sign in to comment.