feat: support show model display name (#887)

This commit is contained in:
Joel
2023-08-17 15:13:35 +08:00
committed by GitHub
parent f42e7d1a61
commit cd78adb0ab
5 changed files with 20 additions and 6 deletions

View File

@@ -9,6 +9,8 @@ import { Google, WebReader, Wikipedia } from '@/app/components/base/icons/src/pu
import ConfigDetail from '@/app/components/explore/universal-chat/config-view/detail'
import type { ProviderEnum } from '@/app/components/header/account-setting/model-page/declarations'
import ModelName from '@/app/components/app/configuration/config-model/model-name'
import { useProviderContext } from '@/context/provider-context'
export type ISummaryProps = {
modelId: string
providerName: ProviderEnum
@@ -46,6 +48,9 @@ const Summary: FC<ISummaryProps> = ({
plugins,
dataSets,
}) => {
const { agentThoughtModelList } = useProviderContext()
const currModel = agentThoughtModelList.find(item => item.model_name === modelId && item.model_provider.provider_name === providerName)
// current_datetime is not configable and do not have icon
const pluginIds = Object.keys(plugins).filter(key => plugins[key] && key !== 'current_datetime')
const [isShowConfig, { setFalse: hideConfig, toggle: toggleShowConfig }] = useBoolean(false)
@@ -58,7 +63,7 @@ const Summary: FC<ISummaryProps> = ({
<div ref={configContentRef} className='relative'>
<div onClick={toggleShowConfig} className={cn(getColorInfo(modelId), 'flex items-center px-1 h-8 rounded-lg border cursor-pointer')}>
<ModelIcon providerName={providerName} modelId={modelId} className='!w-6 !h-6' />
<div className='ml-2 text-[13px] font-medium text-gray-900'><ModelName modelId={modelId} /></div>
<div className='ml-2 text-[13px] font-medium text-gray-900'><ModelName modelId={modelId} modelDisplayName={currModel?.model_display_name} /></div>
{
pluginIds.length > 0 && (
<div className='ml-1.5 flex items-center'>