@@ -21,14 +21,42 @@ import {
21
21
import { Button } from "../ui/button" ;
22
22
import { MarkdownText } from "./markdown-text" ;
23
23
import { TooltipIconButton } from "./tooltip-icon-button" ;
24
+ import { Spin , Flex } from "antd" ;
25
+ import { LoadingOutlined } from "@ant-design/icons" ;
26
+ import styled from "styled-components" ;
27
+ const SimpleANTDLoader = ( ) => {
28
+ const antIcon = < LoadingOutlined style = { { fontSize : 24 } } spin /> ;
29
+
30
+ return (
31
+ < div style = { { textAlign : 'left' , width : '100%' } } >
32
+ < Flex align = "center" gap = { 12 } style = { { paddingLeft : '16px' } } >
33
+ < Spin indicator = { antIcon } size = "small" />
34
+ < span style = { { color : '#666' , fontSize : '14px' } } > Working on it...</ span >
35
+ </ Flex >
36
+ </ div >
37
+ ) ;
38
+ } ;
39
+
40
+ const StyledThreadRoot = styled ( ThreadPrimitive . Root ) `
41
+ /* Hide entire assistant message container when it contains running status */
42
+ .aui-assistant-message-root:has([data-status="running"]) {
43
+ display: none;
44
+ }
45
+
46
+ /* Fallback for older browsers that don't support :has() */
47
+ .aui-assistant-message-content [data-status="running"] {
48
+ display: none;
49
+ }
50
+ ` ;
51
+
24
52
25
53
interface ThreadProps {
26
54
placeholder ?: string ;
27
55
}
28
56
29
57
export const Thread : FC < ThreadProps > = ( { placeholder = "Write a message..." } ) => {
30
58
return (
31
- < ThreadPrimitive . Root
59
+ < StyledThreadRoot
32
60
className = "aui-root aui-thread-root"
33
61
style = { {
34
62
[ "--thread-max-width" as string ] : "42rem" ,
@@ -44,6 +72,10 @@ import {
44
72
AssistantMessage : AssistantMessage ,
45
73
} }
46
74
/>
75
+
76
+ < ThreadPrimitive . If running >
77
+ < SimpleANTDLoader />
78
+ </ ThreadPrimitive . If >
47
79
48
80
< ThreadPrimitive . If empty = { false } >
49
81
< div className = "aui-thread-viewport-spacer" />
@@ -54,7 +86,7 @@ import {
54
86
< Composer placeholder = { placeholder } />
55
87
</ div >
56
88
</ ThreadPrimitive . Viewport >
57
- </ ThreadPrimitive . Root >
89
+ </ StyledThreadRoot >
58
90
) ;
59
91
} ;
60
92
0 commit comments