@foundbyte/uni-agent 1.0.0-alpha.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 (32) hide show
  1. package/components/bubble-list/index.scss +254 -0
  2. package/components/bubble-list/index.vue +505 -0
  3. package/components/bubble-list/types.ts +110 -0
  4. package/components/bubble-list/use-typewriter.ts +193 -0
  5. package/components/bubble-wrapper/index.scss +34 -0
  6. package/components/bubble-wrapper/index.vue +97 -0
  7. package/components/history/index.scss +87 -0
  8. package/components/history/index.vue +118 -0
  9. package/components/history/types.ts +16 -0
  10. package/components/index.ts +4 -0
  11. package/components/prompts/index.scss +30 -0
  12. package/components/prompts/index.vue +46 -0
  13. package/components/prompts/types.ts +11 -0
  14. package/components/sender/image-picker.ts +100 -0
  15. package/components/sender/index.scss +288 -0
  16. package/components/sender/index.vue +374 -0
  17. package/components/sender/types.ts +56 -0
  18. package/composables/index.ts +6 -0
  19. package/composables/use-inner-audio/audio-manager.ts +22 -0
  20. package/composables/use-inner-audio/enums.ts +15 -0
  21. package/composables/use-inner-audio/types.ts +8 -0
  22. package/composables/use-inner-audio/use-inner-audio.ts +149 -0
  23. package/composables/use-prefix.ts +54 -0
  24. package/composables/use-recorder/h5-recorder-manager.ts +492 -0
  25. package/composables/use-recorder/native-recorder-manager.ts +181 -0
  26. package/composables/use-recorder/recorder-manager.ts +40 -0
  27. package/composables/use-recorder/types.ts +73 -0
  28. package/composables/use-recorder/use-recorder.ts +205 -0
  29. package/configs/index.ts +5 -0
  30. package/index.ts +3 -0
  31. package/package.json +90 -0
  32. package/styles/_base.scss +8 -0
