Browse Source

Feat: Hide the suffix of the large model name. #5433 (#5494)

### What problem does this PR solve?

Feat: Hide the suffix of the large model name. #5433

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
tags/v0.17.0
balibabu 8 months ago
parent
commit
7600ebd263
No account linked to committer's email address
2 changed files with 9 additions and 3 deletions
  1. 4
    3
      web/src/hooks/llm-hooks.tsx
  2. 5
    0
      web/src/utils/llm-util.ts

+ 4
- 3
web/src/hooks/llm-hooks.tsx View File

} from '@/interfaces/request/llm'; } from '@/interfaces/request/llm';
import userService from '@/services/user-service'; import userService from '@/services/user-service';
import { sortLLmFactoryListBySpecifiedOrder } from '@/utils/common-util'; import { sortLLmFactoryListBySpecifiedOrder } from '@/utils/common-util';
import { getLLMIconName } from '@/utils/llm-util';
import { getLLMIconName, getRealModelName } from '@/utils/llm-util';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { Flex, message } from 'antd'; import { Flex, message } from 'antd';
import { DefaultOptionType } from 'antd/es/select'; import { DefaultOptionType } from 'antd/es/select';
return { return {
label: key, label: key,
options: value.map((x) => ({ options: value.map((x) => ({
label: x.llm_name,
label: getRealModelName(x.llm_name),
value: `${x.llm_name}@${x.fid}`, value: `${x.llm_name}@${x.fid}`,
disabled: !x.available, disabled: !x.available,
})), })),
height={26} height={26}
size={'small'} size={'small'}
/> />
<span>{x.llm_name}</span>
<span>{getRealModelName(x.llm_name)}</span>
</Flex> </Flex>
), ),
value: `${x.llm_name}@${x.fid}`, value: `${x.llm_name}@${x.fid}`,
name: key, name: key,
logo: factoryList.find((x) => x.name === key)?.logo ?? '', logo: factoryList.find((x) => x.name === key)?.logo ?? '',
...value, ...value,
llm: value.llm.map((x) => ({ ...x, name: getRealModelName(x.name) })),
})); }));
}, [myLlmList, factoryList]); }, [myLlmList, factoryList]);



+ 5
- 0
web/src/utils/llm-util.ts View File



return { fId, llmName }; return { fId, llmName };
}; };

// The names of the large models returned by the interface are similar to "deepseek-r1___OpenAI-API"
export function getRealModelName(llmName: string) {
return llmName.split('__').at(0) ?? '';
}

Loading…
Cancel
Save