diff --git a/packages/pro-components/chat/attachments/index.ts b/packages/pro-components/chat/attachments/index.ts index f5e5ee5d92..be49cdfd8e 100644 --- a/packages/pro-components/chat/attachments/index.ts +++ b/packages/pro-components/chat/attachments/index.ts @@ -1,8 +1,8 @@ -import 'tdesign-web-components/lib/attachments'; +import '@tdesign/web-components-chat/attachments'; import reactify from '../_util/reactify'; -import type { TdAttachmentsProps } from 'tdesign-web-components'; +import type { TdAttachmentsProps } from '@tdesign/web-components-chat/attachments'; export const Attachments: React.ForwardRefExoticComponent< Omit & React.RefAttributes @@ -10,4 +10,5 @@ export const Attachments: React.ForwardRefExoticComponent< export default Attachments; -export type { TdAttachmentItem, TdAttachmentsProps } from 'tdesign-web-components'; +export type { TdAttachmentsProps } from '@tdesign/web-components-chat/attachments'; +export type { TdAttachmentItem } from '@tdesign/web-components-chat/filecard'; diff --git a/packages/pro-components/chat/chat-actionbar/index.tsx b/packages/pro-components/chat/chat-actionbar/index.tsx index 4f244d5dac..1b65cb82e4 100644 --- a/packages/pro-components/chat/chat-actionbar/index.tsx +++ b/packages/pro-components/chat/chat-actionbar/index.tsx @@ -1,8 +1,8 @@ -import 'tdesign-web-components/lib/chat-action'; +import '@tdesign/web-components-chat/chat-action'; import reactify from '../_util/reactify'; -import type { TdChatActionProps } from 'tdesign-web-components'; +import type { TdChatActionProps } from '@tdesign/web-components-chat/chat-action'; export const ChatActionBar: React.ForwardRefExoticComponent< Omit & @@ -12,43 +12,4 @@ export const ChatActionBar: React.ForwardRefExoticComponent< > = reactify('t-chat-action'); export default ChatActionBar; -export type { TdChatActionProps, TdChatActionsName } from 'tdesign-web-components'; - -// 方案1 -// import { reactifyLazy } from './_util/reactifyLazy'; -// const ChatActionBar = reactifyLazy<{ -// size: 'small' | 'medium' | 'large', -// variant: 'primary' | 'secondary' | 'outline' -// }>( -// 't-chat-action', -// 'tdesign-web-components/esm/chat-action' -// ); - -// import ChatAction from 'tdesign-web-components/esm/chat-action'; -// import React, { forwardRef, useEffect } from 'react'; - -// // 注册Web Components组件 -// const registerChatAction = () => { -// if (!customElements.get('t-chat-action')) { -// customElements.define('t-chat-action', ChatAction); -// } -// }; - -// // 在组件挂载时注册 -// const useRegisterWebComponent = () => { -// useEffect(() => { -// registerChatAction(); -// }, []); -// }; - -// // 使用reactify创建React组件 -// const BaseChatActionBar = reactify('t-chat-action'); - -// // 包装组件,确保Web Components已注册 -// export const ChatActionBar2 = forwardRef< -// HTMLElement | undefined, -// Omit & { [key: string]: any } -// >((props, ref) => { -// useRegisterWebComponent(); -// return ; -// }); +export type { TdChatActionProps, TdChatActionsName } from '@tdesign/web-components-chat/chat-action'; diff --git a/packages/pro-components/chat/chat-filecard/index.ts b/packages/pro-components/chat/chat-filecard/index.ts index 4bd41beacb..548c48172d 100644 --- a/packages/pro-components/chat/chat-filecard/index.ts +++ b/packages/pro-components/chat/chat-filecard/index.ts @@ -1,12 +1,12 @@ -import 'tdesign-web-components/lib/filecard'; +import '@tdesign/web-components-chat/filecard'; import reactify from '../_util/reactify'; -import type { TdFileCardProps } from 'tdesign-web-components'; +import type { TdFileCardProps } from '@tdesign/web-components-chat/filecard'; export const Filecard: React.ForwardRefExoticComponent< Omit & React.RefAttributes > = reactify('t-filecard'); export default Filecard; -export type { TdFileCardProps } from 'tdesign-web-components'; +export type { TdFileCardProps } from '@tdesign/web-components-chat/filecard'; diff --git a/packages/pro-components/chat/chat-loading/index.ts b/packages/pro-components/chat/chat-loading/index.ts index f7f9ccfae0..269780e344 100644 --- a/packages/pro-components/chat/chat-loading/index.ts +++ b/packages/pro-components/chat/chat-loading/index.ts @@ -1,12 +1,12 @@ -import 'tdesign-web-components/lib/chat-loading'; +import '@tdesign/web-components-chat/chat-loading'; import reactify from '../_util/reactify'; -import type { TdChatLoadingProps } from 'tdesign-web-components'; +import type { TdChatLoadingProps } from '@tdesign/web-components-chat/chat-loading'; export const ChatLoading: React.ForwardRefExoticComponent< Omit & React.RefAttributes > = reactify('t-chat-loading'); export default ChatLoading; -export type { ChatLoadingAnimationType, TdChatLoadingProps } from 'tdesign-web-components'; +export type { ChatLoadingAnimationType, TdChatLoadingProps } from '@tdesign/web-components-chat/chat-loading'; diff --git a/packages/pro-components/chat/chat-markdown/index.ts b/packages/pro-components/chat/chat-markdown/index.ts index 82952856b1..8dcc05f460 100644 --- a/packages/pro-components/chat/chat-markdown/index.ts +++ b/packages/pro-components/chat/chat-markdown/index.ts @@ -1,16 +1,13 @@ -import { TdMarkdownEngine } from 'tdesign-web-components'; +import { TdMarkdownEngine } from '@tdesign/web-components-chat/chat-message'; import reactify from '../_util/reactify'; -import type { TdChatMarkdownContentProps } from 'tdesign-web-components'; +import type { TdChatMarkdownContentProps } from '@tdesign/web-components-chat/chat-message'; export const MarkdownEngine: typeof TdMarkdownEngine = TdMarkdownEngine; export const ChatMarkdown: React.ForwardRefExoticComponent< Omit & React.RefAttributes > = reactify('t-chat-md-content'); -// eslint-disable-next-line import/first -import 'tdesign-web-components/lib/chat-message/content/markdown-content'; - export default ChatMarkdown; -export type { TdChatMarkdownContentProps } from 'tdesign-web-components'; +export type { TdChatMarkdownContentProps } from '@tdesign/web-components-chat/chat-message'; diff --git a/packages/pro-components/chat/chat-message/index.ts b/packages/pro-components/chat/chat-message/index.ts index 2dd39dbac1..302baa2480 100644 --- a/packages/pro-components/chat/chat-message/index.ts +++ b/packages/pro-components/chat/chat-message/index.ts @@ -1,8 +1,8 @@ -import 'tdesign-web-components/lib/chat-message'; +import '@tdesign/web-components-chat/chat-message'; import reactify from '../_util/reactify'; -import type { TdChatMessageProps } from 'tdesign-web-components'; +import type { TdChatMessageProps } from '@tdesign/web-components-chat/chat-message'; export const ChatMessage: React.ForwardRefExoticComponent< Omit & React.RefAttributes @@ -10,4 +10,4 @@ export const ChatMessage: React.ForwardRefExoticComponent< export default ChatMessage; -export type { TdChatMessageProps } from 'tdesign-web-components'; +export type { TdChatMessageProps } from '@tdesign/web-components-chat/chat-message'; diff --git a/packages/pro-components/chat/chat-sender/_example/custom.tsx b/packages/pro-components/chat/chat-sender/_example/custom.tsx index 446a56e357..445ba89c8c 100644 --- a/packages/pro-components/chat/chat-sender/_example/custom.tsx +++ b/packages/pro-components/chat/chat-sender/_example/custom.tsx @@ -5,8 +5,8 @@ import { ChatSender } from '@tdesign-react/chat'; import { useDynamicStyle } from '../../_util/useDynamicStyle'; +import type { TdAttachmentItem } from '@tdesign/web-components-chat/filecard'; import type { UploadFile } from 'tdesign-react'; -import type { TdAttachmentItem } from 'tdesign-web-components'; const options = [ { diff --git a/packages/pro-components/chat/chat-sender/index.ts b/packages/pro-components/chat/chat-sender/index.ts index 4ecb589b4b..0bb9c04180 100644 --- a/packages/pro-components/chat/chat-sender/index.ts +++ b/packages/pro-components/chat/chat-sender/index.ts @@ -1,12 +1,20 @@ -import 'tdesign-web-components/lib/chat-sender'; +import '@tdesign/web-components-chat/chat-sender'; import reactify from '../_util/reactify'; -import type { TdChatSenderProps } from 'tdesign-web-components'; +import type { TdChatSenderProps } from '@tdesign/web-components-chat/chat-sender'; export const ChatSender: React.ForwardRefExoticComponent< Omit & React.RefAttributes > = reactify('t-chat-sender'); export default ChatSender; -export type * from 'tdesign-web-components/lib/chat-sender/type'; +export type { + TdChatSenderAction, + TdChatSenderActionName, + TdChatSenderApi, + TdChatSenderParams, + TdChatSenderProps, + TdChatSenderUploadProps, + UploadActionType, +} from '@tdesign/web-components-chat/chat-sender'; diff --git a/packages/pro-components/chat/chat-thinking/_example/style.tsx b/packages/pro-components/chat/chat-thinking/_example/style.tsx index 316f628947..190b65624f 100644 --- a/packages/pro-components/chat/chat-thinking/_example/style.tsx +++ b/packages/pro-components/chat/chat-thinking/_example/style.tsx @@ -3,7 +3,7 @@ import React, { useEffect, useRef, useState } from 'react'; import { Space } from 'tdesign-react'; import { ChatThinking } from '@tdesign-react/chat'; -import type { ChatMessageStatus, TdChatThinkContentProps } from 'tdesign-web-components'; +import type { ChatMessageStatus, TdChatThinkContentProps } from '@tdesign/web-components-chat'; const fullText = '嗯,用户问牛顿第一定律是不是适用于所有参考系。首先,我得先回忆一下牛顿第一定律的内容。牛顿第一定律,也就是惯性定律,说物体在没有外力作用时会保持静止或匀速直线运动。也就是说,保持原来的运动状态。那问题来了,这个定律是否适用于所有参考系呢?记得以前学过的参考系分惯性系和非惯性系。惯性系里,牛顿定律成立;非惯性系里,可能需要引入惯性力之类的修正。所以牛顿第一定律应该只在惯性参考系中成立,而在非惯性系中不适用,比如加速的电梯或者旋转的参考系,这时候物体会有看似无外力下的加速度,所以必须引入假想的力来解释。'; diff --git a/packages/pro-components/chat/chat-thinking/index.ts b/packages/pro-components/chat/chat-thinking/index.ts index 8c9706c8ed..2a9d3121e2 100644 --- a/packages/pro-components/chat/chat-thinking/index.ts +++ b/packages/pro-components/chat/chat-thinking/index.ts @@ -1,8 +1,8 @@ -import 'tdesign-web-components/lib/chat-message/content/thinking-content'; +import '@tdesign/web-components-chat/chat-message'; import reactify from '../_util/reactify'; -import type { TdChatThinkContentProps } from 'tdesign-web-components'; +import type { TdChatThinkContentProps } from '@tdesign/web-components-chat/chat-message'; const ChatThinkContent: React.ForwardRefExoticComponent< Omit & React.RefAttributes @@ -12,4 +12,4 @@ export const ChatThinking = ChatThinkContent; export default ChatThinking; -export type { TdChatThinkContentProps } from 'tdesign-web-components'; +export type { TdChatThinkContentProps } from '@tdesign/web-components-chat/chat-message'; diff --git a/packages/pro-components/chat/chatbot/index.ts b/packages/pro-components/chat/chatbot/index.ts index d9439573e8..b307efa55c 100644 --- a/packages/pro-components/chat/chatbot/index.ts +++ b/packages/pro-components/chat/chatbot/index.ts @@ -1,18 +1,10 @@ -import 'tdesign-web-components/lib/chatbot'; -import 'tdesign-web-components/lib/chat-message/content/reasoning-content'; -import 'tdesign-web-components/lib/chat-message/content/search-content'; -import 'tdesign-web-components/lib/chat-message/content/suggestion-content'; +import '@tdesign/web-components-chat/chat-message'; +import '@tdesign/web-components-chat/chatbot'; import reactify from '../_util/reactify'; -import type { - TdChatbotApi, - TdChatListApi, - TdChatListProps, - TdChatProps, - TdChatSearchContentProps, - TdChatSuggestionContentProps, -} from 'tdesign-web-components'; +import type { TdChatSearchContentProps, TdChatSuggestionContentProps } from '@tdesign/web-components-chat/chat-message'; +import type { TdChatbotApi, TdChatListApi, TdChatListProps, TdChatProps } from '@tdesign/web-components-chat/chatbot'; const ChatBot: React.ForwardRefExoticComponent< Omit, 'ref'> & React.RefAttributes @@ -34,4 +26,22 @@ const ChatList: React.ForwardRefExoticComponent< export { ChatBot, ChatList, ChatSearchContent, ChatSuggestionContent }; // 导出类型和工具 -export type * from 'tdesign-web-components/lib/chatbot/type'; +export type { + BackBottomParams, + FetchSSEOptions, + Layout, + MetaData, + ModelRoleEnum, + ScrollPosition, + SSEEvent, + TdChatbotApi, + TdChatCodeProps, + TdChatInjectCSS, + TdChatListApi, + TdChatListProps, + TdChatListScrollToOptions, + TdChatMessageActionEvent, + TdChatMessageConfig, + TdChatMessageConfigItem, + TdChatProps, +} from '@tdesign/web-components-chat/chatbot'; diff --git a/packages/pro-components/chat/style/index.js b/packages/pro-components/chat/style/index.js index 3e9cfdf349..a677b31e86 100644 --- a/packages/pro-components/chat/style/index.js +++ b/packages/pro-components/chat/style/index.js @@ -1 +1 @@ -import 'tdesign-web-components/lib/style/index.css'; +import '@tdesign/web-components-chat/style/index.css'; diff --git a/packages/tdesign-react-aigc/package.json b/packages/tdesign-react-aigc/package.json index 801cf7af80..890c5046df 100644 --- a/packages/tdesign-react-aigc/package.json +++ b/packages/tdesign-react-aigc/package.json @@ -55,10 +55,11 @@ }, "dependencies": { "@babel/runtime": "~7.26.7", + "@tdesign/web-components": "https://pkg.pr.new/TDesignOteam/tdesign-web-components/@tdesign/web-components@46aedf9", + "@tdesign/web-components-chat": "https://pkg.pr.new/TDesignOteam/tdesign-web-components/@tdesign/web-components-chat@46aedf9", "classnames": "~2.5.1", "lodash-es": "^4.17.21", "react-fast-compare": "^3.2.2", - "tdesign-web-components": "1.3.0-alpha.2", "zod": "^3.24.2" }, "devDependencies": {