@@ -0,0 +1,254 @@
1
+ // BubbleList 组件样式
2
+ // 兼容小程序的 uni-app 组件样式
3
+
4
+ @use '../../styles/base' as base;
5
+
6
+ .#{base.$prefix}-bubble {
7
+ // 列表内容
8
+ &__list-content {
9
+ padding: 24rpx;
10
+ font-size: base.$font-size-base;
11
+ }
12
+
13
+ // 列表底部锚点(用于滚动定位)
14
+ &__list-bottom-anchor {
15
+ width: 100%;
16
+ height: 1px;
17
+ }
18
+
19
+ // 消息项
20
+ &__item {
21
+ display: flex;
22
+ align-items: flex-start;
23
+
24
+ & + & {
25
+ margin-top: 40rpx;
26
+ }
27
+
28
+ &--start {
29
+ flex-direction: row;
30
+ }
31
+
32
+ // &--end {
33
+ // flex-direction: row-reverse;
34
+ // }
35
+
36
+ &--last {
37
+ margin-bottom: 0;
38
+ }
39
+ }
40
+
41
+ // 头像
42
+ &__avatar {
43
+ flex-shrink: 0;
44
+ width: 72rpx;
45
+ height: 72rpx;
46
+ border-radius: 50%;
47
+ overflow: hidden;
48
+ background-color: #f0f0f0;
49
+
50
+ &--left {
51
+ margin-right: 16rpx;
52
+ }
53
+
54
+ &--right {
55
+ margin-left: 16rpx;
56
+ }
57
+ }
58
+
59
+ // 头像图片
60
+ &__avatar-image {
61
+ width: 100%;
62
+ height: 100%;
63
+ border-radius: 50%;
64
+ }
65
+
66
+ // 头像默认图标
67
+ &__avatar-default {
68
+ width: 100%;
69
+ height: 100%;
70
+ display: flex;
71
+ align-items: center;
72
+ justify-content: center;
73
+ border-radius: 50%;
74
+
75
+ &--ai {
76
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
77
+ }
78
+
79
+ &--user {
80
+ background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
81
+ }
82
+ }
83
+
84
+ // 头像图标
85
+ &__avatar-icon {
86
+ font-size: 36rpx;
87
+ }
88
+
89
+ // 内容区域
90
+ &__content {
91
+ flex: 1;
92
+ display: flex;
93
+ flex-direction: column;
94
+ // max-width: calc(100% - 120rpx);
95
+
96
+ &--start {
97
+ align-items: flex-start;
98
+ }
99
+
100
+ &--end {
101
+ align-items: flex-end;
102
+ }
103
+ }
104
+
105
+ // 角色名称
106
+ &__role-name {
107
+ font-size: 24rpx;
108
+ color: #999;
109
+ margin-bottom: 8rpx;
110
+ }
111
+
112
+ // 消息气泡
113
+ &__message {
114
+ position: relative;
115
+ max-width: 100%;
116
+ word-break: break-word;
117
+ line-height: calc(48 / 32);
118
+ font-weight: 400;
119
+
120
+ &--end {
121
+ display: flex;
122
+ justify-content: flex-end;
123
+ }
124
+
125
+ &--center {
126
+ display: flex;
127
+ justify-content: center;
128
+ }
129
+
130
+ &--loading {
131
+ min-width: 120rpx;
132
+ min-height: 60rpx;
133
+ // display: flex;
134
+ // align-items: center;
135
+ // justify-content: center;
136
+ }
137
+ }
138
+
139
+ // 加载动画
140
+ &__loading {
141
+ display: flex;
142
+ align-items: center;
143
+ min-height: 60rpx;
144
+ gap: 12rpx;
145
+ }
146
+
147
+ // 加载动画点
148
+ &__loading-dot {
149
+ width: 12rpx;
150
+ height: 12rpx;
151
+ border-radius: 50%;
152
+ background-color: #999;
153
+ animation: #{base.$prefix}-bubble-loading 1.4s infinite ease-in-out both;
154
+
155
+ &:nth-child(1) {
156
+ animation-delay: -0.32s;
157
+ }
158
+
159
+ &:nth-child(2) {
160
+ animation-delay: -0.16s;
161
+ }
162
+ }
163
+
164
+ @keyframes #{base.$prefix}-bubble-loading {
165
+ 0%,
166
+ 80%,
167
+ 100% {
168
+ transform: scale(0.6);
169
+ opacity: 0.5;
170
+ }
171
+ 40% {
172
+ transform: scale(1);
173
+ opacity: 1;
174
+ }
175
+ }
176
+
177
+ // 消息底部区域
178
+ &__message-footer {
179
+ display: flex;
180
+ align-items: center;
181
+ margin-top: 8rpx;
182
+ gap: 12rpx;
183
+ }
184
+
185
+ // 工具图标
186
+ &__tool-icon {
187
+ width: 48rpx;
188
+ height: 48rpx;
189
+ }
190
+
191
+ // 时间戳
192
+ &__time {
193
+ font-size: 22rpx;
194
+ color: #bbb;
195
+ }
196
+
197
+ // ========== 动画相关样式(使用 transition)==========
198
+
199
+ // 动画变量(作为默认值,可被内联样式覆盖)
200
+ --animation-duration: 300ms;
201
+ --animation-delay: 0ms;
202
+
203
+ // 淡入过渡
204
+ &__animate--fade {
205
+ opacity: 1;
206
+ transition: opacity var(--animation-duration) ease-out var(--animation-delay);
207
+ }
208
+
209
+ // 从左滑入过渡
210
+ &__animate--slide-left {
211
+ opacity: 1;
212
+ transform: translateX(0);
213
+ transition: opacity var(--animation-duration) ease-out var(--animation-delay),
214
+ transform var(--animation-duration) ease-out var(--animation-delay);
215
+ }
216
+
217
+ // 从右滑入过渡
218
+ &__animate--slide-right {
219
+ opacity: 1;
220
+ transform: translateX(0);
221
+ transition: opacity var(--animation-duration) ease-out var(--animation-delay),
222
+ transform var(--animation-duration) ease-out var(--animation-delay);
223
+ }
224
+
225
+ // 缩放进入过渡
226
+ &__animate--scale {
227
+ opacity: 1;
228
+ transform: scale(1);
229
+ transition: opacity var(--animation-duration) ease-out var(--animation-delay),
230
+ transform var(--animation-duration) ease-out var(--animation-delay);
231
+ }
232
+
233
+ // 弹跳进入过渡(transition 无法实现多关键帧弹跳效果,用 scale 代替)
234
+ &__animate--bounce {
235
+ opacity: 1;
236
+ transform: scale(1);
237
+ transition: opacity calc(var(--animation-duration) * 0.5) ease-out var(--animation-delay),
238
+ transform var(--animation-duration) cubic-bezier(0.68, -0.55, 0.265, 1.55) var(--animation-delay);
239
+ }
240
+ }
241
+
242
+ // 加载动画关键帧保留
243
+ @keyframes #{base.$prefix}-bubble-loading {
244
+ 0%,
245
+ 80%,
246
+ 100% {
247
+ transform: scale(0.6);
248
+ opacity: 0.5;
249
+ }
250
+ 40% {
251
+ transform: scale(1);
252
+ opacity: 1;
253
+ }
254
+ }