{"componentChunkName":"component---src-templates-post-template-js","path":"/en-US/ai/aiComponent","result":{"data":{"current":{"frontmatter":{"title":"AI Ability Introduction","order":100,"brief":"Introducing components related to AI application scenarios","icon":"doc-aiComponent"},"fields":{"type":"ai"},"tableOfContents":{"items":[{"url":"#ai-basic-components","title":"AI Basic Components"},{"url":"#building-a-conversation-with-the-ai-chat-component","title":"Building a Conversation with the AI ​​Chat Component"},{"url":"#faq","title":"FAQ"}]},"body":"var _excluded = [\"components\"];\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nfunction _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }\nfunction _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }\n/* @jsxRuntime classic */\n/* @jsx mdx */\n\nvar _frontmatter = {\n  \"localeCode\": \"en-US\",\n  \"order\": 100,\n  \"category\": \"Ai\",\n  \"title\": \"AI Ability Introduction\",\n  \"icon\": \"doc-aiComponent\",\n  \"width\": \"60%\",\n  \"brief\": \"Introducing components related to AI application scenarios\",\n  \"showNew\": true\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n    props = _objectWithoutProperties(_ref, _excluded);\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"Semi AI Components is an innovative component library designed specifically for AI application scenarios. In an era where AI is becoming a key player in products, traditional design systems are struggling to support increasingly complex intelligent interactions. Semi AI Components, with \\\"human-machine intelligent collaboration\\\" as its core concept, aims to make user collaboration with AI systems more efficient, controllable, perceptible, and reliable. The Semi AI Components library includes the following: AI Token, basic AI components, and AI Chat components, used to serve scenarios such as intelligent question answering and assistants, multimodal input, and multi-turn dialogue.\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"AI Token\"), \": Added 20 basic tokens in 20 colors for AI scenarios.\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"AI Basic Components\"), \": Added 25 icons for AI scenarios, and added AI styles to \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Button/Tag/FloatButton\"), \".\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"AI Chat Components\"), \": Added \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"AIChatInput\"), \", which supports rich text input, quoting, uploading, function configuration, and rich custom display; and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"AIChatDialogue\"), \", which supports conversation display, selection, editing, prompts, rich custom rendering, and message transformation. The chat component supports the OpenAI community's \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://platform.openai.com/docs/api-reference/responses/create\"\n  }, \"Response\"), \" / \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://platform.openai.com/docs/api-reference/chat/create\"\n  }, \"Chat Completion\"), \" format standards by default, supporting GPT-5 and GPT-4o. All models in the series support out-of-the-box response; see \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatDialogue#%E6%B6%88%E6%81%AF%E6%95%B0%E6%8D%AE%E8%BD%AC%E6%8D%A2\"\n  }, \"Message Data Conversion\"), \" for details. And the multi-functional sidebar component \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Sidebar\"), \" with capabilities for product editing, product viewing, and displaying cited materials.\\n(For information on how to select the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Chat\"), \" and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"AI Chat\"), \" components, see \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiComponent#FAQ\"\n  }, \"FAQ\"), \").\"))), mdx(\"p\", null, \"In the future, we will support more AI Chat components, such as the integrated component \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"AIChatBox\"), \" combining \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"AIChatInput\"), \" and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"AIChatDialogue\"), \", to meet the information and result management needs in complex AI application scenarios.\"), mdx(\"h3\", null, \"AI Basic Components\"), mdx(\"p\", null, \"The AI \\u200B\\u200Bbasic components include \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"AI Icon\"), \" and AI-style \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Button\"), \", \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Tag\"), \", and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"FloatButton\"), \". The AI \\u200B\\u200Bstyle of the basic AI components is implemented based on \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"AI Token\"), \".\"), mdx(\"p\", null, \"For \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"AI Token\"), \", we have built a brand color palette with a purple-blue gradient as its core. Two new hues, AI purple and AI general, have been added to the base colors, resulting in a color wheel of 20 colors.\"), mdx(\"p\", null, \"For \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"AI Icon\"), \", single-color, dual-color, and multi-color icons are supported, totaling 25 icons.\"), mdx(\"p\", null, \"For AI-style \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Button\"), \", \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Tag\"), \", and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"FloatButton\"), \", the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Colorful\"), \" property of the component can be enabled.\"), mdx(\"p\", null, \"Below are some examples of basic AI components. For more examples and use cases, please see \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/basic/tokens\"\n  }, \"AI Token\"), \", \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"en-US/basic/icon\"\n  }, \"AI Icon\"), \", \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/basic/button#AI%20%E9%A3%8E%E6%A0%BC%20-%20%E5%A4%9A%E5%BD%A9%E6%8C%89%E9%92%AE\"\n  }, \"AI Button\"), \", \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/show/tag#AI%20%E9%A3%8E%E6%A0%BC%20-%20%E5%A4%9A%E5%BD%A9%E6%A0%87%E7%AD%BE\"\n  }, \"AI Tag\"), \", \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/basic/floatbutton#AI%20%E9%A3%8E%E6%A0%BC%20-%20%E5%A4%9A%E5%BD%A9%E6%82%AC%E6%B5%AE%E6%8C%89%E9%92%AE\"\n  }, \"AI FloatButton\"), \".\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-jsx\",\n    \"metastring\": \"live=true dir=\\\"column\\\"\",\n    \"live\": \"true\",\n    \"dir\": \"\\\"column\\\"\"\n  }, \"import React from 'react';\\nimport { Typography, Button, Tag, FloatButton } from '@douyinfe/semi-ui';\\nimport { IconAIBellLevel1, IconAIEditLevel2, IconAIFileLevel3, IconAIFilledLevel3, IconAIImageLevel3, IconAISearchLevel3, IconAIStrokedLevel3, IconAIWandLevel3, IconAILoading, IconAIFilledLevel1, IconAIEditLevel1 } from '@douyinfe/semi-icons';\\n\\n() => {\\n    return (<div style={{ display: 'flex', flexDirection: 'column', rowGap: 20 }}>\\n        <div key=\\\"AIToken\\\" style={{ display: 'flex', flexDirection: 'column', rowGap: 10 }}>\\n            <Typography.Title heading={5}>AI Token</Typography.Title>\\n            <div style={{ display: 'flex', alignItems: 'center', columnGap: 10 }}>\\n                <span>Purple</span>\\n                <div style={{ display: 'inline-flex', columnGap: 4 }}>\\n                    {(new Array(10).fill(1).map((i, index) => (\\n                        <div key={index} style={{ width: 40, height: 40, backgroundColor: `rgba(var(--semi-ai-purple-${index}), 1)`, borderRadius: '50%' }} />\\n                    )))}\\n                </div>\\n            </div>\\n            <div style={{ display: 'flex', alignItems: 'center', columnGap: 10 }}>\\n                <span>General</span>\\n                <div style={{ display: 'inline-flex', columnGap: 4, }}>\\n                    {(new Array(10).fill(1).map((i, index) => (\\n                        <div key={index} style={{ width: 40, height: 40, background: `var(--semi-ai-general-${index})`, borderRadius: '50%' }} />\\n                    )))}\\n                </div>\\n            </div>\\n        </div>\\n        <div key=\\\"AIIcon\\\" style={{ display: 'flex', flexDirection: 'column', rowGap: 10 }}>\\n            <Typography.Title heading={5} >AI Icon</Typography.Title>\\n            <div style={{ display: 'flex', columnGap: 10 }}>\\n                <IconAIBellLevel1 size=\\\"extra-large\\\"/>\\n                <IconAIEditLevel2 size=\\\"extra-large\\\"/>\\n                <IconAIFileLevel3 size=\\\"extra-large\\\" />\\n                <IconAIFilledLevel3 size=\\\"extra-large\\\" />\\n                <IconAIImageLevel3 size=\\\"extra-large\\\" />\\n                <IconAISearchLevel3 size=\\\"extra-large\\\" />\\n                <IconAIStrokedLevel3 size=\\\"extra-large\\\" />\\n                <IconAIWandLevel3 fill={['var(--semi-color-danger)', 'var(--semi-color-success)', 'var(--semi-color-primary)', 'var(--semi-color-warning)']} size=\\\"extra-large\\\"/>\\n                <IconAILoading size=\\\"extra-large\\\"/>\\n            </div>\\n        </div>\\n        <div style={{ display: 'flex', flexDirection: 'column', rowGap: 10 }}>\\n            <Typography.Title heading={5}>AI Button</Typography.Title>\\n            <div style={{ display: 'flex', rowGap: 16, flexDirection: 'column' }}>\\n                <div style={{ display: 'flex', columnGap: 16 }}>\\n                    <Button colorful theme=\\\"solid\\\" type=\\\"primary\\\" icon={<IconAIFilledLevel1 />}>Colorful</Button>\\n                    <Button colorful theme=\\\"solid\\\" type=\\\"primary\\\" loading >Colorful</Button>\\n                    <Button colorful theme=\\\"solid\\\" type=\\\"primary\\\" icon={<IconAIFilledLevel1 />} disabled >Colorful</Button>\\n                </div>\\n                <div style={{ display: 'flex', columnGap: 16 }}>\\n                    <Button colorful theme=\\\"solid\\\" type=\\\"tertiary\\\" icon={<IconAIFilledLevel3 />}>Colorful</Button>\\n                    <Button colorful theme=\\\"solid\\\" type=\\\"tertiary\\\" loading >Colorful</Button>\\n                    <Button colorful theme=\\\"solid\\\" type=\\\"tertiary\\\" icon={<IconAIFilledLevel3 />} disabled >Colorful</Button>\\n                </div>\\n                <div style={{ display: 'flex', columnGap: 16 }}>\\n                    <Button colorful theme=\\\"solid\\\" type=\\\"primary\\\" icon={<IconAIFilledLevel1 />} />\\n                    <Button colorful theme=\\\"solid\\\" type=\\\"primary\\\" loading />\\n                    <Button colorful theme=\\\"solid\\\" type=\\\"primary\\\" icon={<IconAIFilledLevel1 />} disabled />\\n                    <Button colorful theme=\\\"solid\\\" type=\\\"tertiary\\\" icon={<IconAIFilledLevel3 />} />\\n                    <Button colorful theme=\\\"solid\\\" type=\\\"tertiary\\\" loading />\\n                    <Button colorful theme=\\\"solid\\\" type=\\\"tertiary\\\" icon={<IconAIFilledLevel3 />} />\\n                </div>\\n            </div>\\n        </div>\\n        <div style={{ display: 'flex', flexDirection: 'column', rowGap: 10 }}>\\n            <Typography.Title heading={5} style={{ marginTop: 10 }}>AI Tag</Typography.Title>\\n            <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3,1fr)', gridGap: '10px', width: 'fit-content' }}>\\n                <Tag colorful prefixIcon={<IconAIFilledLevel1 size=\\\"small\\\"/>} type=\\\"solid\\\" shape='circle' gradient>AI</Tag>\\n                <Tag colorful prefixIcon={<IconAIFilledLevel3 size=\\\"small\\\" />} type=\\\"light\\\" shape='circle' gradient>AI</Tag>\\n                <Tag colorful prefixIcon={<IconAIFilledLevel3 size=\\\"small\\\"/>} type=\\\"ghost\\\" shape='circle' gradient >AI</Tag>\\n                <Tag colorful prefixIcon={<IconAIFilledLevel1 size=\\\"small\\\"/>} type=\\\"solid\\\" shape='circle' >AI</Tag>\\n                <Tag colorful prefixIcon={<IconAIFilledLevel1 size=\\\"small\\\" />} type=\\\"light\\\" shape='circle'>AI</Tag>\\n                <Tag colorful prefixIcon={<IconAIFilledLevel1 size=\\\"small\\\"/>} type=\\\"ghost\\\" shape='circle'>AI</Tag>\\n            </div>\\n        </div>\\n        <div style={{ display: 'flex', flexDirection: 'column', rowGap: 10 }}>\\n            <Typography.Title heading={5} style={{ marginTop: 10 }}>AI FloatButton</Typography.Title>\\n            <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3,1fr)', gridGap: '10px', width: 'fit-content' }}>\\n                <FloatButton \\n                    icon={<IconAIEditLevel1 />}\\n                    colorful\\n                    size=\\\"large\\\"\\n                    badge={{ count: 'VIP', type: \\\"danger\\\" }}\\n                    style={{ position: 'static' }} \\n                />\\n            </div>\\n        </div>\\n    </div>);\\n};\\n\")), mdx(\"h3\", null, \"Building a Conversation with the AI \\u200B\\u200BChat Component\"), mdx(\"p\", null, \"In this example, we'll combine the AIChatInput and AIChatDialogue components to build a conversational use case suitable for a Multiple Agent scenario.\\nFor more examples and usage scenarios, see \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatInput\"\n  }, \"AIChatInput\"), \" and \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatDialogue\"\n  }, \"AIChatDialogue\"), \". For examples of front-end and back-end combined use cases, please refer to \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/YannLynn/semi-ai-chat-demo\"\n  }, \"semi-ai-chat-demo\"), \".\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-jsx\",\n    \"metastring\": \"live=true dir=\\\"column\\\" noInline=true\",\n    \"live\": \"true\",\n    \"dir\": \"\\\"column\\\"\",\n    \"noInline\": \"true\"\n  }, \"import React, { useState, useCallback } from 'react';\\nimport { AIChatDialogue, AIChatInput, chatInputToMessage, Typography, Button } from '@douyinfe/semi-ui';\\nimport { IconFixedStroked, IconFeishuLogo, IconBookOpenStroked, IconGit, IconFigma, IconWord, IconClose, IconTemplateStroked, IconSearch } from '@douyinfe/semi-icons';\\n\\nconst { Configure } = AIChatInput;\\n\\nconst simpleIsEqual = (a, b) => {\\n    if (a === b) {\\n        return true;\\n    }\\n    if (Number.isNaN(a) && Number.isNaN(b)) {\\n        return true;\\n    }\\n    if (typeof a !== 'object' || a === null || typeof b !== 'object' || b === null) {\\n        return false;\\n    }\\n    const isArrayA = Array.isArray(a);\\n    const isArrayB = Array.isArray(b);\\n    if (isArrayA !== isArrayB) {\\n        return false; \\n    }\\n    const keysA = Object.keys(a);\\n    const keysB = Object.keys(b);\\n    if (keysA.length !== keysB.length) {\\n        return false;\\n    }\\n    for (const key of keysA) {\\n        if (!Object.prototype.hasOwnProperty.call(b, key)) {\\n            return false;\\n        }\\n        if (!simpleIsEqual(a[key], b[key])) {\\n            return false;\\n        }\\n    }\\n    return true;\\n};\\n\\n\\nfunction AIChatInputWithDialogue() {\\n    const inputOuterStyle = { margin: '12px', minHeight: 150, maxHeight: 300, flexShrink: 0 };\\n    const editingInputOuterStyle = { margin: '12px 0px', maxHeight: 300, flexShrink: 0 };\\n    const dialogueOuterStyle = { flex: 1, overflow: 'auto' };\\n    const [sideBarVisible, setSideBarVisible] = useState(false);\\n    const [messages, setMessages] = useState(defaultMessages); \\n    const [generating, setGenerating] = useState(false);\\n    const [references, setReferences] = useState([]); \\n    const [sideBarContent, setSideBarContent] = useState({});\\n\\n    const renderLeftMenu = useCallback(() => (<>\\n        <Configure.Select optionList={modelOptions} field=\\\"model\\\" initValue=\\\"GPT-4o\\\" />\\n        <Configure.Button icon={<IconBookOpenStroked />} field=\\\"onlineSearch\\\">Online search</Configure.Button>\\n        <Configure.Mcp options={mcpOptions} />\\n        <Configure.RadioButton options={radioButtonProps} field=\\\"thinkType\\\" initValue=\\\"think\\\"/>\\n    </>), []);\\n\\n    const onChatsChange = useCallback((chats) => {\\n        console.log('onChatsChange', chats);\\n        setMessages(chats);\\n    }, []);\\n\\n    const onContentChange = useCallback((content) => {\\n        // console.log('onContentChange', content);\\n    }, []);\\n\\n\\n    const onReferenceClick = useCallback((item) => {\\n        setReferences((references) => [...references, { ...item, id: `reference-${Date.now()}` }]);\\n    }, []);\\n\\n    const handleReferenceDelete = useCallback((item) => {\\n        const newReference = references.filter((ref) => ref.id !== item.id);\\n        setReferences(newReference);\\n    }, [references]);\\n\\n    const onMessageSend = useCallback((props) => {\\n        setGenerating(true);\\n        // \\u6A21\\u62DF\\u53D1\\u9001\\u8BF7\\u6C42\\n        setMessages((messages) => [...messages, {\\n            id: `message-${Date.now()}`,\\n            ...chatInputToMessage(props),\\n        }]);\\n        setReferences([]);\\n        setTimeout(() => {\\n            setGenerating(false);\\n        }, 100);\\n        setTimeout(() => {\\n            // \\u6A21\\u62DF\\u63A5\\u53E3\\u8FD4\\u56DE\\n            setMessages((messages) => {\\n                return [...messages, {\\n                    id: `message-${Date.now()}`,\\n                    role: 'assistant',\\n                    name: 'FE',\\n                    content: \\\"This is a mock reply message.\\\",\\n                }];\\n            });\\n        }, 1000);\\n    }, []);\\n\\n    const onEditMessageSend = useCallback((props) => {\\n        const index = messages.findIndex((message) => message.editing);\\n        const newMessages = [...messages.slice(0, index), {\\n            id: `message-${Date.now()}`,\\n            ...chatInputToMessage(props),\\n        }];\\n        setMessages(newMessages);\\n    }, [messages]);\\n\\n    const handleEditingReferenceDelete = useCallback((item) => {\\n        const newMessages = messages.map((message) => {\\n            if (message.editing) {\\n                message.references = message.references.filter((ref) => ref.id !== item.id);\\n            }\\n            return message;\\n        });\\n        setMessages(newMessages);\\n    }, [messages]);\\n\\n    const messageEditRender = useCallback((props) => {\\n        return (\\n            <AIChatInput \\n                style={editingInputOuterStyle}\\n                generating={false}\\n                references={props.references}\\n                uploadProps={{ ...uploadProps, defaultFileList: props.attachments }}\\n                defaultContent={props.inputContents[0].text}\\n                renderConfigureArea={renderLeftMenu} \\n                // onContentChange={onContentChange}\\n                onMessageSend={onEditMessageSend}\\n                onReferenceDelete={handleEditingReferenceDelete}\\n            />\\n        );\\n    }, [messages, handleEditingReferenceDelete]);\\n\\n    const changeSideBarContent = useCallback((content) => {\\n        setSideBarContent((oldContent) => {\\n            if (!simpleIsEqual(content, oldContent)) {\\n                setSideBarVisible(true);\\n            } else {\\n                setSideBarVisible(v => !v);\\n            }\\n            return content;\\n        });\\n    });\\n\\n    const onAnnotationClick = useCallback((annotations) => {\\n        changeSideBarContent({\\n            type: 'annotation',\\n            value: annotations\\n        });\\n    }, [changeSideBarContent]);\\n\\n    const toggleSideBar = useCallback(() => {\\n        setSideBarVisible(v => !v);\\n    }, []);\\n\\n    const renderSideBarTitle = useCallback((content) => {\\n        const { type, value } = content;\\n        return <div style={{ display: 'flex', alignItems: 'center ', justifyContent: 'space-between', padding: 12, color: 'var(--semi-color-text)' }}>\\n            {type === 'annotation' && <div style={{ fontSize: '16px', lineHeight: '22px', fontWeight: 600 }}>References</div>}\\n            {type === 'resource' && <div style={{ fontSize: '16px', lineHeight: '22px', fontWeight: 600 }}>Product List</div>}\\n            <Button onClick={toggleSideBar} theme=\\\"borderless\\\" type=\\\"tertiary\\\" icon={<IconClose />} style={{ padding: '0px', width: 24, height: 24 }} />\\n        </div>;\\n    }, [toggleSideBar]);\\n\\n    const renderSideBarBody = useCallback((content) => {\\n        const { type, value = {} } = content;\\n        if (type === 'annotation') {\\n            return <div style={{ display: 'flex', flexDirection: 'column', rowGap: '12px', padding: '12px' }} >\\n                {value.map((item, index) => (<div key={index} style={{ display: 'flex', flexDirection: 'column', rowGap: '8px' }} >\\n                    <span style={{ display: 'flex', alignItems: 'center ', columnGap: 4 }}>\\n                        <img style={{ width: 20, height: 20, borderRadius: '50%' }} src={item.logo}/>\\n                        <span style={{ fontSize: '14px', lineHeight: '20px', fontWeight: 600, color: 'var(--semi-color-text-0)' }}>{item.title}</span>\\n                    </span>\\n                    <Typography.Paragraph ellipsis={{ rows: 3 }} style={{ fontSize: '12px', lineHeight: '16px', color: 'var(--semi-color-text-1)' }} >{item.detail}</Typography.Paragraph>\\n                </div>))}\\n            </div>;\\n        } else if (type === 'resource') {\\n            return <div style={{ display: 'flex', flexDirection: 'column', rowGap: '12px', padding: '12px' }} >\\n                <div style={{ display: 'flex', gap: 12, alignItems: 'center', }}>\\n                    <IconWord style={{ color: 'var(--semi-color-primary)' }} size='extra-large' /> {value.name}\\n                </div>\\n            </div>;\\n        }\\n        return <div>\\n\\n        </div>;\\n    }, []);\\n\\n    const customRender = {\\n        \\\"resource\\\": (item, message) => {\\n            return <div \\n                style={{ \\n                    display: 'flex', \\n                    gap: 8, \\n                    backgroundColor: 'var(--semi-color-fill-0)', \\n                    padding: '12px 16px',\\n                    justifyContent: 'center',\\n                    alignItems: 'center',\\n                    borderRadius: '12px',\\n                    cursor: 'pointer'\\n                }}\\n                onClick={() => {\\n                    changeSideBarContent({\\n                        type: 'resource',\\n                        value: item\\n                    });\\n                }}\\n            >\\n                <IconWord style={{ color: 'var(--semi-color-primary)' }} />\\n                {item.name}\\n            </div>;\\n        },\\n    };\\n\\n    return (\\n        <div style={{ display: 'flex', columnGap: 10 }}>\\n            <div style={{ display: 'flex', flexDirection: 'column', height: 'calc(100vh - 32px)', overflow: 'hidden', flexGrow: 1 }}>\\n                <AIChatDialogue \\n                    style={dialogueOuterStyle}\\n                    roleConfig={roleConfig}\\n                    showReference={true}\\n                    align=\\\"leftRight\\\"\\n                    mode=\\\"bubble\\\"\\n                    chats={messages}\\n                    onChatsChange={onChatsChange}\\n                    onReferenceClick={onReferenceClick}\\n                    messageEditRender={messageEditRender}\\n                    onAnnotationClick={onAnnotationClick}\\n                    renderDialogueContentItem={customRender}\\n                />\\n                <AIChatInput \\n                    style={inputOuterStyle}\\n                    placeholder={'Enter content or upload content'} \\n                    defaultContent={'I am a <input-slot placeholder=\\\"[Profession]\\\">programmer</input-slot>\\uFF0CPlease help me implement<input-slot placeholder=\\\"[Requirement Description]\\\">a chat application in a Multi-Agent scenario</input-slot>'}\\n                    generating={generating}\\n                    references={references}\\n                    uploadProps={uploadProps}\\n                    renderConfigureArea={renderLeftMenu} \\n                    onContentChange={onContentChange}\\n                    onMessageSend={onMessageSend}\\n                    onStopGenerate={() => setGenerating(false)}\\n                    onReferenceDelete={handleReferenceDelete}\\n                />\\n            </div>\\n            {sideBarVisible && <div \\n                style={{ flexShrink: 0, width: 300, height: 'calc(100vh - 32px)', borderRadius: '12px', border: '1px solid var(--semi-color-border)', flexShrink: 0 }}\\n            >\\n                {renderSideBarTitle(sideBarContent)}\\n                {renderSideBarBody(sideBarContent)}\\n            </div>}\\n        </div>\\n    );\\n}\\n\\n\\nconst defaultMessages = [{\\n    id: '1',\\n    role: 'user',\\n    content: 'I want to develop a chat application for a multi-agent scenario. Can you help me design it?',\\n    status: 'completed',\\n}, {\\n    id: '2',\\n    role: 'assistant',\\n    name: 'PM',\\n    content: [{\\n        type: 'message',\\n        content: [{\\n            type: 'input_text',\\n            text: 'Received. To ensure the feasibility of the solution, I will first clarify the goals and scope:\\\\n\\\\n- Goal: Support multi-agent collaborative replies, where users can choose an agent or the system can automatically assign one.\\\\n- MVP Features:\\\\n 1) Basic conversation (text/image/file)\\\\n 2) Agent identification and avatar\\\\n 3) Input in progress and streaming output\\\\n 4) Display of cited sources and tool results\\\\n- Constraints: Focus on single-session implementation first, without cloud persistence; prioritize mobile adaptation.\\\\n\\\\nNext, I will organize the PRD key points and share them with the design and front-end teams.',\\n            annotations: [\\n                {\\n                    title: 'Semi Design',\\n                    url: 'https://semi.design/en-US/start/getting-started',\\n                    detail: 'Semi Design is a design system designed, developed, and maintained by the Douyin front-end team and the MED product design team. As a comprehensive, user-friendly, and high-quality modern application UI solution, Semi Design is derived from the complex scenarios across ByteDance various business lines. It currently supports nearly a thousand platform products and serves over 100,000 internal and external users.',\\n                    logo: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/card-meta-avatar-docs-demo.jpg'\\n                },\\n                {\\n                    title: 'Semi DSM',\\n                    url: 'https://semi.design/en-US/start/getting-started',\\n                    detail: 'Semi DSM supports global and component-level style customization and maintains synchronization between Figma and online code. Using DSM, Semi Design can be adapted to Any Design.',\\n                    logo: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/card-meta-avatar-docs-demo.jpg'\\n                },\\n                {\\n                    title: 'Semi D2C',\\n                    url: 'https://semi.design/en-US/start/getting-started',\\n                    detail: 'Semi D2C offers out-of-the-box design-to-code conversion: it supports one-click recognition of layer layouts and design system components in Figma pages, reproducing design drafts pixel-perfectly and translating them into React JSX and CSS code. Furthermore, it provides rich extensibility, allowing teams to quickly create their own custom design and development collaboration tools based on a custom plugin system.',\\n                    logo: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/card-meta-avatar-docs-demo.jpg'\\n                }\\n            ],\\n        }],\\n    }],\\n}, {\\n    id: '3',\\n    role: 'assistant',\\n    name: 'PM',\\n    content: [{\\n        type: 'message',\\n        content: [{\\n            type: 'input_text',\\n            text: 'The generated PRD is as follows. The designer will first use this summary to create the information architecture and key pages.',\\n        }, {\\n            type: 'resource',\\n            name: 'PRD.doc',\\n            size: '100KB',\\n        }]\\n    }],\\n}, {\\n    id: '4',\\n    role: 'assistant',\\n    name: 'UI',\\n    content: [{\\n        id: \\\"rs_02175871288540800000000000000000000ffffac1598778c9aa5\\\",\\n        type: \\\"reasoning\\\",\\n        summary: [\\n            {\\n                \\\"type\\\": \\\"summary_text\\\",\\n                \\\"text\\\": \\\"\\\\nBased on the PRD provided by the product manager, I need to draw the key pages.\\\"\\n            }\\n        ],\\n        status: \\\"completed\\\"\\n    }, {\\n        type: 'function_call',\\n        name: 'paint_key_pages',\\n        arguments: \\\"{\\\\\\\"file\\\\\\\":\\\\\\\"PRD\\\\\\\"}\\\",\\n        status: 'completed',\\n    }, {\\n        type: 'message',\\n        content: [{\\n            \\\"type\\\": \\\"output_text\\\",\\n            \\\"text\\\": `The initial design draft is as follows:\\\\n\\\\n- Information Architecture: Dialogue Page (History List | Message Flow | Tool Card Area)\\\\n- Visuals: The left side displays Agent avatars and name tags, with color blocks distinguishing roles\\\\n- Interaction:\\\\n- Input area supports quick switching and suggestion prompts using @Agent\\\\n- During streaming output, a typing bubble and progress placeholder are displayed\\\\n- Tool results are inserted in the form of cards/step bars, which can be expanded for details and copied\\\\n\\\\nI'll start with a low-fidelity wireframe; high-fidelity and animation details will be added later.`,\\n        }],\\n        status: \\\"completed\\\"\\n    }],\\n    status: 'completed',\\n}, {\\n    id: '5',\\n    role: 'assistant',\\n    name: 'FE',\\n    content: `Technical Solution Suggestions:\\\\n\\\\n- Technology Stack: React + Semi UI, backend using WebSocket or SSE to support streaming responses\\\\n- Data Model: Messages include fields such as id, role, name, content, status, and references\\\\n- Component Splitting: AIChatInput + AIChatDialogue; content rendered using Markdown, supporting image and file clicks\\\\n- Performance: Virtual list and scroll-to-bottom; long text chunked rendering; lazy loading of images\\\\n- Observability: Message tracking latency, error rate, and tool call time\\\\n\\\\nIf confirmed, I can first build the page skeleton and integrate mock data for integration testing.`,\\n}];\\n\\nconst roleConfig = {\\n    user: {\\n        name: 'User',\\n        avatar: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/22606991eh7uhfups/img/user.png'\\n    },\\n    assistant: new Map([\\n        ['PM', {\\n            name: 'Product Manager',\\n            avatar: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/22606991eh7uhfups/PM.png'\\n        }],\\n        ['UI', {\\n            name: 'Designer',\\n            avatar: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/22606991eh7uhfups/UI.png'\\n        }],\\n        ['FE', {\\n            name: 'Front-end programmer',\\n            avatar: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/22606991eh7uhfups/FE.png'\\n        }],\\n    ]),\\n};\\n\\nconst uploadProps = {\\n    action: \\\"https://api.semi.design/upload\\\"\\n};\\n\\nconst modelOptions = [\\n    {\\n        value: 'GPT-5',\\n        label: 'GPT-5',\\n        type: 'gpt',\\n    },\\n    {\\n        value: 'GPT-4o',\\n        label: 'GPT-4o',\\n        type: 'gpt',\\n    },\\n    {\\n        value: 'Claude 3.5 Sonnet',\\n        label: 'Claude 3.5 Sonnet',\\n        type: 'claude',\\n    },\\n];\\n\\nconst mcpOptions = [\\n    {\\n        icon: <IconFeishuLogo />,\\n        label: \\\"Lark Doc\\\",\\n        value: \\\"feishu\\\",\\n    },\\n    {\\n        icon: <IconGit />,\\n        label: \\\"Github Mcp\\\",\\n        value: \\\"github\\\",\\n    },\\n    {\\n        icon: <IconFigma />,\\n        label: \\\"IconFigma Mcp\\\",\\n        value: \\\"IconFigma\\\",\\n    }\\n];\\n\\nconst radioButtonProps = [\\n    { label: <IconTemplateStroked />, value: 'fast' },\\n    { label: <IconSearch />, value: 'think' }\\n];\\n\\nrender(AIChatInputWithDialogue);\\n\")), mdx(\"h3\", null, \"FAQ\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"How should you choose between Chat components and AI Chat series components?\"), mdx(\"ul\", {\n    parentName: \"li\"\n  }, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"If the scenario is relatively simple, requiring only plain text conversations and basic document/image displays, the Chat component is recommended.\", mdx(\"ul\", {\n    parentName: \"li\"\n  }, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/plus/chat\"\n  }, \"Chat\"), \" component integrates input and message display by default. Its advantage is that it is easy to understand and can be quickly learned. Its disadvantage is that it is relatively difficult to customize complex input boxes or message display requirements, and the workload is large.\"))), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"If the scenario is relatively complex, it is recommended to use the AIChatInput and AIChatDialogue components together, with the following advantages:\", mdx(\"ul\", {\n    parentName: \"li\"\n  }, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatInput\"\n  }, \"AIChatInput\"), \" supports more complex style customization\", mdx(\"ol\", {\n    parentName: \"li\"\n  }, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Users can easily customize the \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatInput#%E9%85%8D%E7%BD%AE%E5%8C%BA%E5%9F%9F\"\n  }, \"configuration area\"), \" in the lower left corner and the \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatInput#%E6%93%8D%E4%BD%9C%E5%8C%BA%E5%9F%9F\"\n  }, \"operation area\"), \" in the lower right corner.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Provides a \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatInput#%E5%AF%8C%E6%96%87%E6%9C%AC%E8%BE%93%E5%85%A5%E5%8C%BA\"\n  }, \"rich text input area\"), \"to display input templates;\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"By default, it supports displaying \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatInput#%E5%BC%95%E7%94%A8\"\n  }, \"reference\"), \".\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"Supports hotkey-activated \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatInput#%E6%8A%80%E8%83%BD%E5%8F%8A%E6%A8%A1%E7%89%88\"\n  }, \"skill templates\"), \";\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"It supports custom \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatInput#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%89%A9%E5%B1%95\"\n  }, \"Input Extension\"), \" and \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatInput#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%B8%B2%E6%9F%93%E9%A1%B6%E9%83%A8%E5%8C%BA%E5%9F%9F\"\n  }, \"TopSlot\"), \", making complex displays easy to achieve.\"))), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatDialogue\"\n  }, \"AIChatDialogue\"), \" message display is more flexible\\u3002\", mdx(\"ol\", {\n    parentName: \"li\"\n  }, mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"The component supports OpenAI's \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://platform.openai.com/docs/api-reference/responses/create\"\n  }, \"Response\"), \" / \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https://platform.openai.com/docs/api-reference/chat/create\"\n  }, \"Chat Completion\"), \" Object format standard by default. Calling the \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatDialogue#%E6%B6%88%E6%81%AF%E6%95%B0%E6%8D%AE%E8%BD%AC%E6%8D%A2\"\n  }, \"internal message conversion function\"), \" can easily convert the results returned by OpenAI into the data structure required by the component.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"It provides an API for \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatDialogue#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%B8%B2%E6%9F%93%E6%B6%88%E6%81%AF%E5%86%85%E5%AE%B9\"\n  }, \"customized display based on message type\"), \" to facilitate quick and easy message display.\"), mdx(\"li\", {\n    parentName: \"ol\"\n  }, \"By default, message \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatDialogue#%E5%BC%95%E7%94%A8\"\n  }, \"reference\"), \" and \", mdx(\"a\", {\n    parentName: \"li\",\n    \"href\": \"https:/lf3-static.semi.design/obj/semi-tos/semi_main/en-US/ai/aiChatDialogue#%E9%80%89%E6%8B%A9\"\n  }, \"select\"), \" operations are supported.\")))))))));\n}\n;\nMDXContent.isMDXComponent = true;"}},"pageContext":{"slug":"en-US/ai/aiComponent","next":{"fields":{"slug":"zh-CN/ai/aiComponent"},"id":"8e7cb4ef-153a-506c-9a80-9404d68ee9de","frontmatter":{"title":"AIComponent 能力介绍","localeCode":"zh-CN","icon":"doc-aiComponent","showNew":true}},"previous":{"fields":{"slug":"zh-CN/plus/videoPlayer"},"id":"2e754624-21a3-5b3c-bf73-482d3aaafcc4","frontmatter":{"title":"VideoPlayer 视频播放器","localeCode":"zh-CN","icon":"doc-videoplayer","showNew":null}}}},"staticQueryHashes":["1348983216229725","1477422646229725","3245198693229725","417590761229725","63159454229725"]}