fix(web): user profile

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
zhaoying
2026-04-23 00:07:29 +08:00
parent 52bccfaede
commit 9480a61229
2 changed files with 12 additions and 5 deletions

View File

@@ -31,6 +31,13 @@ interface EndUserProfileProps {
className?: string;
}
const formatValue = (value: string | string[] | null | undefined) => {
if (!value) return '-'
if (Array.isArray(value)) {
return value.length ? value.join(' | ') : '-'
}
return value
}
const EndUserProfile = forwardRef<EndUserProfileRef, EndUserProfileProps>(({ className, onDataLoaded }, ref) => {
const { t } = useTranslation()
const { id } = useParams()
@@ -89,19 +96,19 @@ const EndUserProfile = forwardRef<EndUserProfileRef, EndUserProfileProps>(({ cla
</div>
<div>
<div className="rb:text-[#7B8085]">{t('userMemory.role')}</div>
<div className="rb:mt-0.5">{data?.profile?.role?.join(' | ') || '-'}</div>
<div className="rb:mt-0.5">{formatValue(data?.profile?.role)}</div>
</div>
<div>
<div className="rb:text-[#7B8085]">{t('userMemory.domain')}</div>
<div className="rb:mt-0.5">{data?.profile?.domain?.join(' | ') || '-'}</div>
<div className="rb:mt-0.5">{formatValue(data?.profile?.domain)}</div>
</div>
<div>
<div className="rb:text-[#7B8085]">{t('userMemory.expertise')}</div>
<div className="rb:mt-0.5">{data?.profile?.expertise?.join(' | ') || '-'}</div>
<div className="rb:mt-0.5">{formatValue(data?.profile?.expertise)}</div>
</div>
<div>
<div className="rb:text-[#7B8085]">{t('userMemory.interests')}</div>
<div className="rb:mt-0.5">{data?.profile?.interests?.join(' | ') || '-'}</div>
<div className="rb:mt-0.5">{formatValue(data?.profile?.interests)}</div>
</div>
<div className="rb:text-[#7B8085] rb:text-[12px] rb:leading-4.5">

View File

@@ -178,7 +178,7 @@ export interface EndUser {
created_at: string;
updated_at: string;
profile: {
role: string[];
role: string[] | string;
domain: string[];
expertise: string[];
interests: string[];