feat: Add agent removal function#1147
Conversation
fix: Fix the agent deletion issue
Bugfix/superteam
feat: Add agent removal function
feat: Add agent removal function
feat: Add agent removal function
feat: Add agent removal function
|
yjlu12 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
There was a problem hiding this comment.
Code Review
This pull request updates the bot synchronization logic in MarketPublishStrategy to support shared spaces and enhances the frontend by displaying bot creation times and creators. It also refactors the agent list's take-down functionality and introduces a check to prevent users from deleting bots created by others. Feedback from the review suggests consolidating duplicated date formatting logic into a shared utility and replacing hardcoded Chinese strings with internationalized translation keys to ensure the application remains localizable.
| const formatCreateTime = useCallback((value?: string) => { | ||
| if (!value) return ''; | ||
| const normalized = value.replace(' ', 'T'); | ||
| return dayjs.utc(normalized).utcOffset(8).format('YYYY-MM-DD HH:mm'); | ||
| }, []); |
There was a problem hiding this comment.
The date formatting logic (including the hardcoded UTC offset) is duplicated across multiple files: home-page/index.tsx, agent-list/index.tsx, and agent-page/index.tsx. This logic should be extracted into a shared utility function in a common directory (e.g., src/utils/date.ts) to ensure consistency, reduce code duplication, and improve maintainability.
| const creatorLabel = '\u521b\u5efa\u4eba\uff1a'; | ||
| const createdAtLabel = '\u521b\u5efa\u65f6\u95f4\uff1a'; |
There was a problem hiding this comment.
The labels for 'Creator' and 'Creation Time' are hardcoded as Chinese strings. Since the project uses react-i18next, these should be retrieved using the t function to support internationalization. Note that the t function is defined later in the component, so these constants should be moved after the useTranslation hook call or the t function should be used directly in the JSX.
| message.warning( | ||
| '\u65e0\u6cd5\u5220\u9664\u4ed6\u4eba\u521b\u5efa\u7684\u667a\u80fd\u4f53' | ||
| ); |
There was a problem hiding this comment.
The warning message is hardcoded in Chinese. Please use the t function to retrieve the localized string from the translation files, ensuring the application remains localizable.
| message.warning( | |
| '\u65e0\u6cd5\u5220\u9664\u4ed6\u4eba\u521b\u5efa\u7684\u667a\u80fd\u4f53' | |
| ); | |
| message.warning( | |
| t('agentPage.agentPage.cannotDeleteOthersAgent') | |
| ); |
| message.warning( | ||
| '\u65e0\u6cd5\u5220\u9664\u4ed6\u4eba\u521b\u5efa\u7684\u667a\u80fd\u4f53' | ||
| ); |
There was a problem hiding this comment.
Summary
Type of Change
Related Issue
Changes
Testing
Screenshots (if applicable)
Checklist