From 534762dddb48af33b873794e0eb861104c195a13 Mon Sep 17 00:00:00 2001 From: jiangxucong Date: Thu, 19 Dec 2024 12:32:17 +0800 Subject: [PATCH] =?UTF-8?q?AI=E5=B7=A5=E5=85=B7=E9=9B=86=E5=92=8C=E5=8A=A9?= =?UTF-8?q?=E6=89=8B=E6=8E=A5=E5=8F=A3=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalHumanWeb/locales/zh-CN/discover.json | 15 +- DigitalHumanWeb/public/images/collect.png | Bin 0 -> 351 bytes .../@nav/_layout/Desktop/TopActions.tsx | 4 +- .../src/app/(main)/_layout/Desktop.tsx | 16 +- .../assistant/[slug]/features/AddAgent.tsx | 33 +- .../assistant/[slug]/features/Header.tsx | 99 +- .../assistant/[slug]/features/Temp.tsx | 14 +- .../(detail)/assistant/[slug]/page.tsx | 11 +- .../(detail)/features/DetailLayout.tsx | 28 +- .../(list)/assistants/[slug]/page.tsx | 48 +- .../(list)/assistants/features/Card.tsx | 109 +- .../(list)/assistants/features/Category.tsx | 4 +- .../(list)/assistants/features/List.tsx | 72 +- .../assistants/features/useCategory.tsx | 3 +- .../discover/(list)/assistants/page.tsx | 36 +- .../(list)/plugins/features/useCategory.tsx | 8 +- .../discover/_layout/Desktop/Header.tsx | 76 +- .../discover/features/StoreSearchBar.tsx | 4 +- .../discover/search/_layout/Desktop.tsx | 3 - .../search/features/AssistantsResult.tsx | 32 +- .../src/app/(main)/discover/search/page.tsx | 4 +- .../src/app/(main)/files/filescon.tsx | 1074 +++++++++-------- DigitalHumanWeb/src/app/api/request.js | 93 ++ .../src/locales/default/discover.ts | 23 +- .../server/modules/AssistantStore/index.ts | 3 +- .../src/server/services/discover/index.ts | 4 +- DigitalHumanWeb/src/services/user/client.ts | 3 +- DigitalHumanWeb/src/types/discover.ts | 1 + 28 files changed, 1044 insertions(+), 776 deletions(-) create mode 100644 DigitalHumanWeb/public/images/collect.png create mode 100644 DigitalHumanWeb/src/app/api/request.js diff --git a/DigitalHumanWeb/locales/zh-CN/discover.json b/DigitalHumanWeb/locales/zh-CN/discover.json index b4543af..1a79ae1 100644 --- a/DigitalHumanWeb/locales/zh-CN/discover.json +++ b/DigitalHumanWeb/locales/zh-CN/discover.json @@ -22,19 +22,20 @@ "category": { "assistant": { "all": "全部", - "academic": "收藏", - "career": "政务", - "copywriting": "教育", - "design": "营销", - "education": "设计", - "emotions": "办公", + "collect": "收藏", + "academic": "政务", + "education": "教育", + "marketing": "营销", + "design": "设计", + "office": "办公", "programming": "编程", - "games": "娱乐", + "entertainment": "娱乐", "life": "生活", "general": "通用" }, "plugin": { "all": "全部", + "collect": "收藏", "gaming-entertainment": "游戏娱乐", "life-style": "生活方式", "media-generate": "媒体生成", diff --git a/DigitalHumanWeb/public/images/collect.png b/DigitalHumanWeb/public/images/collect.png new file mode 100644 index 0000000000000000000000000000000000000000..c85996e2937fd0522e829009b6338795bc8166d2 GIT binary patch literal 351 zcmV-l0igbgP)Px#1am@3R0s$N2z&@+hyVZq2}wjjR5*?8lQB*LQ4~eb9mixU3TP-Srx+6&mcSOk z(gm1k!9r{-Of(^(H3X>WaS3)(kQk$#(G?J`%@7CtGZI_9-T&|YlXvsphktG4G1)%8 zXb;c@(xb#lzM)4*!TUSdv3#L~g6= xHfwhf_j$b;d>3R5Njwcl@syV5J1h0K^a(LkK?{Kh^@sof002ovPDHLkV1mgyjTis` literal 0 HcmV?d00001 diff --git a/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/TopActions.tsx b/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/TopActions.tsx index d13fc7b..d98e20f 100644 --- a/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/TopActions.tsx +++ b/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/TopActions.tsx @@ -61,7 +61,7 @@ const TopActions = memo(({ tab }) => {
会话
{enableKnowledgeBase && ( - {setValue("/discover/assistants"); window.localStorage.setItem("nowChat", "")}}> + {setValue("/discover/assistants"); window.localStorage.setItem("nowChat", "")}}> {"files"}
助手
@@ -85,7 +85,7 @@ const TopActions = memo(({ tab }) => { )} {showMarket && ( - {setValue("/plugins"); window.localStorage.setItem("nowChat", "")}}> + {setValue("/plugins"); window.localStorage.setItem("nowChat", "")}}> {"plugins"}
插件
diff --git a/DigitalHumanWeb/src/app/(main)/_layout/Desktop.tsx b/DigitalHumanWeb/src/app/(main)/_layout/Desktop.tsx index e76cf8f..9f46b89 100644 --- a/DigitalHumanWeb/src/app/(main)/_layout/Desktop.tsx +++ b/DigitalHumanWeb/src/app/(main)/_layout/Desktop.tsx @@ -87,21 +87,7 @@ const Layout = memo(({ children, nav }) => { width={'100%'} > {nav} -
-
-
- 智能助手 - - {title[window?.location?.pathname]} -
-
- } /> - } /> - 张末末 -
-
- {children} -
+ {children} ); diff --git a/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/features/AddAgent.tsx b/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/features/AddAgent.tsx index bfd8000..81a9bd4 100644 --- a/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/features/AddAgent.tsx +++ b/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/features/AddAgent.tsx @@ -1,7 +1,7 @@ 'use client'; import { ActionIcon, Icon } from '@lobehub/ui'; -import { App, Dropdown } from 'antd'; +import { App, Dropdown, Button } from 'antd'; import { createStyles } from 'antd-style'; import { ChevronDownIcon, PlusIcon } from 'lucide-react'; import { useRouter } from 'next/navigation'; @@ -15,9 +15,9 @@ import { DiscoverAssistantItem } from '@/types/discover'; const useStyles = createStyles(({ css }) => ({ button: css` - button { - width: 100%; - } + border-radius: 20px; + color: #2E62FF; + border: 1px solid #2E62FF; `, })); @@ -36,6 +36,7 @@ const AddAgent = memo<{ data: DiscoverAssistantItem; mobile?: boolean }>(({ data const session = await createSession({ config: data.config, meta: data.meta }); setIsLoading(false); message.success(t('assistants.addAgentSuccess')); + console.log(SESSION_CHAT_URL(session, mobile),'5555555555555555555555') router.push(SESSION_CHAT_URL(session, mobile)); }; @@ -59,27 +60,9 @@ const AddAgent = memo<{ data: DiscoverAssistantItem; mobile?: boolean }>(({ data ); return ( - } - loading={isLoading} - menu={{ - items: [ - { - key: 'addAgent', - label: t('assistants.addAgent'), - onClick: handleAddAgent, - }, - ], - }} - onClick={handleAddAgentAndConverse} - overlayStyle={{ minWidth: 267 }} - size={'large'} - style={{ flex: 1, width: 'unset' }} - type={'primary'} - > - {t('assistants.addAgentAndConverse')} - + <> + + ); }); diff --git a/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/features/Header.tsx b/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/features/Header.tsx index e26b2ec..b72efb1 100644 --- a/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/features/Header.tsx +++ b/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/features/Header.tsx @@ -11,12 +11,12 @@ import { memo } from 'react'; import { useTranslation } from 'react-i18next'; import { Flexbox } from 'react-layout-kit'; import urlJoin from 'url-join'; - +import { useRouter } from 'next/navigation'; import { DiscoverAssistantItem } from '@/types/discover'; import GitHubAvatar from '../../../../components/GitHubAvatar'; import Back from '../../../features/Back'; - +import Actions from './Actions'; export const useStyles = createStyles(({ css, token }) => ({ tag: css` color: ${token.colorTextSecondary}; @@ -33,6 +33,36 @@ export const useStyles = createStyles(({ css, token }) => ({ font-weight: bold; line-height: 1.2; `, + top: css` + padding: 20px 0px; + box-sizing: border-box; + border-width: 0px 0px 2px 0px; + border-style: solid; + border-color: rgba(187, 204, 253, 0.24); + padding: 20px 50px; + `, + topBtn: css` + border-radius: 20px; + color: #2E62FF; + border: 1px solid #2E62FF; + `, + conTitle: css` + width: 125px; + height: 50px; + line-height: 50px; + text-align: center; + color: #fff; + font-size: 20px; + border-radius: 0px 129px 129px 0px; + opacity: 1; + background: linear-gradient(270deg, #2D65FF 0%, rgba(0, 166, 255, 0.52) 99%); + `, + description: css` + padding: 0 45px; + `, + tag: css` + padding: 0px 45px; + `, })); interface HeaderProps { @@ -43,12 +73,14 @@ interface HeaderProps { const Header = memo(({ identifier, data, mobile }) => { const { styles, theme } = useStyles(); + const router = useRouter() const { t } = useTranslation('discover'); - + const handleBack = () => { + router.push('/discover/assistants?userid=' + localStorage.getItem('userId')) + } return ( - {!mobile && } - + (({ identifier, data, mobile }) => { + {!mobile && ( - - - - {data.meta?.category && ( - <> - - - - - - )} + )} -
{data.meta.description}
- {data.meta.tags && ( - - {data.meta.tags.map((tag) => ( - - - {startCase(tag).trim()} - - - ))} - - )} +
简介
+
{data.meta.description}
+
+ {data.meta.tags && ( + + {data.meta.tags.map((tag) => ( + + + {startCase(tag).trim()} + + + ))} + + )} +
+
设定
); }); diff --git a/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/features/Temp.tsx b/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/features/Temp.tsx index 81f9ada..e29c8d0 100644 --- a/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/features/Temp.tsx +++ b/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/features/Temp.tsx @@ -21,23 +21,17 @@ interface ConversationExampleProps extends FlexboxProps { const ConversationExample = memo(({ data }) => { const { t } = useTranslation('discover'); const theme = useTheme(); - + console.log(data.config.systemRole,111111111) return ( - - + <> + {data.config.systemRole ? ( {data.config.systemRole} ) : ( )} - + ); }); diff --git a/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/page.tsx b/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/page.tsx index a3c8c42..fb1b2ff 100644 --- a/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/page.tsx +++ b/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/page.tsx @@ -64,7 +64,7 @@ const Page = async ({ params, searchParams }: Props) => { const discoverService = new DiscoverService(); const data = await discoverService.getAssistantById(locale, identifier); if (!data) return notFound(); - + console.log(data,'37373733737') const { meta, createdAt, author, config } = data; let pluginData: DiscoverPlugintem[] = []; @@ -93,17 +93,8 @@ const Page = async ({ params, searchParams }: Props) => { <> } header={
} mobile={mobile} - sidebar={ - - } /* ↓ cloud slot ↓ */ /* ↑ cloud slot ↑ */ diff --git a/DigitalHumanWeb/src/app/(main)/discover/(detail)/features/DetailLayout.tsx b/DigitalHumanWeb/src/app/(main)/discover/(detail)/features/DetailLayout.tsx index 98a1206..efea29f 100644 --- a/DigitalHumanWeb/src/app/(main)/discover/(detail)/features/DetailLayout.tsx +++ b/DigitalHumanWeb/src/app/(main)/discover/(detail)/features/DetailLayout.tsx @@ -37,20 +37,22 @@ const DetailLayout = memo( return ( <> - {header} - - - {children} -