test-chat-sdk 0.0.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.
Files changed (208) hide show
  1. package/.prettierrc.js +24 -0
  2. package/README.md +46 -0
  3. package/config/env.js +104 -0
  4. package/config/getHttpsConfig.js +66 -0
  5. package/config/jest/babelTransform.js +29 -0
  6. package/config/jest/cssTransform.js +14 -0
  7. package/config/jest/fileTransform.js +40 -0
  8. package/config/modules.js +134 -0
  9. package/config/paths.js +77 -0
  10. package/config/webpack/persistentCache/createEnvironmentHash.js +9 -0
  11. package/config/webpack.config.js +785 -0
  12. package/config/webpackDevServer.config.js +127 -0
  13. package/dist/Chat/AgentList/index.d.ts +9 -0
  14. package/dist/Chat/ChatFooter/index.d.ts +17 -0
  15. package/dist/Chat/Conversation/index.d.ts +11 -0
  16. package/dist/Chat/MessageContainer/index.d.ts +19 -0
  17. package/dist/Chat/MobileAgents/index.d.ts +11 -0
  18. package/dist/Chat/components/AgentTip/index.d.ts +8 -0
  19. package/dist/Chat/components/ConversationModal/index.d.ts +10 -0
  20. package/dist/Chat/components/CopilotAvatar/index.d.ts +2 -0
  21. package/dist/Chat/components/Message.d.ts +10 -0
  22. package/dist/Chat/components/RecommendQuestions/index.d.ts +6 -0
  23. package/dist/Chat/components/Text.d.ts +9 -0
  24. package/dist/Chat/constants.d.ts +19 -0
  25. package/dist/Chat/index.d.ts +17 -0
  26. package/dist/Chat/service.d.ts +11 -0
  27. package/dist/Chat/type.d.ts +97 -0
  28. package/dist/Copilot/constants.d.ts +11 -0
  29. package/dist/Copilot/index.d.ts +13 -0
  30. package/dist/ShowCase/index.d.ts +8 -0
  31. package/dist/ShowCase/service.d.ts +2 -0
  32. package/dist/ShowCase/type.d.ts +11 -0
  33. package/dist/common/constants.d.ts +58 -0
  34. package/dist/common/env.d.ts +3 -0
  35. package/dist/common/type.d.ts +247 -0
  36. package/dist/components/ChatItem/ExecuteItem.d.ts +25 -0
  37. package/dist/components/ChatItem/ExpandParseTip.d.ts +20 -0
  38. package/dist/components/ChatItem/FilterItem.d.ts +17 -0
  39. package/dist/components/ChatItem/Loading.d.ts +2 -0
  40. package/dist/components/ChatItem/ParseTip.d.ts +26 -0
  41. package/dist/components/ChatItem/ParseTipUtils.d.ts +10 -0
  42. package/dist/components/ChatItem/SimilarQuestionItem.d.ts +10 -0
  43. package/dist/components/ChatItem/SqlItem.d.ts +17 -0
  44. package/dist/components/ChatItem/SwitchEntity.d.ts +9 -0
  45. package/dist/components/ChatItem/Text.d.ts +6 -0
  46. package/dist/components/ChatItem/Typing.d.ts +2 -0
  47. package/dist/components/ChatItem/index.d.ts +33 -0
  48. package/dist/components/ChatMsg/ApplyAuth/index.d.ts +7 -0
  49. package/dist/components/ChatMsg/Bar/index.d.ts +13 -0
  50. package/dist/components/ChatMsg/DateOptions/index.d.ts +9 -0
  51. package/dist/components/ChatMsg/FilterSection/index.d.ts +8 -0
  52. package/dist/components/ChatMsg/MarkDown/index.d.ts +10 -0
  53. package/dist/components/ChatMsg/Message/index.d.ts +18 -0
  54. package/dist/components/ChatMsg/MetricCard/PeriodCompareItem.d.ts +7 -0
  55. package/dist/components/ChatMsg/MetricCard/index.d.ts +10 -0
  56. package/dist/components/ChatMsg/MetricTrend/MetricInfo.d.ts +8 -0
  57. package/dist/components/ChatMsg/MetricTrend/MetricTrendChart.d.ts +14 -0
  58. package/dist/components/ChatMsg/MetricTrend/MultiMetricsTrendChart.d.ts +12 -0
  59. package/dist/components/ChatMsg/MetricTrend/index.d.ts +16 -0
  60. package/dist/components/ChatMsg/NoPermissionChart/index.d.ts +8 -0
  61. package/dist/components/ChatMsg/Pie/PieChart.d.ts +11 -0
  62. package/dist/components/ChatMsg/Pie/index.d.ts +14 -0
  63. package/dist/components/ChatMsg/Table/index.d.ts +12 -0
  64. package/dist/components/ChatMsg/Text/index.d.ts +9 -0
  65. package/dist/components/ChatMsg/WebPage/index.d.ts +8 -0
  66. package/dist/components/ChatMsg/index.d.ts +15 -0
  67. package/dist/components/DrillDownDimensions/DimensionSection.d.ts +11 -0
  68. package/dist/components/DrillDownDimensions/index.d.ts +13 -0
  69. package/dist/components/IconFont/index.d.ts +3 -0
  70. package/dist/components/MetricOptions/index.d.ts +11 -0
  71. package/dist/components/RecommendOptions/index.d.ts +9 -0
  72. package/dist/components/Tools/FeedbackModal.d.ts +9 -0
  73. package/dist/components/Tools/index.d.ts +12 -0
  74. package/dist/demo/Chat.d.ts +2 -0
  75. package/dist/demo/ChatDemo.d.ts +4 -0
  76. package/dist/demo/CopilotDemo.d.ts +2 -0
  77. package/dist/hooks/index.d.ts +3 -0
  78. package/dist/hooks/useComposing.d.ts +5 -0
  79. package/dist/hooks/useExportByEcharts.d.ts +10 -0
  80. package/dist/hooks/useMethodRegister.d.ts +4 -0
  81. package/dist/index.d.ts +10 -0
  82. package/dist/index.es.js +1 -0
  83. package/dist/service/axiosInstance.d.ts +3 -0
  84. package/dist/service/index.d.ts +25 -0
  85. package/dist/utils/utils.d.ts +45 -0
  86. package/package.json +214 -0
  87. package/public/favicon.ico +0 -0
  88. package/public/index.html +43 -0
  89. package/public/manifest.json +15 -0
  90. package/public/robots.txt +3 -0
  91. package/rollup/rollup.config.mjs +37 -0
  92. package/rollup/rollup.esm.config.mjs +21 -0
  93. package/rollup/rollup.umd.config.mjs +30 -0
  94. package/scripts/build.js +217 -0
  95. package/scripts/start.js +154 -0
  96. package/scripts/test.js +52 -0
  97. package/src/Chat/AgentList/index.tsx +52 -0
  98. package/src/Chat/AgentList/style.module.less +83 -0
  99. package/src/Chat/ChatFooter/index.tsx +423 -0
  100. package/src/Chat/ChatFooter/style.module.less +225 -0
  101. package/src/Chat/Conversation/index.tsx +236 -0
  102. package/src/Chat/Conversation/style.module.less +171 -0
  103. package/src/Chat/MessageContainer/index.tsx +145 -0
  104. package/src/Chat/MessageContainer/style.module.less +53 -0
  105. package/src/Chat/MobileAgents/index.tsx +62 -0
  106. package/src/Chat/MobileAgents/style.module.less +55 -0
  107. package/src/Chat/components/AgentTip/index.tsx +48 -0
  108. package/src/Chat/components/AgentTip/style.module.less +44 -0
  109. package/src/Chat/components/ConversationModal/index.tsx +65 -0
  110. package/src/Chat/components/CopilotAvatar/index.tsx +8 -0
  111. package/src/Chat/components/CopilotAvatar/style.module.less +13 -0
  112. package/src/Chat/components/Message.tsx +38 -0
  113. package/src/Chat/components/RecommendQuestions/index.tsx +64 -0
  114. package/src/Chat/components/RecommendQuestions/style.module.less +36 -0
  115. package/src/Chat/components/Text.tsx +42 -0
  116. package/src/Chat/components/style.module.less +311 -0
  117. package/src/Chat/constants.ts +37 -0
  118. package/src/Chat/index.tsx +526 -0
  119. package/src/Chat/service.ts +49 -0
  120. package/src/Chat/style.module.less +119 -0
  121. package/src/Chat/type.ts +107 -0
  122. package/src/Copilot/constants.ts +11 -0
  123. package/src/Copilot/index.tsx +149 -0
  124. package/src/Copilot/style.module.less +151 -0
  125. package/src/ShowCase/index.tsx +120 -0
  126. package/src/ShowCase/service.ts +12 -0
  127. package/src/ShowCase/style.module.less +46 -0
  128. package/src/ShowCase/type.ts +14 -0
  129. package/src/common/constants.ts +93 -0
  130. package/src/common/env.ts +5 -0
  131. package/src/common/type.ts +270 -0
  132. package/src/components/ChatItem/ExecuteItem.tsx +210 -0
  133. package/src/components/ChatItem/ExpandParseTip.tsx +333 -0
  134. package/src/components/ChatItem/FilterItem.tsx +209 -0
  135. package/src/components/ChatItem/Loading.tsx +14 -0
  136. package/src/components/ChatItem/ParseTip.tsx +322 -0
  137. package/src/components/ChatItem/ParseTipUtils.tsx +205 -0
  138. package/src/components/ChatItem/SimilarQuestionItem.tsx +84 -0
  139. package/src/components/ChatItem/SqlItem.tsx +410 -0
  140. package/src/components/ChatItem/SwitchEntity.tsx +52 -0
  141. package/src/components/ChatItem/Text.tsx +17 -0
  142. package/src/components/ChatItem/Typing.tsx +19 -0
  143. package/src/components/ChatItem/index.tsx +843 -0
  144. package/src/components/ChatItem/style.less +670 -0
  145. package/src/components/ChatMsg/ApplyAuth/index.tsx +30 -0
  146. package/src/components/ChatMsg/ApplyAuth/style.less +13 -0
  147. package/src/components/ChatMsg/Bar/index.tsx +208 -0
  148. package/src/components/ChatMsg/Bar/style.less +60 -0
  149. package/src/components/ChatMsg/DateOptions/index.tsx +46 -0
  150. package/src/components/ChatMsg/DateOptions/style.less +43 -0
  151. package/src/components/ChatMsg/FilterSection/index.tsx +42 -0
  152. package/src/components/ChatMsg/FilterSection/style.less +37 -0
  153. package/src/components/ChatMsg/MarkDown/index.tsx +26 -0
  154. package/src/components/ChatMsg/MarkDown/style.less +9 -0
  155. package/src/components/ChatMsg/Message/index.tsx +105 -0
  156. package/src/components/ChatMsg/Message/style.less +119 -0
  157. package/src/components/ChatMsg/MetricCard/PeriodCompareItem.tsx +29 -0
  158. package/src/components/ChatMsg/MetricCard/index.tsx +80 -0
  159. package/src/components/ChatMsg/MetricCard/style.less +126 -0
  160. package/src/components/ChatMsg/MetricTrend/MetricInfo.tsx +60 -0
  161. package/src/components/ChatMsg/MetricTrend/MetricTrendChart.tsx +235 -0
  162. package/src/components/ChatMsg/MetricTrend/MultiMetricsTrendChart.tsx +162 -0
  163. package/src/components/ChatMsg/MetricTrend/index.tsx +127 -0
  164. package/src/components/ChatMsg/MetricTrend/style.less +195 -0
  165. package/src/components/ChatMsg/NoPermissionChart/index.tsx +28 -0
  166. package/src/components/ChatMsg/NoPermissionChart/style.less +26 -0
  167. package/src/components/ChatMsg/Pie/PieChart.tsx +120 -0
  168. package/src/components/ChatMsg/Pie/index.tsx +88 -0
  169. package/src/components/ChatMsg/Pie/style.less +43 -0
  170. package/src/components/ChatMsg/Table/index.tsx +103 -0
  171. package/src/components/ChatMsg/Table/style.less +131 -0
  172. package/src/components/ChatMsg/Text/index.tsx +70 -0
  173. package/src/components/ChatMsg/Text/style.less +38 -0
  174. package/src/components/ChatMsg/WebPage/index.tsx +125 -0
  175. package/src/components/ChatMsg/index.tsx +428 -0
  176. package/src/components/ChatMsg/style.less +28 -0
  177. package/src/components/DrillDownDimensions/DimensionSection.tsx +99 -0
  178. package/src/components/DrillDownDimensions/index.tsx +76 -0
  179. package/src/components/DrillDownDimensions/style.less +64 -0
  180. package/src/components/IconFont/index.tsx +7 -0
  181. package/src/components/MetricOptions/index.tsx +75 -0
  182. package/src/components/MetricOptions/style.less +69 -0
  183. package/src/components/RecommendOptions/index.tsx +126 -0
  184. package/src/components/RecommendOptions/style.less +24 -0
  185. package/src/components/Tools/FeedbackModal.tsx +55 -0
  186. package/src/components/Tools/index.tsx +126 -0
  187. package/src/components/Tools/style.less +67 -0
  188. package/src/demo/Chat.tsx +73 -0
  189. package/src/demo/ChatDemo.tsx +14 -0
  190. package/src/demo/CopilotDemo.tsx +43 -0
  191. package/src/demo/style.module.less +19 -0
  192. package/src/hooks/index.ts +3 -0
  193. package/src/hooks/useComposing.ts +31 -0
  194. package/src/hooks/useExportByEcharts.ts +41 -0
  195. package/src/hooks/useMethodRegister.ts +25 -0
  196. package/src/index.tsx +44 -0
  197. package/src/service/axiosInstance.ts +58 -0
  198. package/src/service/index.ts +174 -0
  199. package/src/setupProxy.js +18 -0
  200. package/src/setupTests.ts +5 -0
  201. package/src/styles/global.less +52 -0
  202. package/src/styles/index.less +39 -0
  203. package/src/styles/reboot.less +14 -0
  204. package/src/styles/variables.less +80 -0
  205. package/src/typings.d.ts +179 -0
  206. package/src/utils/utils.ts +346 -0
  207. package/tsconfig.build.json +20 -0
  208. package/tsconfig.json +27 -0
@@ -0,0 +1,311 @@
1
+ .message {
2
+ .messageTitleBar {
3
+ display: flex;
4
+ align-items: baseline;
5
+ margin-bottom: 6px;
6
+ column-gap: 10px;
7
+
8
+ .modelName {
9
+ margin-left: 4px;
10
+ color: var(--text-color);
11
+ font-weight: 500;
12
+ }
13
+
14
+ .messageTopBar {
15
+ position: relative;
16
+ max-width: 80%;
17
+ overflow: hidden;
18
+ color: var(--text-color-third);
19
+ font-size: 13px;
20
+ white-space: nowrap;
21
+ text-overflow: ellipsis;
22
+ }
23
+ }
24
+ .messageContent {
25
+ display: flex;
26
+ align-items: flex-start;
27
+
28
+ .messageBody {
29
+ width: 100%;
30
+ }
31
+
32
+ .avatar {
33
+ margin-right: 4px;
34
+ }
35
+
36
+ .bubble {
37
+ box-sizing: border-box;
38
+ min-width: 1px;
39
+ max-width: 100%;
40
+ padding: 8px 16px 10px;
41
+ background: rgba(255, 255, 255, 0.8);
42
+ border: 1px solid transparent;
43
+ border-radius: 12px;
44
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.14), 0 0 2px rgba(0, 0, 0, 0.12);
45
+
46
+ .text {
47
+ line-height: 1.5;
48
+ white-space: pre-wrap;
49
+ overflow-wrap: break-word;
50
+ user-select: text;
51
+ }
52
+
53
+ .textMsg {
54
+ padding: 12px 0 5px;
55
+ }
56
+
57
+ .topBar {
58
+ display: flex;
59
+ align-items: center;
60
+ max-width: 100%;
61
+ padding: 4px 0 8px;
62
+ overflow-x: auto;
63
+ color: var(--text-color);
64
+ font-weight: 500;
65
+ font-size: 14px;
66
+ white-space: nowrap;
67
+ border-bottom: 1px solid rgba(0, 0, 0, 0.03);
68
+
69
+ .messageTitleWrapper {
70
+ display: flex;
71
+ align-items: center;
72
+ }
73
+
74
+ .messageTitle {
75
+ display: flex;
76
+ align-items: center;
77
+ color: var(--text-color);
78
+ font-weight: 500;
79
+ font-size: 14px;
80
+ white-space: nowrap;
81
+ }
82
+ }
83
+ }
84
+ }
85
+
86
+ &.right {
87
+ .messageContent {
88
+ flex-direction: row-reverse;
89
+
90
+ .bubble {
91
+ float: right;
92
+ box-sizing: border-box;
93
+ padding: 8px 16px;
94
+ color: #fff;
95
+ font-size: 14px;
96
+ background: linear-gradient(81.62deg, #2870ea 8.72%, var(--chat-blue) 85.01%);
97
+ border: 1px solid transparent;
98
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.14), 0 0 2px rgba(0, 0, 0, 0.12);
99
+
100
+ .text {
101
+ &::selection {
102
+ background: #1ba1f7;
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+ .textBubble {
111
+ width: fit-content;
112
+ }
113
+
114
+ .listenerSex {
115
+ padding-bottom: 24px;
116
+ }
117
+
118
+ .listenerArea {
119
+ padding-top: 24px;
120
+ padding-bottom: 12px;
121
+ }
122
+
123
+ .typing {
124
+ width: 100%;
125
+ padding: 0 5px;
126
+
127
+ :global {
128
+ .ant-spin-dot {
129
+ width: 100%;
130
+ }
131
+ }
132
+ }
133
+
134
+ .messageEntityName {
135
+ cursor: pointer;
136
+
137
+ &:hover {
138
+ color: var(--primary-color);
139
+ }
140
+ }
141
+
142
+ .messageAvatar {
143
+ margin-right: 8px;
144
+ }
145
+
146
+ .dataHolder {
147
+ position: relative;
148
+ }
149
+
150
+ .subTitle {
151
+ margin-left: 20px;
152
+ color: var(--text-color-third);
153
+ font-weight: normal;
154
+ font-size: 12px;
155
+
156
+ .subTitleValue {
157
+ margin-left: 6px;
158
+ color: var(--text-color);
159
+ font-size: 13px;
160
+ }
161
+ }
162
+
163
+ .avatarPopover {
164
+ :global {
165
+ .ant-popover-inner-content {
166
+ padding: 3px 4px !important;
167
+ }
168
+ }
169
+ }
170
+
171
+ .moreOption {
172
+ display: flex;
173
+ align-items: center;
174
+ margin-top: 10px;
175
+ color: var(--text-color-fourth);
176
+ font-size: 12px;
177
+
178
+ .selectOthers {
179
+ color: var(--text-color);
180
+ cursor: pointer;
181
+ &:hover {
182
+ color: var(--primary-color);
183
+ }
184
+ }
185
+
186
+ .indicators {
187
+ display: flex;
188
+ align-items: center;
189
+ margin-left: 12px;
190
+ column-gap: 12px;
191
+
192
+ .indicator {
193
+ cursor: pointer;
194
+ &:hover {
195
+ color: var(--primary-color);
196
+ }
197
+ }
198
+ }
199
+ }
200
+
201
+ .contentName {
202
+ max-width: 350px;
203
+ white-space: nowrap;
204
+ text-overflow: ellipsis;
205
+ }
206
+
207
+ .aggregatorIndicator {
208
+ color: var(--text-color);
209
+ font-weight: 500;
210
+ font-size: 20px;
211
+ }
212
+
213
+ .entityId {
214
+ display: flex;
215
+ align-items: center;
216
+ margin-left: 12px;
217
+ column-gap: 4px;
218
+
219
+ .idTitle {
220
+ color: var(--text-color-fourth);
221
+ font-size: 12px;
222
+ }
223
+ .idValue {
224
+ color: var(--text-color-fourth);
225
+ font-size: 13px;
226
+ cursor: pointer;
227
+
228
+ &:hover {
229
+ color: var(--primary-color);
230
+ }
231
+ }
232
+ }
233
+
234
+ .typingBubble {
235
+ width: fit-content;
236
+ }
237
+
238
+ .quote {
239
+ margin-bottom: 4px;
240
+ padding: 0 4px 0 6px;
241
+ color: var(--border-color-base);
242
+ font-size: 13px;
243
+ border-left: 4px solid var(--border-color-base);
244
+ border-top-left-radius: 2px;
245
+ border-bottom-left-radius: 2px;
246
+ }
247
+
248
+ .filterSection {
249
+ display: flex;
250
+ align-items: center;
251
+ color: var(--text-color-secondary);
252
+ font-weight: normal;
253
+ font-size: 13px;
254
+ .filterItem {
255
+ padding: 2px 12px;
256
+ color: var(--text-color-secondary);
257
+ background-color: #edf2f2;
258
+ border-radius: 13px;
259
+ }
260
+ }
261
+
262
+ .noPermissionTip {
263
+ display: flex;
264
+ align-items: center;
265
+ }
266
+
267
+ .tip {
268
+ margin-left: 6px;
269
+ color: var(--text-color-third);
270
+ }
271
+
272
+ .infoBar {
273
+ display: flex;
274
+ flex-wrap: wrap;
275
+ align-items: center;
276
+ margin-top: 20px;
277
+ column-gap: 20px;
278
+ }
279
+
280
+ .mainEntityInfo {
281
+ display: flex;
282
+ flex-wrap: wrap;
283
+ align-items: center;
284
+ font-size: 13px;
285
+ column-gap: 20px;
286
+
287
+ .infoItem {
288
+ display: flex;
289
+ align-items: center;
290
+ .infoName {
291
+ color: var(--text-color-fourth);
292
+ }
293
+
294
+ .infoValue {
295
+ color: var(--text-color-secondary);
296
+ }
297
+ }
298
+ }
299
+
300
+ .textWrapper {
301
+ display: flex;
302
+ align-items: center;
303
+
304
+ &.rightTextWrapper {
305
+ justify-content: flex-end;
306
+ }
307
+
308
+ .rightAvatar {
309
+ margin-left: 6px;
310
+ }
311
+ }
@@ -0,0 +1,37 @@
1
+ export enum SemanticTypeEnum {
2
+ MODEL = 'MODEL',
3
+ DIMENSION = 'DIMENSION',
4
+ METRIC = 'METRIC',
5
+ VALUE = 'VALUE',
6
+ TERM = 'TERM',
7
+ }
8
+
9
+ export const SEMANTIC_TYPE_MAP = {
10
+ [SemanticTypeEnum.MODEL]: '数据模型',
11
+ [SemanticTypeEnum.DIMENSION]: '维度',
12
+ [SemanticTypeEnum.METRIC]: '指标',
13
+ [SemanticTypeEnum.VALUE]: '维度值',
14
+ [SemanticTypeEnum.TERM]: '术语',
15
+ };
16
+
17
+ export const AGENT_ICONS = [
18
+ 'icon-fukuanbaobiaochaxun',
19
+ 'icon-hangweifenxi1',
20
+ 'icon-xiaofeifenxi',
21
+ 'icon-renwuchaxun',
22
+ 'icon-baobiao',
23
+ 'icon-liushuichaxun',
24
+ 'icon-cangkuchaxun',
25
+ 'icon-xiaoshoushuju',
26
+ 'icon-tongji',
27
+ 'icon-shujutongji',
28
+ 'icon-mendiankanban',
29
+ ];
30
+
31
+ export const HOLDER_TAG = '@_supersonic_@';
32
+
33
+ export const DEFAULT_CONVERSATION_NAME = '新问答对话';
34
+
35
+ export const PLACE_HOLDER = '请输入您的问题,或输入“/”切换助理';
36
+
37
+ export const SIMPLE_PLACE_HOLDER = '请输入您的问题';