yt-chat-components 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/langflow-embedded-chat.iml +12 -0
- package/.idea/modules.xml +8 -0
- package/.idea/sonarlint/issuestore/0/f/0f8c0c92cf798431ebb931ff6e997b1af86ecee5 +0 -0
- package/.idea/sonarlint/issuestore/3/9/39129446b425a1d640160c068e4194e96639eedf +0 -0
- package/.idea/sonarlint/issuestore/4/a/4a2f33951ce07c1ff7184f91877aa13db05d3785 +0 -0
- package/.idea/sonarlint/issuestore/4/a/4a7b99bdbee5792679d347b6474463bf5e14b66d +0 -0
- package/.idea/sonarlint/issuestore/4/b/4b6989b8ccae808ebc45d02230d336ea53800365 +0 -0
- package/.idea/sonarlint/issuestore/6/c/6c024c1d0ad64656b9d4b0695ec3c49c0454addf +0 -0
- package/.idea/sonarlint/issuestore/8/d/8d6123af13a140f93e06299fff7ea23c547e9ec8 +0 -0
- package/.idea/sonarlint/issuestore/8/e/8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d +0 -0
- package/.idea/sonarlint/issuestore/d/9/d938938695d447dadda115e28781c6541f53fc4f +0 -0
- package/.idea/sonarlint/issuestore/index.pb +19 -0
- package/.idea/vcs.xml +6 -0
- package/README.md +274 -0
- package/build/asset-manifest.json +16 -0
- package/build/index.html +1 -0
- package/build/static/css/main.6f7c593d.css +2 -0
- package/build/static/css/main.6f7c593d.css.map +1 -0
- package/build/static/js/bundle.min.js +2 -0
- package/build/static/js/bundle.min.js.LICENSE.txt +124 -0
- package/build/static/js/main.cb252095.js +3 -0
- package/build/static/js/main.cb252095.js.LICENSE.txt +134 -0
- package/build/static/js/main.cb252095.js.map +1 -0
- package/build/static/media/aiavatar.74bafa995cce4c01b804.png +0 -0
- package/build/static/media/history-list-empty.1eb65b1550aef4e8c8a4.png +0 -0
- package/build/static/media/moreBg.9fc998472925cecd89f2.png +0 -0
- package/package.json +75 -0
- package/public/index.html +47 -0
- package/src/YtChatView/chatWidget/chatWindow/chatMessage/index.module.css +86 -0
- package/src/YtChatView/chatWidget/chatWindow/chatMessage/index.tsx +211 -0
- package/src/YtChatView/chatWidget/chatWindow/chatPlaceholder/index.module.css +9 -0
- package/src/YtChatView/chatWidget/chatWindow/chatPlaceholder/index.tsx +23 -0
- package/src/YtChatView/chatWidget/chatWindow/controllers/index.ts +236 -0
- package/src/YtChatView/chatWidget/chatWindow/index.module.css +197 -0
- package/src/YtChatView/chatWidget/chatWindow/index.tsx +791 -0
- package/src/YtChatView/chatWidget/chatWindow/types/chatWidget/index.ts +37 -0
- package/src/YtChatView/chatWidget/chatWindow/utils.ts +75 -0
- package/src/YtChatView/chatWidget/index.tsx +2289 -0
- package/src/YtChatView/logoBtn/index.css +4 -0
- package/src/YtChatView/logoBtn/index.jsx +65 -0
- package/src/YtChatView/logoSplitBtn/index.css +4 -0
- package/src/YtChatView/logoSplitBtn/index.jsx +67 -0
- package/src/YtChatView/previewDialog/index.jsx +431 -0
- package/src/YtChatView/previewDialog/index.module.css +144 -0
- package/src/assets/aicenter/add.png +0 -0
- package/src/assets/aicenter/aiavatar.png +0 -0
- package/src/assets/aicenter/aicenterbg.png +0 -0
- package/src/assets/aicenter/aicenterbgdark.png +0 -0
- package/src/assets/aicenter/close.png +0 -0
- package/src/assets/aicenter/closex.png +0 -0
- package/src/assets/aicenter/copy.png +0 -0
- package/src/assets/aicenter/file.png +0 -0
- package/src/assets/aicenter/fileupload.png +0 -0
- package/src/assets/aicenter/history-list-empty.png +0 -0
- package/src/assets/aicenter/history.png +0 -0
- package/src/assets/aicenter/luyin.png +0 -0
- package/src/assets/aicenter/moreAi.png +0 -0
- package/src/assets/aicenter/moreBg.png +0 -0
- package/src/assets/aicenter/play-run.gif +0 -0
- package/src/assets/aicenter/play.png +0 -0
- package/src/assets/aicenter/send-img.png +0 -0
- package/src/assets/aicenter/send-question-black.png +0 -0
- package/src/assets/aicenter/send-question.png +0 -0
- package/src/assets/aicenter/sendmessage.png +0 -0
- package/src/assets/aicenter/sound-wave.gif +0 -0
- package/src/assets/aicenter/toLeft.png +0 -0
- package/src/assets/aicenter/toRight.png +0 -0
- package/src/assets/aicenter/type-excel.png +0 -0
- package/src/assets/aicenter/type-markdown.png +0 -0
- package/src/assets/aicenter/type-mobi.png +0 -0
- package/src/assets/aicenter/type-pdf.png +0 -0
- package/src/assets/aicenter/type-rpub.png +0 -0
- package/src/assets/aicenter/type-text.png +0 -0
- package/src/assets/aicenter/type-word.png +0 -0
- package/src/assets/aicenter/upfile.png +0 -0
- package/src/chatPlaceholder/index.tsx +18 -0
- package/src/chatWidget/chatTrigger/index.tsx +15 -0
- package/src/chatWidget/chatWindow/chatMessage/index.tsx +42 -0
- package/src/chatWidget/chatWindow/index.tsx +426 -0
- package/src/chatWidget/index.tsx +2195 -0
- package/src/chatWidget/utils.ts +76 -0
- package/src/controllers/index.ts +205 -0
- package/src/index.tsx +60 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/reportWebVitals.ts +15 -0
- package/src/setupTests.ts +5 -0
- package/src/types/chatWidget/index.ts +13 -0
- package/tsconfig.json +26 -0
- package/webpack.config.js +51 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
.p_closeImg {
|
|
2
|
+
width: 14px;
|
|
3
|
+
cursor: pointer;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.p_toolDialog {
|
|
7
|
+
display: flex;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.p_toolDialog .p_toolLeft {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
align-items: center;
|
|
14
|
+
/*width: 300px;*/
|
|
15
|
+
/*height: 100%;*/
|
|
16
|
+
background: linear-gradient(180deg, #CFDAFC 0%, #F0F3FF 100%);
|
|
17
|
+
padding: 24px;
|
|
18
|
+
border-top-left-radius: 8px;
|
|
19
|
+
border-bottom-left-radius: 8px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.p_toolDialog .p_toolLeft .p_toolLogo {
|
|
23
|
+
user-select: none;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.p_toolDialog .p_toolLeft .p_toolLogo .p_logoImg {
|
|
29
|
+
width: 60px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.p_toolDialog .p_toolLeft .p_toolLogo .p_logoText {
|
|
33
|
+
font-weight: bold;
|
|
34
|
+
margin-left: 10px;
|
|
35
|
+
padding-top: 16px;
|
|
36
|
+
font-size: 30px;
|
|
37
|
+
background: linear-gradient(to right, #1551FF, #8F4BFF);
|
|
38
|
+
-webkit-background-clip: text;
|
|
39
|
+
-webkit-text-fill-color: transparent;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.p_toolDialog .p_toolLeft .p_historyDialog {
|
|
43
|
+
user-select: none;
|
|
44
|
+
margin-top: 20px;
|
|
45
|
+
margin-bottom: 20px;
|
|
46
|
+
border-radius: 10px;
|
|
47
|
+
flex: 1;
|
|
48
|
+
width: 100%;
|
|
49
|
+
background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
|
|
50
|
+
border-image: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)) 1 1;
|
|
51
|
+
backdrop-filter: blur(10px);
|
|
52
|
+
position: relative;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.p_toolDialog .p_toolLeft .p_historyDialog ::-webkit-scrollbar-thumb {
|
|
56
|
+
border-radius: 10px;
|
|
57
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
|
|
58
|
+
background: #535353 !important;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle {
|
|
62
|
+
padding: 16px 16px 0 16px;
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle .p_historyImg {
|
|
68
|
+
width: 20px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyTitle .p_dialogTitle {
|
|
72
|
+
font-weight: bold;
|
|
73
|
+
font-size: 16px;
|
|
74
|
+
margin-left: 10px;
|
|
75
|
+
color: #666666;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyListEmpty {
|
|
79
|
+
position: absolute;
|
|
80
|
+
top: 50%;
|
|
81
|
+
left: 50%;
|
|
82
|
+
transform: translate(-50%, -50%);
|
|
83
|
+
text-align: center;
|
|
84
|
+
font-size: 12px;
|
|
85
|
+
color: #999999;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList {
|
|
89
|
+
margin-top: 10px;
|
|
90
|
+
/*height: 360px;*/
|
|
91
|
+
overflow-y: auto;
|
|
92
|
+
scrollbar-width: none !important; /* firefox */
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList:hover {
|
|
96
|
+
scrollbar-width: thin !important; /* firefox */
|
|
97
|
+
scrollbar-color: #ced4e3 transparent;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem {
|
|
101
|
+
padding: 7px 16px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_activeHistoryName {
|
|
105
|
+
color: #1552FF !important;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_historyName {
|
|
109
|
+
color: #333333;
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
text-overflow: ellipsis;
|
|
112
|
+
white-space: nowrap;
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.p_toolDialog .p_toolLeft .p_historyDialog .p_historyList .p_historyItem .p_historyName:hover {
|
|
117
|
+
color: #171717;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.p_toolDialog .p_toolRight {
|
|
121
|
+
flex: 1;
|
|
122
|
+
width: calc(100% - 300px);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.p_newDialog {
|
|
126
|
+
width: 252px;
|
|
127
|
+
height: 40px;
|
|
128
|
+
background: linear-gradient(244deg, #828EFE 0%, #4B4FFF 100%);
|
|
129
|
+
margin-top: 20px;
|
|
130
|
+
border-radius: 20px;
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
display: flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
justify-content: center;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.p_newDialog img {
|
|
138
|
+
width: 18px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.p_newDialog .p_newDialogText {
|
|
142
|
+
color: #fff;
|
|
143
|
+
margin-left: 6px;
|
|
144
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MoreHorizontal } from "lucide-react";
|
|
2
|
+
import { ChatMessagePlaceholderType } from "../types/chatWidget";
|
|
3
|
+
|
|
4
|
+
export default function ChatMessagePlaceholder({
|
|
5
|
+
bot_message_style,
|
|
6
|
+
}: ChatMessagePlaceholderType) {
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
className="cl-chat-message cl-justify-start"
|
|
10
|
+
>
|
|
11
|
+
<div style={bot_message_style} className={"cl-bot_message"}>
|
|
12
|
+
<div className="cl-animate-pulse">
|
|
13
|
+
<MoreHorizontal />
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MessageSquare, X } from "lucide-react"
|
|
2
|
+
export default function ChatTrigger({ style, open, setOpen, triggerRef }: { style?: React.CSSProperties, open: boolean, setOpen: Function, triggerRef: React.RefObject<HTMLButtonElement> | null }) {
|
|
3
|
+
|
|
4
|
+
return (
|
|
5
|
+
<button ref={triggerRef} style={style}
|
|
6
|
+
onClick={() => { setOpen(!open) }}
|
|
7
|
+
onMouseDown={(e) => {
|
|
8
|
+
e.preventDefault()
|
|
9
|
+
}}
|
|
10
|
+
className="cl-trigger">
|
|
11
|
+
<X className={"cl-trigger-icon " + (open ? "cl-scale-100" : "cl-scale-0")} />
|
|
12
|
+
<MessageSquare className={"cl-trigger-icon " + (open ? "cl-scale-0" : "cl-scale-100")} />
|
|
13
|
+
</button>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import Markdown from "react-markdown";
|
|
2
|
+
import { ChatMessageType } from "../../../types/chatWidget";
|
|
3
|
+
import remarkGfm from "remark-gfm";
|
|
4
|
+
import rehypeMathjax from "rehype-mathjax";
|
|
5
|
+
|
|
6
|
+
export default function ChatMessage({
|
|
7
|
+
message,
|
|
8
|
+
isSend,
|
|
9
|
+
error,
|
|
10
|
+
user_message_style,
|
|
11
|
+
bot_message_style,
|
|
12
|
+
error_message_style,
|
|
13
|
+
}: ChatMessageType) {
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
className={
|
|
18
|
+
"cl-chat-message " + (isSend ? " cl-justify-end" : " cl-justify-start")
|
|
19
|
+
}
|
|
20
|
+
>
|
|
21
|
+
{isSend ? (
|
|
22
|
+
<div style={user_message_style} className="cl-user_message">
|
|
23
|
+
{message}
|
|
24
|
+
</div>
|
|
25
|
+
) : error ? (
|
|
26
|
+
<div style={error_message_style} className={"cl-error_message"}>
|
|
27
|
+
{message}
|
|
28
|
+
</div>
|
|
29
|
+
) : (
|
|
30
|
+
<div style={bot_message_style} className={"cl-bot_message"}>
|
|
31
|
+
<Markdown
|
|
32
|
+
className={"markdown-body prose flex flex-col word-break-break-word"}
|
|
33
|
+
remarkPlugins={[remarkGfm]}
|
|
34
|
+
rehypePlugins={[rehypeMathjax]}
|
|
35
|
+
>
|
|
36
|
+
{message}
|
|
37
|
+
</Markdown>
|
|
38
|
+
</div>
|
|
39
|
+
)}
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|