MyGit

ant-design/x

Fork: 25 Star: 398 (更新于 2024-11-26 21:34:48)

license: MIT

Language: TypeScript .

Craft AI-driven interfaces effortlessly 🤖

最后发布版本: 1.0.0 ( 2024-11-22 11:59:10)

官方网址 GitHub网址

Ant Design X

Craft AI-driven interfaces effortlessly.

CI status codecov NPM version NPM downloads

Changelog · Report Bug · Request Feature · English · 中文

demos

✨ Features

  • 🌈 Derived from Best Practices of Enterprise-Level AI Products: Built on the RICH interaction paradigm, delivering an exceptional AI interaction experience.
  • 🧩 Flexible and Diverse Atomic Components: Covers most AI dialogue scenarios, empowering you to quickly build personalized AI interaction interfaces.
  • Out-of-the-Box Model Integration: Easily connect with inference services compatible with OpenAI standards.
  • 🔄 Efficient Management of Conversation Data Flows: Provides powerful tools for managing data flows, enhancing development efficiency.
  • 📦 Rich Template Support: Offers multiple templates for quickly starting LUI application development.
  • 🛡 Complete TypeScript Support: Developed with TypeScript, ensuring robust type coverage to improve the development experience and reliability.
  • 🎨 Advanced Theme Customization: Supports fine-grained style adjustments to meet diverse use cases and personalization needs.

📦 Installation

npm install @ant-design/x --save
yarn add @ant-design/x
pnpm add @ant-design/x

🖥️ Import in Browser

Add script and link tags in your browser and use the global variable antd.

We provide antdx.js, antdx.min.js, and antdx.min.js.map in the dist directory of the npm package.

🧩 Atomic Components

Based on the RICH interaction paradigm, we provide numerous atomic components for various stages of interaction to help you flexibly build your AI dialogue applications:

  • General: Bubble - Message bubble, Conversations - Conversation management
  • Wake-Up: Welcome - Welcome messages, Prompts - Prompt sets
  • Expression: Sender - Input box, Attachment - Attachments, Suggestion - Quick commands
  • Confirmation: ThoughtChain - Thought chains

Below is an example of using atomic components to create a simple chatbot interface:

import React from 'react';
import {
  // Message bubble
  Bubble,
  // Input box
  Sender,
} from '@ant-design/x';

const messages = [
  {
    content: 'Hello, Ant Design X!',
    role: 'user',
  },
];

const App = () => (
  <div>
    <Bubble.List items={messages} />
    <Sender />
  </div>
);

export default App;

⚡️ Connecting to Model Inference Services

With the useXAgent runtime tool, we make it easy to connect with model inference services that adhere to OpenAI standards.

Here’s an example of using useXAgent:

import React from 'react';
import { useXAgent, Sender } from '@ant-design/x';

const App = () => {
  const [agent] = useXAgent({
    // Model inference service URL
    baseURL: 'https://your.api.host',
    // Model name
    model: 'gpt-3.5',
  });

  function chatRequest(text: string) {
    agent.request({
      // Message
      messages: [
        {
          content: text,
          role: 'user',
        },
      ],
      // Enable streaming
      stream: true,
    });
  }

  return <Sender onSubmit={chatRequest} />;
};

export default App;

🔄 Efficient Management of Data Flows

Using the useXChat runtime tool, you can easily manage data flows in AI dialogue applications:

import React from 'react';
import { useXChat, useXAgent } from '@ant-design/x';

const App = () => {
  const [agent] = useXAgent({
    // Model inference service URL
    baseURL: 'https://your.api.host',
    // Model name
    model: 'gpt-3.5',
  });

  const {
    // Initiate a chat request
    onRequest,
    // Message list
    messages,
  } = useXChat({ agent });

  return (
    <div>
      <Bubble.List items={messages} />
      <Sender onSubmit={onRequest} />
    </div>
  );
};

export default App;

Use modularized antd

@ant-design/x supports ES modules tree shaking by default.

TypeScript

@ant-design/x provides a built-in ts definition.

Non-React Implementations

Welcome to contribute!

Companies using antdx

Ant Design X is widely used in AI-driven user interfaces within Ant Group. If your company and products use Ant Design X, feel free to leave a comment here.

Contributing

Please read our CONTRIBUTING.md first.

If you'd like to help us improve antd, just create a Pull Request. Feel free to report bugs and issues here.

If you're new to posting issues, we ask that you read How To Ask Questions The Smart Way and How to Ask a Question in Open Source Community and How to Report Bugs Effectively prior to posting. Well written bug reports help us help you!

Need Help?

If you encounter any issues while using Ant Design X, you can seek help through the following channels. We also encourage experienced users to assist newcomers via these platforms.

When asking questions on GitHub Discussions, it's recommended to use the Q&A tag.

  1. GitHub Discussions
  2. GitHub Issues

最近版本更新:(数据更新于 2024-11-26 21:34:32)

2024-11-22 11:59:10 1.0.0

2024-11-01 17:50:01 1.0.0-alpha.9

2024-10-25 16:59:37 1.0.0-alpha.6

2024-10-17 10:45:57 v1.0.0-alpha.4

2024-09-27 14:46:34 v1.0.0-alpha.2

2024-09-15 19:26:02 1.0.0-alpha.1

2024-09-06 10:00:37 v1.0.0-alpha.0

ant-design/x同语言 TypeScript最近更新仓库

2024-12-21 21:40:12 lobehub/lobe-chat

2024-12-21 12:01:51 siyuan-note/siyuan

2024-12-21 10:57:01 ai16z/eliza

2024-12-21 09:15:35 MetaCubeX/metacubexd

2024-12-20 19:36:48 vitejs/vite

2024-12-20 15:46:43 x-extends/vxe-table