diff --git a/DigitalHumanWeb/package.json b/DigitalHumanWeb/package.json index ee4ef04..e0a9e3a 100644 --- a/DigitalHumanWeb/package.json +++ b/DigitalHumanWeb/package.json @@ -38,7 +38,7 @@ "db:push-test": "NODE_ENV=test drizzle-kit push", "db:studio": "drizzle-kit studio", "db:z-pull": "drizzle-kit introspect", - "dev": "next dev -p 3010", + "dev": "next dev -p 3011", "docs:i18n": "lobe-i18n md && npm run lint:mdx", "docs:seo": "lobe-seo && npm run lint:mdx", "i18n": "npm run workflow:i18n && lobe-i18n", @@ -109,6 +109,7 @@ "@azure/core-rest-pipeline": "1.16.0", "@azure/openai": "1.0.0-beta.12", "@cfworker/json-schema": "^2.0.0", + "@chevrotain/regexp-to-ast": "^11.0.3", "@clerk/localizations": "^3.0.4", "@clerk/nextjs": "^5.3.3", "@clerk/themes": "^2.1.27", @@ -144,6 +145,8 @@ "axios": "^1.7.9", "brotli-wasm": "^3.0.1", "chroma-js": "^2.6.0", + "csv-string": "^4.1.1", + "csv-stringify": "^6.5.2", "dayjs": "^1.11.13", "debug": "^4.3.6", "dexie": "^3.2.7", diff --git a/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/Avatar.tsx b/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/Avatar.tsx index 723370c..6e0fb5f 100644 --- a/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/Avatar.tsx +++ b/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/Avatar.tsx @@ -1,6 +1,6 @@ import {Image} from 'antd'; import { memo } from 'react'; -import { Flexbox } from 'react-layout-kit'; +// import { Flexbox } from 'react-layout-kit'; // import UserAvatar from '@/features/User/UserAvatar'; // import UserPanel from '@/features/User/UserPanel'; diff --git a/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/TopActions.tsx b/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/TopActions.tsx index 46cf716..8124be2 100644 --- a/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/TopActions.tsx +++ b/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/TopActions.tsx @@ -18,13 +18,13 @@ const useStyles = createStyles(({ css }) => ({ width: 48px; height: 48px; `, + iconSelectText: css` + color: #0044FF; + `, iconText: css` text-align: center; color: #fff; `, - iconSelectText: css` - color: #0044FF; - `, linkUrl: css` width: 100%; display: inline-block; @@ -37,7 +37,8 @@ const useStyles = createStyles(({ css }) => ({ export interface TopActionProps { tab?: SidebarTabKey; } -const getUserId = (s) => s.user?.id + +const getUserId = (s:object) => s.user?.id const TopActions = memo(() => { const { t } = useTranslation('common'); const switchBackToChat = useGlobalStore((s) => s.switchBackToChat); @@ -63,19 +64,19 @@ const TopActions = memo(() => {
会话
{enableKnowledgeBase && ( - {setValue("/discover/assistants"); window.localStorage.setItem("nowChat", "")}}> + {setValue("/discover/assistants"); window.localStorage.setItem("nowChat", "")}}> {"files"}
助手
)} {showMarket && ( - {setValue("/files"); window.localStorage.setItem("nowChat", "")}}> + {setValue("/applicationset"); window.localStorage.setItem("nowChat", "")}}> {"discover"} -
工具
+
AI应用集
)} {showMarket && ( - {setValue("/model"); window.localStorage.setItem("nowChat", "")}}> + {setValue("/model"); window.localStorage.setItem("nowChat", "")}}> {"model"}
模型
@@ -87,7 +88,7 @@ const TopActions = memo(() => { )} {showMarket && ( - {setValue("/plugins"); window.localStorage.setItem("nowChat", "")}}> + {setValue("/plugins"); window.localStorage.setItem("nowChat", "")}}> {"plugins"}
插件
diff --git a/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/index.tsx b/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/index.tsx index 405fb39..3c44f02 100644 --- a/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/index.tsx +++ b/DigitalHumanWeb/src/app/(main)/@nav/_layout/Desktop/index.tsx @@ -13,7 +13,7 @@ const Nav = memo(() => { return ( } - bottomActions={<>} + bottomActions={
} style={{ backgroundColor: '#2E62FF', height: '100%', width: '100px', zIndex: 100 }} topActions={} /> diff --git a/DigitalHumanWeb/src/app/(main)/_layout/Desktop.tsx b/DigitalHumanWeb/src/app/(main)/_layout/Desktop.tsx index 1eeb2b1..e16e7da 100644 --- a/DigitalHumanWeb/src/app/(main)/_layout/Desktop.tsx +++ b/DigitalHumanWeb/src/app/(main)/_layout/Desktop.tsx @@ -7,45 +7,45 @@ import { Flexbox } from 'react-layout-kit'; import CloudBanner, { BANNER_HEIGHT } from '@/features/AlertBanner/CloudBanner'; import { usePlatform } from '@/hooks/usePlatform'; import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig'; -import { UserOutlined, SearchOutlined } from '@ant-design/icons'; +import { UserOutlined } from '@ant-design/icons'; import { LayoutProps } from './type'; import { Divider, Avatar } from "antd"; + const title = { "/chat": '会话', "/discover/assistants": "助手", "/files": "工具", + "/knowledge": "知识库", "/model": "模型", - "/robot": "数字人", "/plugins": "插件", "/power": "算力", - "/knowledge": "知识库" + "/robot": "数字人", } -const useStyles = createStyles(({ css, token }) => ({ - topCenten: css` - width: 100%; - line-height: 60px; - background: #FFFFFF; - box-sizing: border-box; - /* 分割线颜色 */ - border-width: 0px 0px 2px 0px; - border-style: solid; - border-color: rgba(187, 204, 253, 0.24); - `, - leftTitle: css` - font-size: 20px; - color: #3d3d3d; - display: inline-block - `, +const useStyles = createStyles(({ css }) => ({ dividerCen: css` width: 1px; height: 26px; background-color: #d8d8d8; margin: 8px 16px; `, + inp: css` + width: 283px; + margin-right: 43px; + background: #F3F6FF; + &:hover, &:active, &:focus { + border-color: transparent !important; + background: #F3F6FF !important; + } + `, ledDiv: css ` width: 50%; display: inline-block; `, + leftTitle: css` + font-size: 20px; + color: #3d3d3d; + display: inline-block + `, nameSpn: css` margin-right: 16px; margin-left: 18px; @@ -55,14 +55,15 @@ const useStyles = createStyles(({ css, token }) => ({ color: #BCCEFF; font-size: 24px; `, - inp: css` - width: 283px; - margin-right: 43px; - background: #F3F6FF; - &:hover, &:active, &:focus { - border-color: transparent !important; - background: #F3F6FF !important; - } + topCenten: css` + width: 100%; + line-height: 60px; + background: #FFFFFF; + box-sizing: border-box; + /* 分割线颜色 */ + border-width: 0px 0px 2px 0px; + border-style: solid; + border-color: rgba(187, 204, 253, 0.24); `, })) @@ -94,7 +95,7 @@ const Layout = memo(({ children, nav }) => { {title[pathName]}
- } /> + } style={{ backgroundColor: '#90ACFF' }}/> 张末末
diff --git a/DigitalHumanWeb/src/app/(main)/files/filescon.tsx b/DigitalHumanWeb/src/app/(main)/applicationset/applicationset.tsx similarity index 84% rename from DigitalHumanWeb/src/app/(main)/files/filescon.tsx rename to DigitalHumanWeb/src/app/(main)/applicationset/applicationset.tsx index 4536b2e..39ac33e 100644 --- a/DigitalHumanWeb/src/app/(main)/files/filescon.tsx +++ b/DigitalHumanWeb/src/app/(main)/applicationset/applicationset.tsx @@ -1,10 +1,10 @@ 'use client'; -import {memo, useMemo, useEffect, useState} from 'react'; +import {memo, useEffect, useState} from 'react'; import {createStyles} from "antd-style"; -import {Anchor, Button, Card, Image, Avatar, ConfigProvider} from "antd"; +import {Anchor, Button, Card, Image} from "antd"; import {RightCircleOutlined, LikeFilled, WechatFilled, HomeFilled, DribbbleSquareFilled, CopyFilled, MedicineBoxFilled, IeCircleFilled, IdcardFilled, HourglassFilled, InsuranceFilled} from "@ant-design/icons"; -import Link from "next/link"; +// import Link from "next/link"; import request from '@/app/api/request'; import Title from "@/app/(main)/discover/components/Title"; @@ -526,94 +526,29 @@ import Title from "@/app/(main)/discover/components/Title"; const stList = [ { - title: 'XXX助手', date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" - }, - { + des: "擅长产品功能分析与用户价值观广告文案创作。", title: 'XXX助手', - date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" }, - { - title: 'XXX助手', - date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" - }, - { - title: 'XXX助手', - date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" - }, - { - title: 'XXX助手', - date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" - }, - { - title: 'XXX助手', - date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" - }, - { - title: 'XXX助手', - date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" - }, - { - title: 'XXX助手', - date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" - }, - { - title: 'XXX助手', - date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" - }, - { - title: 'XXX助手', - date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" - }, - { - title: 'XXX助手', - date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" - }, - { - title: 'XXX助手', - date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" - }, - { - title: 'XXX助手', - date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" - }, - { - title: 'XXX助手', - date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" - }, - { - title: 'XXX助手', - date: '2024-02-03', - des: "擅长产品功能分析与用户价值观广告文案创作。" - } ] -const useStyles = createStyles(({css, token}) => ({ - topBtn: css` - padding: 10px 0px; - background: rgba(239, 243, 255, 0.22); - box-sizing: border-box; - border-width: 0px 0px 2px 0px; - border-style: solid; - border-color: rgba(146, 154, 178, 0.2392); +const useStyles = createStyles(({css}) => ({ + actionItem: css` + height: 56px; + line-height: 56px; + margin-right: 30px `, - selectBtn: css` - background-color: #3B6FFF !important; - color: #fff !important; + actionItemIcon: css` + margin-right: 15px; + margin-left: 28px; + `, + actionSpan: css` + color: #2E62FF; + `, + avImg: css` + width: 55px; + height: 55px; + border-radius: 16px `, btn: css` width: 136px; @@ -623,125 +558,132 @@ const useStyles = createStyles(({css, token}) => ({ border-color: #C2C2C2 !important; color: #666 !important; `, - actionItem: css` - height: 56px; - line-height: 56px; - margin-right: 30px + card: css` + width: 23%; + margin: 32px 1% 0; + display: inline-block; `, - actionItemIcon: css` - margin-right: 15px; - margin-left: 28px; + cardCotain: css` + margin-top: -10px; + font-size: 12px; + color: #999 `, - first: css` - color: #FFAD01 + cardMeta: css` + height: 80px `, - sec: css` - color: #5BD941 + container: css` + marginTop: -20px `, - thd: css` - color: #003BFF + containerTitle: css` + font-size: 18px `, - four: css` - color: #FF9B06 + desImg: css` + width: 28px + `, + desText: css` + font-size: 12px; + color: #909090; + `, + egiht: css` + color: #5BD941 `, fif: css` color: #FF4D4D `, - six: css` - color: #003BFF + first: css` + color: #FFAD01 `, - seven: css` - color: #0EDFFF + four: css` + color: #FF9B06 `, - egiht: css` - color: #5BD941 + leftTitle: css` + font-size: 20px; + margin: 0 1%; + padding-top: 20px; `, nine: css` color: #07D7F7 `, - ten: css` - color: #E138FF + rightCo: css` + font-size: 16px; + margin-left: 30px; + vertical-align: middle; `, - seleFir: css` - background-color: #FFF3D9; - color: #FFAD01; + sec: css` + color: #5BD941 `, - seleSec: css` - background-color: #DCF9D6; + seleEight: css` + background-color: #D1FFE7; color: #5BD941; `, - seleThd: css` - background-color: #E3E9FF; - color: #003BFF; + seleFif: css` + background-color: #FFEBEB; + color: #FF4D4D; + `, + seleFir: css` + background-color: #FFF3D9; + color: #FFAD01; `, seleFou: css` background-color: #FFFACD; color: #FF9B06; `, - seleFif: css` - background-color: #FFEBEB; - color: #FF4D4D; + seleNine: css` + background-color: #D1FFE7; + color: #07D7F7; `, - seleSix: css` - background-color: #E3E9FF; - color: #003BFF; + seleSec: css` + background-color: #DCF9D6; + color: #5BD941; `, seleSeve: css` background-color: #D8FAFF; color: #0EDFFF; `, - seleEight: css` - background-color: #D1FFE7; - color: #5BD941; - `, - seleNine: css` - background-color: D1FFE7; - color: #07D7F7; + seleSix: css` + background-color: #E3E9FF; + color: #003BFF; `, seleTen: css` background-color: #FCEBFF; color: #E138FF; `, - leftTitle: css` - font-size: 20px; - margin: 0 1%; - padding-top: 20px; + seleThd: css` + background-color: #E3E9FF; + color: #003BFF; `, - card: css` - width: 23%; - margin: 32px 1% 0; - display: inline-block; + selectBtn: css` + background-color: #3B6FFF !important; + color: #fff !important; `, - rightCo: css` - font-size: 16px; - margin-left: 30px; - vertical-align: middle; + seven: css` + color: #0EDFFF `, - avImg: css` - width: 55px; - height: 55px; - border-radius: 16px + six: css` + color: #003BFF `, - desText: css` - font-size: 12px; - color: #909090; + ten: css` + color: #E138FF + `, + thd: css` + color: #003BFF `, title: css` font-size: 18px `, - cardMeta: css` - height: 80px - `, - actionSpan: css` - color: #2E62FF; - `, - desImg: css` - width: 28px + topBtn: css` + padding: 10px 0px; + background: rgba(239, 243, 255, 0.22); + box-sizing: border-box; + border-width: 0px 0px 2px 0px; + border-style: solid; + border-color: rgba(146, 154, 178, 0.2392); `, - cardCotain: css` - margin-top: -10px; - font-size: 12px; - color: #999 + verImg: css` + height: 2px; + width: 80%; + background-color: #DFE4FF; + display: inline-block `, zsds: css` display: inline-block; @@ -758,21 +700,22 @@ const useStyles = createStyles(({css, token}) => ({ border: 2px solid #ddd; display: inline-block `, - verImg: css` - height: 2px; - width: 80%; - background-color: #DFE4FF; - display: inline-block - `, - container: css` - marginTop: -20px - `, - containerTitle: css` - font-size: 18px - ` })) -const Filescon = memo(() => { +const getContainer = () => document.querySelector("#fileRight") +const handleClickCard = (e) => { + window.open(e.website, '_blank'); +} + +const onClickAncho = (e,link) => { + e.preventDefault() + let srcolls = document.querySelector(link.href) + srcolls.scrollIntoView({ + behavior: 'smooth', + block: 'start' + }) +} +const ApplicationSet = memo(() => { const { styles, cx } = useStyles() const [val, setVal] = useState("AI") const [achVal, setAchVal] = useState("#rmtj") @@ -780,20 +723,19 @@ const Filescon = memo(() => { useEffect(() => { const fetchData = () => { request({ - url: "/flxai/api/robot/apptoolsset/getAllAiTools", method: "get", + url: "/flxai/api/robot/apptoolsset/getAllAiTools", }).then(response => { - if (response.code == 0) { - console.log(response,222222222) + if (response.code === 0) { + console.log(response,"2222") setStData(response.data); } }).catch(error => { - console.error('Error fetching data: ', error); + console.error('Error fetching data:', error); }) }; fetchData(); }, []); // 空数组[]意味着仅在组件挂载时调用一次 - const getContainer = () => document.getElementById("fileRight") const handleClick = (e) => { setVal(e) @@ -803,98 +745,85 @@ const Filescon = memo(() => { setAchVal(e) } - const handleClickCard = (e) => { - window.open(e.website, '_blank'); - } - - const onClickAncho = (e,link) => { - e.preventDefault() - let srcolls = document.querySelector(link.href) - srcolls.scrollIntoView({ - behavior: 'smooth', - block: 'start' - }) - } - return ( <>
- - + +
- {val == 'AI' ? <> + {val === 'AI' ? <> onChangeAnchor(e)} items={[ { - key: '1', href: '#rmtj', - title:
热门推荐
, }, { - key: '2', href: '#ailt', - title:
AI聊天
, }, { - key: '3', href: '#aixz', - title:
AI写作
, }, { - key: '4', href: '#aihh', - title:
+ key: '4', + title:
AI绘画
, }, { - key: '5', href: '#aisp', - title:
AI视频
, }, { - key: '6', href: '#aibg', - title:
AI办公
, }, { - key: '7', href: '#aiszr', - title:
AI数字人
, }, { - key: '8', href: '#aijy', - title:
AI教育
, }, { - key: '9', href: '#aibc', - title:
AI编程
, }, { - key: '10', href: '#aiyp', - title:
AI音频
, }, ]} + onChange={(e) => onChangeAnchor(e)} + onClick={onClickAncho} + style={{ background: "#fff", width: '200px' }} /> -
+
热门推荐
@@ -902,15 +831,16 @@ const Filescon = memo(() => { stData['rmtj'] && stData['rmtj'].map((e) => { return ( handleClickCard(e)} className={styles.actionSpan}>立即前往 handleClickCard(e)}>立即前往]} + className={cx(styles.card)} + key={e.id} > } className={styles.cardMeta} - avatar={} - title={{e.name}} description={{e.remark}} + title={{e.name}} /> ) @@ -925,14 +855,15 @@ const Filescon = memo(() => { stData['chat'] && stData['chat'].map((e) => { return ( handleClickCard(e)}>立即前往]} className={cx(styles.card)} - actions={[ handleClickCard(e)} className={styles.actions}>立即前往]} + key={e.id} > } className={styles.cardMeta} - avatar={} - title={{e.name}} description={{e.remark}} + title={{e.name}} /> ) @@ -947,15 +878,16 @@ const Filescon = memo(() => { stData['writing'] && stData['writing'].map((e) => { return ( handleClickCard(e)} className={styles.actionSpan}>立即前往 handleClickCard(e)}>立即前往]} + className={cx(styles.card)} + key={e.id} > } className={styles.cardMeta} - avatar={} - title={{e.name}} description={{e.remark}} + title={{e.name}} /> ) @@ -970,15 +902,16 @@ const Filescon = memo(() => { stData['conversation'] && stData['conversation'].map((e) => { return ( handleClickCard(e)} className={styles.actionSpan}>立即前往 handleClickCard(e)}>立即前往]} + className={cx(styles.card)} + key={e.id} > } className={styles.cardMeta} - avatar={} - title={{e.name}} description={{e.remark}} + title={{e.name}} /> ) @@ -993,15 +926,16 @@ const Filescon = memo(() => { stData['video'] && stData['video'].map((e) => { return ( handleClickCard(e)} className={styles.actionSpan}>立即前往 handleClickCard(e)}>立即前往]} + className={cx(styles.card)} + key={e.id} > } className={styles.cardMeta} - avatar={} - title={{e.name}} description={{e.remark}} + title={{e.name}} /> ) @@ -1016,15 +950,16 @@ const Filescon = memo(() => { stData['office'] && stData['office'].map((e) => { return ( handleClickCard(e)} className={styles.actionSpan}>立即前往 handleClickCard(e)}>立即前往]} + className={cx(styles.card)} + key={e.id} > } className={styles.cardMeta} - avatar={} - title={{e.name}} description={{e.remark}} + title={{e.name}} /> ) @@ -1039,15 +974,16 @@ const Filescon = memo(() => { stData['digitalPeople'] && stData['digitalPeople'].map((e) => { return ( handleClickCard(e)}>立即前往]} className={cx(styles.card)} - actions={[ handleClickCard(e)} className={styles.actionSpan}>立即前往]} + key={e.id} > } className={styles.cardMeta} - avatar={} - title={{e.name}} description={{e.remark}} + title={{e.name}} /> ) @@ -1062,15 +998,16 @@ const Filescon = memo(() => { stData['education'] && stData['education'].map((e) => { return ( handleClickCard(e)} className={styles.actionSpan}>立即前往 handleClickCard(e)}>立即前往]} + className={cx(styles.card)} + key={e.id} > } - title={ handleClickCard(e)} className={styles.title}>{e.name}} + avatar={} + className={styles.cardMeta} description={{e.remark}} + title={{e.name}} /> ) @@ -1085,15 +1022,16 @@ const Filescon = memo(() => { stData['programming'] && stData['programming'].map((e) => { return ( handleClickCard(e)} className={styles.actionSpan}>立即前往 handleClickCard(e)}>立即前往]} + className={cx(styles.card)} + key={e.id} > } - title={{e.name}} + avatar={} + className={styles.cardMeta} description={{e.remark}} + title={{e.name}} /> ) @@ -1108,15 +1046,16 @@ const Filescon = memo(() => { stData['audio'] && stData['audio'].map((e) => { return ( handleClickCard(e)} className={styles.actionSpan}>立即前往 handleClickCard(e)}>立即前往]} + className={cx(styles.card)} + key={e.id} > } - title={{e.name}} + avatar={} + className={styles.cardMeta} description={{e.remark}} + title={{e.name}} /> ) @@ -1127,28 +1066,28 @@ const Filescon = memo(() => {
: - <> -
+
助手列表
{ stList.map((e) => { return ( 查看详情查看详情]} + className={cx(styles.card)} + key={e.id} >
{e.title}
- +
- + 助手大师 {e.date}
@@ -1160,11 +1099,10 @@ const Filescon = memo(() => { }
- }
); }); -export default Filescon; +export default ApplicationSet; diff --git a/DigitalHumanWeb/src/app/(main)/applicationset/page.tsx b/DigitalHumanWeb/src/app/(main)/applicationset/page.tsx new file mode 100644 index 0000000..b831be6 --- /dev/null +++ b/DigitalHumanWeb/src/app/(main)/applicationset/page.tsx @@ -0,0 +1,50 @@ +// import StructuredData from '@/components/StructuredData'; +import { Locales } from '@/locales/resources'; +// import { ldModule } from '@/server/ld'; +import { metadataModule } from '@/server/metadata'; +// import { DiscoverService } from '@/server/services/discover'; +import { translation } from '@/server/translation'; +// import { isMobileDevice } from '@/utils/responsive'; +import ApplicationSet from "./applicationset"; + +// import {Button} from "antd"; + + +type Props = { searchParams: { hl?: Locales } }; + +export const generateMetadata = async ({ searchParams }: Props) => { + const { t, locale } = await translation('metadata', searchParams?.hl); + return metadataModule.generate({ + alternate: true, + description: t('files.description'), + locale, + title: t('files.title'), + url: '/files', + }); +}; + +const Page = async () => { + // const { t, locale } = await translation('metadata', searchParams?.hl); + // const mobile = isMobileDevice(); + + // const discoverService = new DiscoverService(); + // const items = await discoverService.getAssistantList(locale); + + // const ld = ldModule.generate({ + // description: t('files.description'), + // title: t('files.title'), + // url: '/files', + // webpage: { + // enable: true, + // search: '/files/search', + // }, + // }); + + return ( + + ); +}; + +Page.DisplayName = 'DiscoverAssistants'; + +export default Page; diff --git a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/@topic/features/SystemRole/SystemRoleContent.tsx b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/@topic/features/SystemRole/SystemRoleContent.tsx index 69e845d..510cdd1 100644 --- a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/@topic/features/SystemRole/SystemRoleContent.tsx +++ b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/@topic/features/SystemRole/SystemRoleContent.tsx @@ -70,7 +70,7 @@ const SystemRole = memo(() => { /> { if (e.altKey) handleOpenWithEdit(); diff --git a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/HeaderAction.tsx b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/HeaderAction.tsx index 2786c01..212de08 100644 --- a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/HeaderAction.tsx +++ b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/HeaderAction.tsx @@ -1,43 +1,40 @@ 'use client'; -// import { ActionIcon } from '@lobehub/ui'; -// import { PanelRightClose, PanelRightOpen } from 'lucide-react'; +import { ActionIcon } from '@lobehub/ui'; +import { PanelRightClose, PanelRightOpen } from 'lucide-react'; import { memo } from 'react'; -// import { useTranslation } from 'react-i18next'; +import { useTranslation } from 'react-i18next'; -// import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens'; -// import { useGlobalStore } from '@/store/global'; -// import { systemStatusSelectors } from '@/store/global/selectors'; -// import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig'; +import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens'; +import { useGlobalStore } from '@/store/global'; +import { systemStatusSelectors } from '@/store/global/selectors'; +import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig'; -// import SettingButton from '../../../features/SettingButton'; +import SettingButton from '../../../features/SettingButton'; // import ShareButton from '../../../features/ShareButton'; -import {Button} from "antd"; -import { useOpenChatSettings } from '@/hooks/useInterceptingRoutes'; +import ShareText from '../../../features/ShareText'; const HeaderAction = memo(() => { - // const { t } = useTranslation('chat'); + const { t } = useTranslation('chat'); - // const [showAgentSettings, toggleConfig] = useGlobalStore((s) => [ - // systemStatusSelectors.showChatSideBar(s), - // s.toggleChatSideBar, - // ]); + const [showAgentSettings, toggleConfig] = useGlobalStore((s) => [ + systemStatusSelectors.showChatSideBar(s), + s.toggleChatSideBar, + ]); - // const { isAgentEditable } = useServerConfigStore(featureFlagsSelectors); - - const openChatSettings = useOpenChatSettings(); + const { isAgentEditable } = useServerConfigStore(featureFlagsSelectors); return ( <> - + {/**/} - {/* toggleConfig()}*/} - {/* size={DESKTOP_HEADER_ICON_SIZE}*/} - {/* title={t('roleAndArchive')}*/} - {/*/>*/} - {/*{isAgentEditable && }*/} + {isAgentEditable && } + toggleConfig()} + size={DESKTOP_HEADER_ICON_SIZE} + title={t('roleAndArchive')} + /> ); }); diff --git a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Main.tsx b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Main.tsx index 2b67da4..8c7a81a 100644 --- a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Main.tsx +++ b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Main.tsx @@ -1,28 +1,28 @@ 'use client'; -import { Avatar } from '@lobehub/ui'; +import { ActionIcon, Avatar, ChatHeaderTitle } from '@lobehub/ui'; import { Skeleton } from 'antd'; -// import { PanelLeftClose, PanelLeftOpen } from 'lucide-react'; +import { PanelLeftClose, PanelLeftOpen } from 'lucide-react'; import { Suspense, memo } from 'react'; import { useTranslation } from 'react-i18next'; import { Flexbox } from 'react-layout-kit'; -// import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens'; +import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens'; import { useOpenChatSettings } from '@/hooks/useInterceptingRoutes'; -// import { useGlobalStore } from '@/store/global'; -// import { systemStatusSelectors } from '@/store/global/selectors'; +import { useGlobalStore } from '@/store/global'; +import { systemStatusSelectors } from '@/store/global/selectors'; import { useSessionStore } from '@/store/session'; import { sessionMetaSelectors, sessionSelectors } from '@/store/session/selectors'; import { useInitAgentConfig } from '../../useInitAgentConfig'; -// import Tags from './Tags'; +import Tags from './Tags'; const Main = memo(() => { const { t } = useTranslation('chat'); useInitAgentConfig(); - const [init, isInbox, title, avatar, backgroundColor] = useSessionStore((s) => [ + const [init, isInbox, title, description, avatar, backgroundColor] = useSessionStore((s) => [ sessionSelectors.isSomeSessionActive(s), sessionSelectors.isInboxSession(s), sessionMetaSelectors.currentAgentTitle(s), @@ -34,9 +34,9 @@ const Main = memo(() => { const openChatSettings = useOpenChatSettings(); const displayTitle = isInbox ? t('inbox.title') : title; - // const displayDesc = isInbox ? t('inbox.desc') : description; - // const showSessionPanel = useGlobalStore(systemStatusSelectors.showSessionPanel); - // const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus); + const displayDesc = isInbox ? t('inbox.desc') : description; + const showSessionPanel = useGlobalStore(systemStatusSelectors.showSessionPanel); + const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus); return !init ? ( @@ -49,20 +49,20 @@ const Main = memo(() => { ) : ( - {/*{*/} - {/* {*/} - {/* updateSystemStatus({*/} - {/* sessionsWidth: showSessionPanel ? 0 : 320,*/} - {/* showSessionPanel: !showSessionPanel,*/} - {/* });*/} - {/* }}*/} - {/* size={DESKTOP_HEADER_ICON_SIZE}*/} - {/* title={t('agents')}*/} - {/* />*/} - {/*}*/} + { + { + updateSystemStatus({ + sessionsWidth: showSessionPanel ? 0 : 320, + showSessionPanel: !showSessionPanel, + }); + }} + size={DESKTOP_HEADER_ICON_SIZE} + title={t('agents')} + /> + } { size={40} title={title} /> -
-
{displayTitle}
- {/**/} -
{displayTitle}
-
+ } title={displayTitle} />
); }); diff --git a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/_layout/Desktop/TopicPanel.tsx b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/_layout/Desktop/TopicPanel.tsx index 142ff80..ed5f8aa 100644 --- a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/_layout/Desktop/TopicPanel.tsx +++ b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/_layout/Desktop/TopicPanel.tsx @@ -3,26 +3,21 @@ import { DraggablePanel, DraggablePanelContainer } from '@lobehub/ui'; import { createStyles, useResponsive } from 'antd-style'; import isEqual from 'fast-deep-equal'; -import { memo, useEffect, useState } from 'react'; +import { PropsWithChildren, memo, useEffect, useState } from 'react'; -// import SafeSpacing from '@/components/SafeSpacing'; +import SafeSpacing from '@/components/SafeSpacing'; import { CHAT_SIDEBAR_WIDTH } from '@/const/layoutTokens'; import { useChatStore } from '@/store/chat'; import { chatPortalSelectors } from '@/store/chat/slices/portal/selectors'; import { useGlobalStore } from '@/store/global'; import { systemStatusSelectors } from '@/store/global/selectors'; -import {Form, Image} from "antd"; -import {EditFilled} from "@ant-design/icons"; -import TopicListContent from "@/app/(main)/chat/(workspace)/@topic/features/TopicListContent"; -import Header from "@/app/(main)/chat/(workspace)/@topic/features/Header"; +import { Image } from "antd"; const useStyles = createStyles(({ css, token }) => ({ content: css` display: flex; flex-direction: column; - height: calc(100% - 64px) !important; - margin-top: 64px; - width: 363px !important; + height: 100% !important; `, drawer: css` z-index: 10; @@ -31,24 +26,10 @@ const useStyles = createStyles(({ css, token }) => ({ header: css` border-block-end: 1px solid ${token.colorBorder}; `, - topEdit: css` - display: inline-block; - text-align: center; - width: 24px; - height: 24px; - background-color: #AFC1FF; - color: #fff; - `, - topTitle: css` - font-size: 18px; - display: inline-block; - width: calc(100% - 24px) - `, })); -const TopicPanel = memo(() => { +const TopicPanel = memo(({ children }: PropsWithChildren) => { const { styles } = useStyles(); - const [form] = Form.useForm() const { md = true, lg = true } = useResponsive(); const [showAgentSettings, toggleConfig] = useGlobalStore((s) => [ systemStatusSelectors.showChatSideBar(s), @@ -87,38 +68,13 @@ const TopicPanel = memo(() => { style={{ flex: 'none', height: '100%', - border: "1px solid #ddd", maxHeight: '100vh', minWidth: CHAT_SIDEBAR_WIDTH, }} > -
-
助手角色设定
-
-
+
头像
-
- - Linda - - - 这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介这是一段简介 - - - 这是一段任务这是一段任务这是一段任务这是一段任务这是一段任务这是一段任务这是一段任务这是一段任务这是一段任务这是一段任务 - -
- {/*
*/} - {/*
话题
*/} - {/*
*/} -
-
- -
- {/*
*/} - {/*
*/} - {/**/} - {/*{children}*/} + {children} ) diff --git a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/SettingButton.tsx b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/SettingButton.tsx index e809236..1b2f73c 100644 --- a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/SettingButton.tsx +++ b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/SettingButton.tsx @@ -1,24 +1,19 @@ 'use client'; -import { ActionIcon } from '@lobehub/ui'; -import { AlignJustify } from 'lucide-react'; +// import { ActionIcon } from '@lobehub/ui'; +// import { AlignJustify } from 'lucide-react'; import { memo } from 'react'; -import { useTranslation } from 'react-i18next'; - -import { DESKTOP_HEADER_ICON_SIZE, MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens'; +// import { useTranslation } from 'react-i18next'; +import {Button} from "antd"; +// import { DESKTOP_HEADER_ICON_SIZE, MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens'; import { useOpenChatSettings } from '@/hooks/useInterceptingRoutes'; -const SettingButton = memo<{ mobile?: boolean }>(({ mobile }) => { - const { t } = useTranslation('common'); +const SettingButton = memo<{ mobile?: boolean }>(() => { + // const { t } = useTranslation('common'); const openChatSettings = useOpenChatSettings(); return ( - openChatSettings()} - size={mobile ? MOBILE_HEADER_ICON_SIZE : DESKTOP_HEADER_ICON_SIZE} - title={t('header.session', { ns: 'setting' })} - /> + ); }); diff --git a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/Preview.tsx b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/Preview.tsx new file mode 100644 index 0000000..0254cb4 --- /dev/null +++ b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/Preview.tsx @@ -0,0 +1,16 @@ +import { Markdown } from '@lobehub/ui'; +import { memo } from 'react'; + +import { useContainerStyles } from '../style'; + +const Preview = memo<{ content: string }>(({ content }) => { + const { styles } = useContainerStyles(); + + return ( +
+ {content} +
+ ); +}); + +export default Preview; diff --git a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/index.tsx b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/index.tsx new file mode 100644 index 0000000..5a4417e --- /dev/null +++ b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/index.tsx @@ -0,0 +1,102 @@ +// import { Form, type FormItemProps, Icon, copyToClipboard } from '@lobehub/ui'; +import { Button } from 'antd'; +import isEqual from 'fast-deep-equal'; +// import { CopyIcon } from 'lucide-react'; +import { memo } from 'react'; +import { useTranslation } from 'react-i18next'; +import { Flexbox } from 'react-layout-kit'; + +// import { FORM_STYLE } from '@/const/layoutTokens'; +import { useIsMobile } from '@/hooks/useIsMobile'; +import { useAgentStore } from '@/store/agent'; +import { agentSelectors } from '@/store/agent/selectors'; +import { useChatStore } from '@/store/chat'; +import { chatSelectors, topicSelectors } from '@/store/chat/selectors'; +import { FieldType } from './type'; +import { LOADING_FLAT } from '@/const/message'; +import { stringify as csvStringify } from 'csv-stringify'; + +const DEFAULT_FIELD_VALUE: FieldType = { + includeTool: true, + includeUser: true, + withRole: true, + withSystemRole: false, +}; + +const ShareText = memo(() => { + // const [fieldValue, setFieldValue] = useState(DEFAULT_FIELD_VALUE); + const { t } = useTranslation(['chat', 'common']); + + // const { message } = App.useApp(); + + const [systemRole] = useAgentStore((s) => [agentSelectors.currentAgentSystemRole(s)]); + const messages = useChatStore(chatSelectors.currentChats, isEqual); + const topic = useChatStore(topicSelectors.currentActiveTopic, isEqual); + console.log(systemRole,messages,'83737373737') + let messagesNew = messages + .filter((m) => m.content !== LOADING_FLAT) + .filter((m) => (!DEFAULT_FIELD_VALUE.includeUser ? m.role !== 'user' : true)) + .filter((m) => (!DEFAULT_FIELD_VALUE.includeTool ? m.role !== 'tool' : true)) + + console.log(messagesNew,'111111111111111') + const topicTitle = topic?.title || t('shareModal.exportTitle'); + console.log(topicTitle,'22222222222222222') + const isMobile = useIsMobile(); + const downloadCSV = () => { + const data = [ + ["question", "answer"], + ]; + let arrItem = []; + messagesNew.forEach((chat)=> { + if (chat.role === 'assistant') { + arrItem.push(chat.content) + } else if(chat.role === 'user') { + arrItem.unshift(chat.content) + } + if(arrItem.length >= 2) { + data.push(arrItem) + arrItem = []; + } + }) + console.log(data,'9999111111') + // 将数据转换为CSV字符串 + let csvContent = ""; + csvStringify(data, (err, output) => { + if (err) { + console.error('Error generating CSV:', err); + return; + } + + // 输出 CSV 字符串 + console.log(output,'66666666666666'); + csvContent = output + + // 创建一个Blob对象 + const blob = new Blob([csvContent], { type: 'text/csv' }); + + // 创建一个URL并指向Blob对象 + const url = URL.createObjectURL(blob); + + // 创建一个隐藏的标签并点击它以触发下载 + const a = document.createElement('a'); + a.setAttribute('hidden', ''); + a.setAttribute('href', url); + a.setAttribute('download', topicTitle + '.csv'); + document.body.append(a); + a.click(); + + // 移除标签 + a.remove(); + + // 释放URL对象 + URL.revokeObjectURL(url); + }); + } + return ( + + + + ); +}); + +export default ShareText; diff --git a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/template.test.ts b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/template.test.ts new file mode 100644 index 0000000..6466ade --- /dev/null +++ b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/template.test.ts @@ -0,0 +1,178 @@ +import { describe, expect, it } from 'vitest'; + +import { LOADING_FLAT } from '@/const/message'; +import { ChatMessage } from '@/types/message'; + +import { generateMarkdown } from './template'; + +describe('generateMarkdown', () => { + // 创建测试用的消息数据 + const mockMessages = [ + { + id: '1', + content: 'Hello', + role: 'user', + createdAt: Date.now(), + }, + { + id: '2', + content: 'Hi there', + role: 'assistant', + createdAt: Date.now(), + }, + { + id: '3', + content: LOADING_FLAT, + role: 'assistant', + createdAt: Date.now(), + }, + { + id: '4', + content: '{"result": "tool data"}', + role: 'tool', + createdAt: Date.now(), + tool_call_id: 'tool1', + }, + { + id: '5', + content: 'Message with tools', + role: 'assistant', + createdAt: Date.now(), + tools: [{ name: 'calculator', result: '42' }], + }, + ] as ChatMessage[]; + + const defaultParams = { + messages: mockMessages, + title: 'Chat Title', + includeTool: false, + includeUser: true, + withSystemRole: false, + withRole: false, + systemRole: '', + }; + + it('should generate basic markdown with title', () => { + const result = generateMarkdown(defaultParams); + + expect(result).toContain('# Chat Title'); + expect(result).toContain('Hello'); + expect(result).toContain('Hi there'); + }); + + it('should include system role when withSystemRole is true', () => { + const systemRole = 'I am a helpful assistant'; + const result = generateMarkdown({ + ...defaultParams, + withSystemRole: true, + systemRole, + }); + + expect(result).toContain('````md\nI am a helpful assistant\n````'); + }); + + it('should not include system role when withSystemRole is false', () => { + const systemRole = 'I am a helpful assistant'; + const result = generateMarkdown({ + ...defaultParams, + withSystemRole: false, + systemRole, + }); + + expect(result).not.toContain('```\nI am a helpful assistant\n```'); + }); + + it('should add role labels when withRole is true', () => { + const result = generateMarkdown({ + ...defaultParams, + withRole: true, + }); + + expect(result).toContain('##### User:'); + expect(result).toContain('##### Assistant:'); + }); + + it('should not add role labels when withRole is false', () => { + const result = generateMarkdown({ + ...defaultParams, + withRole: false, + }); + + expect(result).not.toContain('##### User:'); + expect(result).not.toContain('##### Assistant:'); + }); + + it('should include tool messages when includeTool is true', () => { + const result = generateMarkdown({ + ...defaultParams, + includeTool: true, + withRole: true, + }); + + expect(result).toContain('##### Tools Calling:'); + expect(result).toContain('```json\n{"result": "tool data"}\n```'); + }); + + it('should exclude tool messages when includeTool is false', () => { + const result = generateMarkdown({ + ...defaultParams, + includeTool: false, + }); + + expect(result).not.toContain('{"result": "tool data"}'); + }); + + it('should exclude user messages when includeUser is false', () => { + const result = generateMarkdown({ + ...defaultParams, + includeUser: false, + }); + + expect(result).not.toContain('Hello'); + expect(result).toContain('Hi there'); + }); + + it('should filter out loading messages', () => { + const result = generateMarkdown(defaultParams); + + expect(result).not.toContain(LOADING_FLAT); + }); + + it('should include tools data when includeTool is true', () => { + const result = generateMarkdown({ + ...defaultParams, + includeTool: true, + }); + + expect(result).toContain('"name": "calculator"'); + expect(result).toContain('"result": "42"'); + }); + + it('should handle empty messages array', () => { + const result = generateMarkdown({ + ...defaultParams, + messages: [], + }); + + expect(result).toContain('# Chat Title'); + // Should not throw error and should contain at least the title + }); + + it('should handle messages with special characters', () => { + const messagesWithSpecialChars = [ + { + id: '1', + content: '**Bold** *Italic* `Code`', + role: 'user', + createdAt: Date.now(), + }, + ] as ChatMessage[]; + + const result = generateMarkdown({ + ...defaultParams, + messages: messagesWithSpecialChars, + }); + + expect(result).toContain('**Bold** *Italic* `Code`'); + }); +}); diff --git a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/template.ts b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/template.ts new file mode 100644 index 0000000..ba1d468 --- /dev/null +++ b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/template.ts @@ -0,0 +1,79 @@ +import { template } from 'lodash-es'; + +import { LOADING_FLAT } from '@/const/message'; +import { FieldType } from '@/features/ShareModal/ShareText/type'; +import { ChatMessage } from '@/types/message'; + +const markdownTemplate = template( + `# {{title}} + +<% if (systemRole) { %> +\`\`\`\`md +{{systemRole}} +\`\`\`\` +<% } %> + +<% messages.forEach(function(chat) { %> + +<% if (withRole) { %> + +<% if (chat.role === 'user') { %> +##### User: +<% } else if (chat.role === 'assistant') { %> +##### Assistant: +<% } else if (chat.role === 'tool') { %> +##### Tools Calling: +<% } %> + +<% } %> + +<% if (chat.role === 'tool') { %> +\`\`\`json +{{chat.content}} +\`\`\` +<% } else { %> + +{{chat.content}} + +<% if (includeTool && chat.tools) { %> + +\`\`\`json +{{JSON.stringify(chat.tools, null, 2)}} +\`\`\` + +<% } %> +<% } %> + +<% }); %> +`, + { + evaluate: /<%([\S\s]+?)%>/g, + interpolate: /{{([\S\s]+?)}}/g, + }, +); + +interface MarkdownParams extends FieldType { + messages: ChatMessage[]; + systemRole: string; + title: string; +} + +export const generateMarkdown = ({ + messages, + title, + includeTool, + includeUser, + withSystemRole, + withRole, + systemRole, +}: MarkdownParams) => + markdownTemplate({ + includeTool, + messages: messages + .filter((m) => m.content !== LOADING_FLAT) + .filter((m) => (!includeUser ? m.role !== 'user' : true)) + .filter((m) => (!includeTool ? m.role !== 'tool' : true)), + systemRole: withSystemRole ? systemRole : undefined, + title, + withRole, + }); diff --git a/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/type.ts b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/type.ts new file mode 100644 index 0000000..9e7c934 --- /dev/null +++ b/DigitalHumanWeb/src/app/(main)/chat/(workspace)/features/ShareText/type.ts @@ -0,0 +1,6 @@ +export type FieldType = { + includeTool: boolean; + includeUser: boolean; + withRole: boolean; + withSystemRole: boolean; +}; diff --git a/DigitalHumanWeb/src/app/(main)/chat/@session/_layout/Desktop/SessionHeader.tsx b/DigitalHumanWeb/src/app/(main)/chat/@session/_layout/Desktop/SessionHeader.tsx index 24baaf3..0013eed 100644 --- a/DigitalHumanWeb/src/app/(main)/chat/@session/_layout/Desktop/SessionHeader.tsx +++ b/DigitalHumanWeb/src/app/(main)/chat/@session/_layout/Desktop/SessionHeader.tsx @@ -1,18 +1,18 @@ 'use client'; -import { ActionIcon } from '@lobehub/ui'; +// import { ActionIcon } from '@lobehub/ui'; import { createStyles } from 'antd-style'; -import { MessageSquarePlus } from 'lucide-react'; +// import { MessageSquarePlus } from 'lucide-react'; import { memo } from 'react'; -import { useTranslation } from 'react-i18next'; +// import { useTranslation } from 'react-i18next'; import { Flexbox } from 'react-layout-kit'; -import { ProductLogo } from '@/components/Branding'; -import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens'; -import SyncStatusTag from '@/features/SyncStatusInspector'; -import { useActionSWR } from '@/libs/swr'; -import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig'; -import { useSessionStore } from '@/store/session'; +// import { ProductLogo } from '@/components/Branding'; +// import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens'; +// import SyncStatusTag from '@/features/SyncStatusInspector'; +// import { useActionSWR } from '@/libs/swr'; +// import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig'; +// import { useSessionStore } from '@/store/session'; import SessionSearchBar from '../../features/SessionSearchBar'; @@ -30,31 +30,15 @@ export const useStyles = createStyles(({ css, token }) => ({ const Header = memo(() => { const { styles } = useStyles(); - const { t } = useTranslation('chat'); - const [createSession] = useSessionStore((s) => [s.createSession]); - const { enableWebrtc, showCreateSession } = useServerConfigStore(featureFlagsSelectors); + // const { t } = useTranslation('chat'); + // const [createSession] = useSessionStore((s) => [s.createSession]); + // const { enableWebrtc, showCreateSession } = useServerConfigStore(featureFlagsSelectors); - const { mutate, isValidating } = useActionSWR('session.createSession', () => createSession()); + // const { mutate, isValidating } = useActionSWR('session.createSession', () => createSession()); return ( - {/**/} - {/* */} - {/* */} - {/* {enableWebrtc && }*/} - {/* */} - {/* {showCreateSession && (*/} - {/* mutate()}*/} - {/* size={DESKTOP_HEADER_ICON_SIZE}*/} - {/* style={{ flex: 'none' }}*/} - {/* title={t('newAgent')}*/} - {/* />*/} - {/* )}*/} - {/**/} - {/**/} + ); }); diff --git a/DigitalHumanWeb/src/app/(main)/chat/@session/features/SessionListContent/Inbox/index.tsx b/DigitalHumanWeb/src/app/(main)/chat/@session/features/SessionListContent/Inbox/index.tsx index bb9e40f..2d4e670 100644 --- a/DigitalHumanWeb/src/app/(main)/chat/@session/features/SessionListContent/Inbox/index.tsx +++ b/DigitalHumanWeb/src/app/(main)/chat/@session/features/SessionListContent/Inbox/index.tsx @@ -2,38 +2,33 @@ import Link from 'next/link'; import { memo } from 'react'; import { useTranslation } from 'react-i18next'; -import { DEFAULT_INBOX_AVATAR } from '@/const/meta'; +// import { DEFAULT_INBOX_AVATAR } from '@/const/meta'; import { INBOX_SESSION_ID } from '@/const/session'; import { SESSION_CHAT_URL } from '@/const/url'; import { useServerConfigStore } from '@/store/serverConfig'; -import { useSessionStore } from '@/store/session'; +// import { useSessionStore } from '@/store/session'; -import ListItem from '../ListItem'; +// import ListItem from '../ListItem'; import { useSwitchSession } from '../useSwitchSession'; import {Image} from "antd"; const Inbox = memo(() => { const { t } = useTranslation('chat'); const mobile = useServerConfigStore((s) => s.isMobile); - const activeId = useSessionStore((s) => s.activeId); + // const activeId = useSessionStore((s) => s.activeId); const switchSession = useSwitchSession(); return ( { e.preventDefault(); switchSession(INBOX_SESSION_ID); }} + style={{ textAlign: 'center' }} > - {'sbChat'} - {/**/} + {'sbChat'} ); }); diff --git a/DigitalHumanWeb/src/app/(main)/chat/@session/features/SessionListContent/List/Item/index.tsx b/DigitalHumanWeb/src/app/(main)/chat/@session/features/SessionListContent/List/Item/index.tsx index 77e4cf9..0e32fa2 100644 --- a/DigitalHumanWeb/src/app/(main)/chat/@session/features/SessionListContent/List/Item/index.tsx +++ b/DigitalHumanWeb/src/app/(main)/chat/@session/features/SessionListContent/List/Item/index.tsx @@ -27,7 +27,6 @@ const SessionItem = memo(({ id }) => { const [active] = useSessionStore((s) => [s.activeId === id]); const [loading] = useChatStore((s) => [chatSelectors.isAIGenerating(s) && id === s.activeId]); - const [pin, title, description, avatar, avatarBackground, updateAt, model, group] = useSessionStore((s) => { const session = sessionSelectors.getSessionById(id)(s); @@ -72,7 +71,6 @@ const SessionItem = memo(({ id }) => { return ( <> (({ id }) => { loading={loading} pin={pin} showAction={open} + style={{ position: "relative"}} title={title} > - {window.localStorage.getItem("nowChat") == id ?
-
正在会话
: <>} + {active ?
+
正在会话
: null}
(({ dataSource, groupId, showAddButton onClick={(e) => { e.preventDefault(); switchSession(id); - localStorage.setItem("nowChat", id) }} > diff --git a/DigitalHumanWeb/src/app/(main)/chat/_layout/Desktop/index.tsx b/DigitalHumanWeb/src/app/(main)/chat/_layout/Desktop/index.tsx index 4419880..b2d27e4 100644 --- a/DigitalHumanWeb/src/app/(main)/chat/_layout/Desktop/index.tsx +++ b/DigitalHumanWeb/src/app/(main)/chat/_layout/Desktop/index.tsx @@ -10,7 +10,7 @@ const Layout = ({ children, session }: LayoutProps) => { {session} diff --git a/DigitalHumanWeb/src/app/(main)/chat/settings/modal/page.tsx b/DigitalHumanWeb/src/app/(main)/chat/settings/modal/page.tsx index 8863499..ec1db5c 100644 --- a/DigitalHumanWeb/src/app/(main)/chat/settings/modal/page.tsx +++ b/DigitalHumanWeb/src/app/(main)/chat/settings/modal/page.tsx @@ -14,6 +14,7 @@ const ChatSettingsModalFallback = () => { const router = useQueryRoute(); useLayoutEffect(() => { + router.replace('/chat/settings', { query: { tab: '' } }); }, []); 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 c7d3ca6..c1b7f9f 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 @@ -16,11 +16,31 @@ import { DiscoverAssistantItem } from '@/types/discover'; import { useUserStore } from '@/store/user'; import GitHubAvatar from '../../../../components/GitHubAvatar'; import Actions from './Actions'; + export const useStyles = createStyles(({ css, token }) => ({ + conTitle: css` + width: 125px; + height: 40px; + line-height: 40px; + 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; + margin-top: 10px; + `, + // tag: css` + // color: ${token.colorTextSecondary}; + // background: ${token.colorFillSecondary}; + // border: none; + // `, tag: css` - color: ${token.colorTextSecondary}; - background: ${token.colorFillSecondary}; - border: none; + padding: 0px 45px; + margin-bottom: 10px; `, time: css` font-size: 12px; @@ -40,30 +60,11 @@ export const useStyles = createStyles(({ css, token }) => ({ border-color: rgba(187, 204, 253, 0.24); padding: 20px 50px; `, - conTitle: css` - width: 125px; - height: 40px; - line-height: 40px; - 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%); - `, topBtn: css` border-radius: 20px; color: #2E62FF; border: 1px solid #2E62FF; `, - description: css` - padding: 0 45px; - margin-top: 10px; - `, - tag: css` - padding: 0px 45px; - margin-bottom: 10px; - `, })); interface HeaderProps { 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 584537a..36cad40 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,7 +21,7 @@ interface ConversationExampleProps extends FlexboxProps { const ConversationExample = memo(({ data }) => { // const { t } = useTranslation('discover'); const theme = useTheme(); - console.log(data.config.systemRole,111111111) + console.log(data.config.systemRole) return ( {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 a014e71..3b98699 100644 --- a/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/page.tsx +++ b/DigitalHumanWeb/src/app/(main)/discover/(detail)/assistant/[slug]/page.tsx @@ -7,7 +7,7 @@ import { ldModule } from '@/server/ld'; import { metadataModule } from '@/server/metadata'; import { DiscoverService } from '@/server/services/discover'; import { translation } from '@/server/translation'; -import { DiscoverPlugintem } from '@/types/discover'; +// import { DiscoverPlugintem } from '@/types/discover'; import { isMobileDevice } from '@/utils/responsive'; import DetailLayout from '../../features/DetailLayout'; @@ -65,7 +65,7 @@ const Page = async ({ params, searchParams }: Props) => { const data = await discoverService.getAssistantById(locale, identifier); if (!data) return notFound(); console.log(data,'37373733737') - const { meta, createdAt, author, config } = data; + const { meta, createdAt, author } = data; // let pluginData: DiscoverPlugintem[] = []; // if (config?.plugins && config.plugins?.length > 0) { diff --git a/DigitalHumanWeb/src/app/(main)/discover/(detail)/features/DetailLayout.tsx b/DigitalHumanWeb/src/app/(main)/discover/(detail)/features/DetailLayout.tsx index 2ad806b..cae9a0a 100644 --- a/DigitalHumanWeb/src/app/(main)/discover/(detail)/features/DetailLayout.tsx +++ b/DigitalHumanWeb/src/app/(main)/discover/(detail)/features/DetailLayout.tsx @@ -39,7 +39,7 @@ const DetailLayout = memo(
{header} - + {children}