|  |  | @ -1,19 +1,18 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | import { Avatar, Tag } from '@lobehub/ui'; |  |  |  | import { Avatar, Tag } from '@lobehub/ui'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import { Skeleton, Typography } from 'antd'; |  |  |  | import { Skeleton, Typography, App } from 'antd'; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | import { createStyles } from 'antd-style'; |  |  |  | import { createStyles } from 'antd-style'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import { startCase } from 'lodash-es'; |  |  |  | import { startCase } from 'lodash-es'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import dynamic from 'next/dynamic'; |  |  |  | import dynamic from 'next/dynamic'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import qs from 'query-string'; |  |  |  | import qs from 'query-string'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import { memo } from 'react'; |  |  |  | import { memo, useState } from 'react'; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | import { Center, Flexbox, FlexboxProps } from 'react-layout-kit'; |  |  |  | import { Center, Flexbox, FlexboxProps } from 'react-layout-kit'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import urlJoin from 'url-join'; |  |  |  | import urlJoin from 'url-join'; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | import request from '@/app/api/request'; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | import { DiscoverAssistantItem } from '@/types/discover'; |  |  |  | import { DiscoverAssistantItem } from '@/types/discover'; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import CardBanner from '../../../components/CardBanner'; |  |  |  | import CardBanner from '../../../components/CardBanner'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import GitHubAvatar from '../../../components/GitHubAvatar'; |  |  |  | import GitHubAvatar from '../../../components/GitHubAvatar'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import { useCategoryItem } from '../../assistants/features/useCategory'; |  |  |  | import { useCategoryItem } from '../../assistants/features/useCategory'; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | import { StarOutlined } from '@ant-design/icons'; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | const Link = dynamic(() => import('next/link'), { |  |  |  | const Link = dynamic(() => import('next/link'), { | 
			
		
	
		
		
			
				
					
					|  |  |  |   loading: () => <Skeleton.Button size={'small'} style={{ height: 22 }} />, |  |  |  |   loading: () => <Skeleton.Button size={'small'} style={{ height: 22 }} />, | 
			
		
	
		
		
			
				
					
					|  |  |  |   ssr: false, |  |  |  |   ssr: false, | 
			
		
	
	
		
		
			
				
					|  |  | @ -59,8 +58,16 @@ const useStyles = createStyles(({ css, token, isDarkMode }) => ({ | 
			
		
	
		
		
			
				
					
					|  |  |  |     margin-block-end: 0 !important; |  |  |  |     margin-block-end: 0 !important; | 
			
		
	
		
		
			
				
					
					|  |  |  |     font-weight: bold; |  |  |  |     font-weight: bold; | 
			
		
	
		
		
			
				
					
					|  |  |  |   `,
 |  |  |  |   `,
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   collectBtn: css` | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     font-size: 12px; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     width: 20px; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     height: 20px; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     line-height: 20px; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     border-radius: 50%; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     background: #FFF3D9; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     text-align: center; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   `,
 | 
			
		
	
		
		
			
				
					
					|  |  |  | })); |  |  |  | })); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | export interface AssistantCardProps |  |  |  | export interface AssistantCardProps | 
			
		
	
		
		
			
				
					
					|  |  |  |   extends Omit<DiscoverAssistantItem, 'suggestions' | 'socialData' | 'config'>, |  |  |  |   extends Omit<DiscoverAssistantItem, 'suggestions' | 'socialData' | 'config'>, | 
			
		
	
		
		
			
				
					
					|  |  |  |     Omit<FlexboxProps, 'children'> { |  |  |  |     Omit<FlexboxProps, 'children'> { | 
			
		
	
	
		
		
			
				
					|  |  | @ -71,11 +78,18 @@ export interface AssistantCardProps | 
			
		
	
		
		
			
				
					
					|  |  |  | const AssistantCard = memo<AssistantCardProps>( |  |  |  | const AssistantCard = memo<AssistantCardProps>( | 
			
		
	
		
		
			
				
					
					|  |  |  | ({ showCategory, className, meta, createdAt, author, variant, ...rest }) => { |  |  |  | ({ showCategory, className, meta, createdAt, author, variant, ...rest }) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |     const { avatar, title, description, tags = [], category } = meta; |  |  |  |     const { avatar, title, description, tags = [], category } = meta; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     const { createAt,homepage,identifier,schemaVersion,status,classify } = {...rest} | 
			
		
	
		
		
			
				
					
					|  |  |  |     const { cx, styles, theme } = useStyles(); |  |  |  |     const { cx, styles, theme } = useStyles(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     const { message } = App.useApp(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     const categoryItem = useCategoryItem(category, 12); |  |  |  |     const categoryItem = useCategoryItem(category, 12); | 
			
		
	
		
		
			
				
					
					|  |  |  |     const isCompact = variant === 'compact'; |  |  |  |     const isCompact = variant === 'compact'; | 
			
		
	
		
		
			
				
					
					|  |  |  |     const { createAt,homepage,identifier,schemaVersion } = {...rest} |  |  |  |     // console.log(tags,avatar,author,9383737)
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     console.log(tags,avatar,author,9383737) |  |  |  |     console.log(status,9999999999) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     const [val, setVal] = useState(status) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     const handleCollect = (e) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       console.log(e,8844848) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       e.preventDefault() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       e.stopPropagation() | 
			
		
	
		
		
			
				
					
					|  |  |  |       const params = { |  |  |  |       const params = { | 
			
		
	
		
		
			
				
					
					|  |  |  |         "author": author, |  |  |  |         "author": author, | 
			
		
	
		
		
			
				
					
					|  |  |  |         "createAt": createAt, |  |  |  |         "createAt": createAt, | 
			
		
	
	
		
		
			
				
					|  |  | @ -87,19 +101,22 @@ const AssistantCard = memo<AssistantCardProps>( | 
			
		
	
		
		
			
				
					
					|  |  |  |         "tags": tags.join(','), |  |  |  |         "tags": tags.join(','), | 
			
		
	
		
		
			
				
					
					|  |  |  |         "title": title, |  |  |  |         "title": title, | 
			
		
	
		
		
			
				
					
					|  |  |  |         "category": category, |  |  |  |         "category": category, | 
			
		
	
		
		
			
				
					
					|  |  |  |       "schemaVersion": schemaVersion |  |  |  |         "schemaVersion": schemaVersion, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         "userid": localStorage.getItem('userId'), | 
			
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |     console.log(params,68686868) |  |  |  |       request({ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     const handleCollect = () => { |  |  |  |           url: "/flxai/api/robot/appaiassistant", | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       axios.post('https://api.example.com/data',params) |  |  |  |           method: "post", | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       .then(response => { |  |  |  |           data: params | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         // 请求成功后的处理
 |  |  |  |       }).then(response => { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         console.log(response.data); |  |  |  |         console.log(response,222222222) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (response.code == 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             message.success('收藏成功') | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             setVal("1") | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       }).catch(error => { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         console.error('Error fetching data: ', error); | 
			
		
	
		
		
			
				
					
					|  |  |  |       }) |  |  |  |       }) | 
			
		
	
		
		
			
				
					
					|  |  |  |       .catch(error => { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         // 请求失败后的处理
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         console.error('Error posting data:', error); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       }); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     const user = ( |  |  |  |     const user = ( | 
			
		
	
		
		
			
				
					
					|  |  |  |       <Flexbox |  |  |  |       <Flexbox | 
			
		
	
	
		
		
			
				
					|  |  | @ -112,7 +129,17 @@ const AssistantCard = memo<AssistantCardProps>( | 
			
		
	
		
		
			
				
					
					|  |  |  |         <span>{author}</span> |  |  |  |         <span>{author}</span> | 
			
		
	
		
		
			
				
					
					|  |  |  |       </Flexbox> |  |  |  |       </Flexbox> | 
			
		
	
		
		
			
				
					
					|  |  |  |     ); |  |  |  |     ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |     const renderElement = () => { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       if (classify != 'collect') { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if(val == "1") { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           return <div className={styles.collectBtn} onClick={(e) => {e.stopPropagation()}}><StarOutlined style={{color: '#FFAD01'}}/></div> | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           return <div className={styles.collectBtn} style={{background: '#F1F1F1'}} onClick={(e) => handleCollect(e)}><StarOutlined style={{color: '#D6D6D6'}}/></div> | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }; | 
			
		
	
		
		
			
				
					
					|  |  |  |     return ( |  |  |  |     return ( | 
			
		
	
		
		
			
				
					
					|  |  |  |       <Flexbox className={cx(styles.container, className)} gap={24} {...rest}> |  |  |  |       <Flexbox className={cx(styles.container, className)} gap={24} {...rest}> | 
			
		
	
		
		
			
				
					
					|  |  |  |         {!isCompact && <CardBanner avatar={avatar} />} |  |  |  |         {!isCompact && <CardBanner avatar={avatar} />} | 
			
		
	
	
		
		
			
				
					|  |  | @ -170,13 +197,11 @@ const AssistantCard = memo<AssistantCardProps>( | 
			
		
	
		
		
			
				
					
					|  |  |  |             {description} |  |  |  |             {description} | 
			
		
	
		
		
			
				
					
					|  |  |  |           </Paragraph> |  |  |  |           </Paragraph> | 
			
		
	
		
		
			
				
					
					|  |  |  |           <Flexbox gap={6} horizontal style={{ flexWrap: 'wrap',justifyContent: 'space-between' }}> |  |  |  |           <Flexbox gap={6} horizontal style={{ flexWrap: 'wrap',justifyContent: 'space-between' }}> | 
			
		
	
		
		
			
				
					
					|  |  |  |             <div> |  |  |  |             <div onClick={(e) => {e.stopPropagation()}} style={{width: '85%'}}> | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |               {showCategory && categoryItem ? ( |  |  |  |               {showCategory && categoryItem ? ( | 
			
		
	
		
		
			
				
					
					|  |  |  |                 <Link href={urlJoin('/discover/assistants', categoryItem.key)}> |  |  |  |                 <Tag icon={categoryItem.icon} style={{ margin: '0 5' }}> | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                   <Tag icon={categoryItem.icon} style={{ margin: 0 }}> |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                   {categoryItem.label} |  |  |  |                   {categoryItem.label} | 
			
		
	
		
		
			
				
					
					|  |  |  |                 </Tag> |  |  |  |                 </Tag> | 
			
		
	
		
		
			
				
					
					|  |  |  |                 </Link> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |               ) : ( |  |  |  |               ) : ( | 
			
		
	
		
		
			
				
					
					|  |  |  |                 tags |  |  |  |                 tags | 
			
		
	
		
		
			
				
					
					|  |  |  |                   .slice(0, 4) |  |  |  |                   .slice(0, 4) | 
			
		
	
	
		
		
			
				
					|  |  | @ -187,14 +212,12 @@ const AssistantCard = memo<AssistantCardProps>( | 
			
		
	
		
		
			
				
					
					|  |  |  |                       url: '/discover/search', |  |  |  |                       url: '/discover/search', | 
			
		
	
		
		
			
				
					
					|  |  |  |                     }); |  |  |  |                     }); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     return ( |  |  |  |                     return ( | 
			
		
	
		
		
			
				
					
					|  |  |  |                       <Link href={url} key={index}> |  |  |  |                       <Tag style={{ margin: '0 5' }}>{startCase(tag).trim()}</Tag> | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         <Tag style={{ margin: 0 }}>{startCase(tag).trim()}</Tag> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                       </Link> |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     ); |  |  |  |                     ); | 
			
		
	
		
		
			
				
					
					|  |  |  |                   }) |  |  |  |                   }) | 
			
		
	
		
		
			
				
					
					|  |  |  |               )} |  |  |  |               )} | 
			
		
	
		
		
			
				
					
					|  |  |  |             </div> |  |  |  |             </div> | 
			
		
	
		
		
			
				
					
					|  |  |  |             <div style={{ fontSize: 12 }} onClick={() => handleCollect()}>收藏</div> |  |  |  |             {renderElement()} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |           </Flexbox> |  |  |  |           </Flexbox> | 
			
		
	
		
		
			
				
					
					|  |  |  |         </Flexbox> |  |  |  |         </Flexbox> | 
			
		
	
		
		
			
				
					
					|  |  |  |       </Flexbox> |  |  |  |       </Flexbox> | 
			
		
	
	
		
		
			
				
					|  |  | 
 |