Skip to content

Conversation

@carolin913
Copy link
Collaborator

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

💡 需求背景和解决方案

📝 更新日志

  • feat(chatbot): 新增chat系列agui组件

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@uyarn uyarn changed the title feat(chat): 增加chat系列agui组件 feat(chat): add chat series AGUI components Oct 11, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 11, 2025

tdesign-react-demo

npm i https://pkg.pr.new/tdesign-react@3880

commit: 5168868

@github-actions
Copy link
Contributor

github-actions bot commented Oct 11, 2025

失败

@uyarn uyarn requested a review from Copilot October 14, 2025 10:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a new AIGC chat component suite, build pipeline, and documentation site, integrating AG-UI protocol support and providing examples and tooling for development and analysis.

  • Introduces pro-components chat package with hooks, toolcall registry, provider, examples, and styles
  • Adds dedicated Rollup build config, analysis script, and a Vite-powered documentation/demo site
  • Updates workspace and minor dependency versions

Reviewed Changes

Copilot reviewed 151 out of 159 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
tsconfig.aigc.build.json TypeScript config for building the chat package declarations.
script/rollup.aigc.config.js Rollup config for bundling the chat package and styles.
script/analyze-aigc-bundle.js Script to check and list bundle analysis outputs.
pnpm-workspace.yaml Workspace patterns updated (replacing site with internal/**).
packages/tdesign-react/site/plugins/plugin-tdoc/index.js Minor formatting change to default export.
packages/tdesign-react/package.json Downgrades validator dependency (potentially unrelated).
packages/tdesign-react-aigc/** New AIGC site, plugin, docs, and configuration for demos/docs.
packages/pro-components/chat/** New chat package: entrypoints, hooks, toolcall system, provider, examples, style loader.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +26 to +28
"build": "cross-env NODE_ENV=production rollup -c script/rollup.config.js && npm run build:tsc",
"build:tsc": "run-p build:tsc-*",
"build:tsc-es": "tsc --emitDeclarationOnly -d -p ./tsconfig.build.json --outDir es/",
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build script points to script/rollup.config.js and tsconfig.build.json, which do not exist in this PR. Use the added Rollup config (script/rollup.aigc.config.js) and the AIGC TS config (tsconfig.aigc.build.json) to avoid build failures.

Suggested change
"build": "cross-env NODE_ENV=production rollup -c script/rollup.config.js && npm run build:tsc",
"build:tsc": "run-p build:tsc-*",
"build:tsc-es": "tsc --emitDeclarationOnly -d -p ./tsconfig.build.json --outDir es/",
"build": "cross-env NODE_ENV=production rollup -c script/rollup.aigc.config.js && npm run build:tsc",
"build:tsc": "run-p build:tsc-*",
"build:tsc-es": "tsc --emitDeclarationOnly -d -p ./tsconfig.aigc.build.json --outDir es/",

Copilot uses AI. Check for mistakes.
jsx: 'transform',
jsxFactory: 'React.createElement',
jsxFragment: 'React.Fragment',
tsconfig: resolve(__dirname, '../tsconfig.build.json'),
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esbuild references ../tsconfig.build.json, but the new TS config added for this package is tsconfig.aigc.build.json. Align to the correct file so TS options are applied as intended.

Suggested change
tsconfig: resolve(__dirname, '../tsconfig.build.json'),
tsconfig: resolve(__dirname, '../tsconfig.aigc.build.json'),

Copilot uses AI. Check for mistakes.
Comment on lines +4 to +10
export * from './chat-filecard';
export * from './chat-loading';
export * from './chat-markdown';
export * from './chat-message';
export * from './chat-sender';
export * from './chat-thinking';
export * from './chat-markdown';
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entry exports './chat-filecard', which isn't present in the package, causing resolution failures. Also './chat-markdown' is exported twice. Remove the nonexistent export (or add the module) and deduplicate the markdown export.

Suggested change
export * from './chat-filecard';
export * from './chat-loading';
export * from './chat-markdown';
export * from './chat-message';
export * from './chat-sender';
export * from './chat-thinking';
export * from './chat-markdown';
export * from './chat-loading';
export * from './chat-markdown';
export * from './chat-message';
export * from './chat-sender';
export * from './chat-thinking';

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,68 @@
import React, { useRef, useState } from 'react';
import { Tooltip } from '@tdesign/components';
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import source '@tdesign/components' is invalid in this repo; the correct package is 'tdesign-react'. Replace with: import { Tooltip } from 'tdesign-react'.

Suggested change
import { Tooltip } from '@tdesign/components';
import { Tooltip } from 'tdesign-react';

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,113 @@
import React, { useState } from 'react';
import { Tooltip, Loading } from '@tdesign/components';
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 'tdesign-react' instead of '@tdesign/components'. For example: import { Tooltip, Loading } from 'tdesign-react'.

Suggested change
import { Tooltip, Loading } from '@tdesign/components';
import { Tooltip, Loading } from 'tdesign-react';

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +5
import { Button } from '@tdesign/components';
import { Link, useLocation } from 'react-router-dom';

export const demoFiles = import.meta.glob('../../../../components/**/_example/*.tsx', { eager: true });
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two issues: (1) Import should be from 'tdesign-react' not '@tdesign/components'; (2) The glob points to '../../../../components//_example/*.tsx', but AIGC demos live under packages/pro-components/chat. Update to '../../../../pro-components/chat//_example/*.tsx' to load the correct examples.

Suggested change
import { Button } from '@tdesign/components';
import { Link, useLocation } from 'react-router-dom';
export const demoFiles = import.meta.glob('../../../../components/**/_example/*.tsx', { eager: true });
import { Button } from 'tdesign-react';
import { Link, useLocation } from 'react-router-dom';
export const demoFiles = import.meta.glob('../../../../pro-components/chat/**/_example/*.tsx', { eager: true });

Copilot uses AI. Check for mistakes.
Comment on lines +4 to +5
import { Button } from '@tdesign/components';
import '@tdesign/components/style/index.js';
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These imports target a non-existent '@tdesign/components' package. Use TDesign React: import { Button } from 'tdesign-react'; and import 'tdesign-react/es/style/index.css' for styles.

Suggested change
import { Button } from '@tdesign/components';
import '@tdesign/components/style/index.js';
import { Button } from 'tdesign-react';
import 'tdesign-react/es/style/index.css';

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +17
const ChatBot: React.ForwardRefExoticComponent<
Omit<TdChatProps & Partial<TdChatbotApi>, 'ref'> & React.RefAttributes<HTMLElement | undefined>
> = reactify<TdChatProps>('t-chatbot');
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file uses React types but doesn't import them. Add 'import type React from "react";' at the top to ensure declaration emit succeeds under TS isolatedModules.

Copilot uses AI. Check for mistakes.
Comment on lines +113 to +119
export interface ToolConfigWithStateOptions<TArgs extends object = any, TResult = any> {
name: string;
description: string;
parameters: Array<{ name: string; type: string }>;
subscribeKey?: (props: ToolcallComponentProps<TArgs, TResult>) => string | undefined;
component: React.ComponentType<ToolcallComponentProps<TArgs, TResult> & { agentState?: Record<string, any> }>;
}
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React types are referenced but React isn't imported. Add 'import type React from "react";' at the top of this file to avoid TS declaration errors.

Copilot uses AI. Check for mistakes.
"tdesign-icons-react": "^0.6.1",
"tslib": "~2.3.1",
"validator": "~13.15.0"
"validator": "~13.7.0"
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This downgrades validator from ~13.15.0 to ~13.7.0. Avoid unrelated dependency downgrades in a feature PR; it can introduce regressions or security exposure. Keep the existing version unless there is a specific, documented reason.

Suggested change
"validator": "~13.7.0"
"validator": "~13.15.0"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants