Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add author_name for app list card #16900

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/fields/app_fields.py
Original file line number Diff line number Diff line change
@@ -98,6 +98,7 @@
"updated_by": fields.String,
"updated_at": TimestampField,
"tags": fields.List(fields.Nested(tag_fields)),
"author_name": fields.String,
}


9 changes: 9 additions & 0 deletions api/models/model.py
Original file line number Diff line number Diff line change
@@ -296,6 +296,15 @@ def tags(self):

return tags or []

@property
def author_name(self):
if self.created_by:
account = db.session.query(Account).filter(Account.id == self.created_by).first()
if account:
return account.name

return None


class AppModelConfig(Base):
__tablename__ = "app_model_configs"
3 changes: 2 additions & 1 deletion web/app/(commonLayout)/apps/AppCard.tsx
Original file line number Diff line number Diff line change
@@ -290,8 +290,9 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
<AppTypeIcon type={app.mode} wrapperClassName='absolute -bottom-0.5 -right-0.5 w-4 h-4 shadow-sm' className='h-3 w-3' />
</div>
<div className='w-0 grow py-[1px]'>
<div className='flex items-center text-sm font-semibold leading-5 text-text-secondary'>
<div className='flex items-center justify-between text-sm font-semibold leading-5 text-text-secondary'>
<div className='truncate' title={app.name}>{app.name}</div>
<div className='truncate'>{app.author_name}</div>
</div>
<div className='flex items-center text-[10px] font-medium leading-[18px] text-text-tertiary'>
{app.mode === 'advanced-chat' && <div className='truncate'>{t('app.types.advanced').toUpperCase()}</div>}
2 changes: 2 additions & 0 deletions web/types/app.ts
Original file line number Diff line number Diff line change
@@ -315,6 +315,8 @@ export type App = {
name: string
/** Description */
description: string
/** Author Name */
author_name: string;

/**
* Icon Type

Unchanged files with check annotations Beta

},
]
return navs
}, [])

Check warning on line 97 in web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx

GitHub Actions / Web Style

React Hook useCallback has a missing dependency: 't'. Either include it or remove the dependency array
useEffect(() => {
if (appDetail) {
type Props = {}
const page = (props: Props) => {

Check warning on line 5 in web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/api/page.tsx

GitHub Actions / Web Style

'props' is defined but never used. Allowed unused args must match /^_/u
return (
<div>dataset detail api</div>
)
const ExtraInfo = ({ isMobile, relatedApps, expand }: IExtraInfoProps) => {
const locale = getLocaleOnClient()
const [isShowTips, { toggle: toggleTips, set: setShowTips }] = useBoolean(!isMobile)

Check warning on line 69 in web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx

GitHub Actions / Web Style

'isShowTips' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 69 in web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout-main.tsx

GitHub Actions / Web Style

'toggleTips' is assigned a value but never used. Allowed unused vars must match /^_/u
const { t } = useTranslation()
const hasRelatedApps = relatedApps?.data && relatedApps?.data?.length > 0
if (onSuccess)
onSuccess()
}
catch (e: any) {

Check warning on line 64 in web/app/(commonLayout)/datasets/DatasetCard.tsx

GitHub Actions / Web Style

'e' is defined but never used
}
setShowConfirmDelete(false)
}, [dataset.id, notify, onSuccess, t])
document.title = `${t('dataset.knowledge')} - Dify`
}, [isLoading, t])
const onScroll = useCallback(

Check warning on line 67 in web/app/(commonLayout)/datasets/Datasets.tsx

GitHub Actions / Web Style

React Hook useCallback received a function whose dependencies are unknown. Pass an inline function instead
debounce(() => {
if (!loadingStateRef.current && containerRef.current && anchorRef.current) {
const { scrollTop, clientHeight } = containerRef.current
currentContainer?.removeEventListener('scroll', onScroll)
onScroll.cancel()
}
}, [onScroll])

Check warning on line 86 in web/app/(commonLayout)/datasets/Datasets.tsx

GitHub Actions / Web Style

React Hook useEffect has a missing dependency: 'containerRef'. Either include it or remove the dependency array
return (
<nav className='grid shrink-0 grow grid-cols-1 content-start gap-4 px-12 pt-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4'>
type Props = {}
const DatasetCreation = async (props: Props) => {

Check warning on line 6 in web/app/(commonLayout)/datasets/create/page.tsx

GitHub Actions / Web Style

'props' is defined but never used. Allowed unused args must match /^_/u
return (
<DatasetUpdateForm />
)
}
init()
}, [message, tokenFromUrl]) // Added dependencies to useEffect

Check warning on line 92 in web/app/(shareLayout)/webapp-signin/page.tsx

GitHub Actions / Web Style

React Hook useEffect has missing dependencies: 'handleSSOLogin' and 'processTokenAndRedirect'. Either include them or remove the dependency array
return (
<div className="flex h-full items-center justify-center">
<Avatar {...props} />
<div
onClick={() => { setIsShowAvatarPicker(true) }}
className="absolute inset-0 flex cursor-pointer items-center justify-center rounded-full bg-black bg-opacity-50 opacity-0 transition-opacity group-hover:opacity-100"

Check warning on line 90 in web/app/account/account-page/AvatarWithEdit.tsx

GitHub Actions / Web Style

Classname 'bg-opacity-50' should be replaced by an opacity suffix (eg. '/50')
>
<span className="text-xs text-white">
<RiPencilLine />