Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/pro-components/chat/attachments/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
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<TdAttachmentsProps, 'ref'> & React.RefAttributes<HTMLElement | undefined>
> = reactify<TdAttachmentsProps>('t-attachments');

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';
45 changes: 3 additions & 42 deletions packages/pro-components/chat/chat-actionbar/index.tsx
Original file line number Diff line number Diff line change
@@ -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<TdChatActionProps, 'ref'> &
Expand All @@ -12,43 +12,4 @@ export const ChatActionBar: React.ForwardRefExoticComponent<
> = reactify<TdChatActionProps>('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<TdChatActionProps>('t-chat-action');

// // 包装组件,确保Web Components已注册
// export const ChatActionBar2 = forwardRef<
// HTMLElement | undefined,
// Omit<TdChatActionProps, 'ref'> & { [key: string]: any }
// >((props, ref) => {
// useRegisterWebComponent();
// return <BaseChatActionBar {...props} ref={ref} />;
// });
export type { TdChatActionProps, TdChatActionsName } from '@tdesign/web-components-chat/chat-action';
6 changes: 3 additions & 3 deletions packages/pro-components/chat/chat-filecard/index.ts
Original file line number Diff line number Diff line change
@@ -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<TdFileCardProps, 'ref'> & React.RefAttributes<HTMLElement | undefined>
> = reactify<TdFileCardProps>('t-filecard');

export default Filecard;
export type { TdFileCardProps } from 'tdesign-web-components';
export type { TdFileCardProps } from '@tdesign/web-components-chat/filecard';
6 changes: 3 additions & 3 deletions packages/pro-components/chat/chat-loading/index.ts
Original file line number Diff line number Diff line change
@@ -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<TdChatLoadingProps, 'ref'> & React.RefAttributes<HTMLElement | undefined>
> = reactify<TdChatLoadingProps>('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';
9 changes: 3 additions & 6 deletions packages/pro-components/chat/chat-markdown/index.ts
Original file line number Diff line number Diff line change
@@ -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<TdChatMarkdownContentProps, 'ref'> & React.RefAttributes<HTMLElement | undefined>
> = reactify<TdChatMarkdownContentProps>('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';
6 changes: 3 additions & 3 deletions packages/pro-components/chat/chat-message/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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<TdChatMessageProps & React.PropsWithChildren, 'ref'> & React.RefAttributes<HTMLElement | undefined>
> = reactify<TdChatMessageProps>('t-chat-item', 'ChatMessage');

export default ChatMessage;

export type { TdChatMessageProps } from 'tdesign-web-components';
export type { TdChatMessageProps } from '@tdesign/web-components-chat/chat-message';
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
{
Expand Down
14 changes: 11 additions & 3 deletions packages/pro-components/chat/chat-sender/index.ts
Original file line number Diff line number Diff line change
@@ -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<TdChatSenderProps & React.PropsWithChildren, 'ref'> & React.RefAttributes<HTMLElement | undefined>
> = reactify<TdChatSenderProps>('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';
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
'嗯,用户问牛顿第一定律是不是适用于所有参考系。首先,我得先回忆一下牛顿第一定律的内容。牛顿第一定律,也就是惯性定律,说物体在没有外力作用时会保持静止或匀速直线运动。也就是说,保持原来的运动状态。那问题来了,这个定律是否适用于所有参考系呢?记得以前学过的参考系分惯性系和非惯性系。惯性系里,牛顿定律成立;非惯性系里,可能需要引入惯性力之类的修正。所以牛顿第一定律应该只在惯性参考系中成立,而在非惯性系中不适用,比如加速的电梯或者旋转的参考系,这时候物体会有看似无外力下的加速度,所以必须引入假想的力来解释。';
Expand Down
6 changes: 3 additions & 3 deletions packages/pro-components/chat/chat-thinking/index.ts
Original file line number Diff line number Diff line change
@@ -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<TdChatThinkContentProps, 'ref'> & React.RefAttributes<HTMLElement | undefined>
Expand All @@ -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';
36 changes: 23 additions & 13 deletions packages/pro-components/chat/chatbot/index.ts
Original file line number Diff line number Diff line change
@@ -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<TdChatProps & Partial<TdChatbotApi>, 'ref'> & React.RefAttributes<HTMLElement | undefined>
Expand All @@ -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';
2 changes: 1 addition & 1 deletion packages/pro-components/chat/style/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import 'tdesign-web-components/lib/style/index.css';
import '@tdesign/web-components-chat/style/index.css';
3 changes: 2 additions & 1 deletion packages/tdesign-react-aigc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Loading