@nocobase/portal-template-default 1.0.2 → 1.0.3
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/package.json +1 -1
- package/scripts/registry.mjs +2 -0
- package/src/extensions/nocobase-acl/README.md +19 -0
- package/src/extensions/nocobase-acl/components/acl-boundary.tsx +106 -0
- package/src/extensions/nocobase-acl/components/index.ts +3 -0
- package/src/extensions/nocobase-acl/components/role-options.ts +36 -0
- package/src/extensions/nocobase-acl/components/role-switcher.tsx +135 -0
- package/src/extensions/nocobase-acl/demo/boundary-api.tsx +186 -0
- package/src/extensions/nocobase-acl/demo/components.tsx +231 -0
- package/src/extensions/nocobase-acl/demo/index.tsx +505 -0
- package/src/extensions/nocobase-acl/demo/lazy-route.tsx +10 -0
- package/src/extensions/nocobase-acl/demo/prompt-generator.tsx +134 -0
- package/src/extensions/nocobase-acl/demo/role-switcher-prompt-generator.tsx +198 -0
- package/src/extensions/nocobase-acl/demo/scenario-section.tsx +37 -0
- package/src/extensions/nocobase-acl/extension.tsx +71 -0
- package/src/extensions/nocobase-acl/index.ts +1 -0
- package/src/extensions/nocobase-ai/README.md +70 -0
- package/src/extensions/nocobase-ai/adapters/react-hook-form.ts +20 -0
- package/src/extensions/nocobase-ai/assets/nocobase-ai-chat.svg +50 -0
- package/src/extensions/nocobase-ai/components/ai-root-provider.tsx +32 -0
- package/src/extensions/nocobase-ai/components/chat/ai-employee-avatar.tsx +31 -0
- package/src/extensions/nocobase-ai/components/chat/chat-attachment.tsx +92 -0
- package/src/extensions/nocobase-ai/components/chat/chat-compact.tsx +90 -0
- package/src/extensions/nocobase-ai/components/chat/chat-composer.tsx +429 -0
- package/src/extensions/nocobase-ai/components/chat/chat-empty-state.tsx +51 -0
- package/src/extensions/nocobase-ai/components/chat/chat-header.tsx +88 -0
- package/src/extensions/nocobase-ai/components/chat/chat-history-dialog.tsx +77 -0
- package/src/extensions/nocobase-ai/components/chat/chat-message.tsx +252 -0
- package/src/extensions/nocobase-ai/components/chat/chat-messages.tsx +173 -0
- package/src/extensions/nocobase-ai/components/chat/chat-window.tsx +118 -0
- package/src/extensions/nocobase-ai/components/chat/conversation-list.tsx +343 -0
- package/src/extensions/nocobase-ai/components/chat/markdown-message.tsx +165 -0
- package/src/extensions/nocobase-ai/components/chat/model-select-options.tsx +30 -0
- package/src/extensions/nocobase-ai/components/chat/reasoning-panel.tsx +29 -0
- package/src/extensions/nocobase-ai/components/chat/sub-agent-conversation.tsx +142 -0
- package/src/extensions/nocobase-ai/components/chat/tool-call-card.tsx +316 -0
- package/src/extensions/nocobase-ai/components/chat/user-prompt-editor.tsx +99 -0
- package/src/extensions/nocobase-ai/components/chat/work-context-chip.tsx +114 -0
- package/src/extensions/nocobase-ai/components/index.ts +59 -0
- package/src/extensions/nocobase-ai/components/page-elements/ai-form.tsx +44 -0
- package/src/extensions/nocobase-ai/components/page-elements/page-element-provider.tsx +469 -0
- package/src/extensions/nocobase-ai/components/surfaces/chat-dialog.tsx +31 -0
- package/src/extensions/nocobase-ai/components/surfaces/chat-inline.tsx +18 -0
- package/src/extensions/nocobase-ai/components/surfaces/chat-page.tsx +18 -0
- package/src/extensions/nocobase-ai/components/surfaces/chat-side-panel-layout.tsx +54 -0
- package/src/extensions/nocobase-ai/components/surfaces/chat-side-panel.tsx +74 -0
- package/src/extensions/nocobase-ai/components/surfaces/chat-surface-actions.tsx +54 -0
- package/src/extensions/nocobase-ai/components/tools/builtin-tool-renderers.tsx +31 -0
- package/src/extensions/nocobase-ai/components/tools/business-report-dialog.tsx +364 -0
- package/src/extensions/nocobase-ai/components/tools/business-report-renderer.tsx +122 -0
- package/src/extensions/nocobase-ai/components/tools/business-report-utils.tsx +282 -0
- package/src/extensions/nocobase-ai/components/tools/chart-renderer.tsx +99 -0
- package/src/extensions/nocobase-ai/components/tools/echarts-preview.tsx +59 -0
- package/src/extensions/nocobase-ai/components/tools/echarts-runtime-advanced.ts +18 -0
- package/src/extensions/nocobase-ai/components/tools/echarts-runtime-common.ts +20 -0
- package/src/extensions/nocobase-ai/components/tools/echarts-runtime-components.ts +34 -0
- package/src/extensions/nocobase-ai/components/tools/echarts-runtime-hierarchy.ts +24 -0
- package/src/extensions/nocobase-ai/components/tools/echarts-runtime.ts +138 -0
- package/src/extensions/nocobase-ai/components/tools/sub-agent-renderer.tsx +67 -0
- package/src/extensions/nocobase-ai/components/tools/suggestions-renderer.tsx +59 -0
- package/src/extensions/nocobase-ai/components/tools/tool-renderer-provider.tsx +55 -0
- package/src/extensions/nocobase-ai/components/tools/tool-renderer-utils.ts +18 -0
- package/src/extensions/nocobase-ai/components/tools/workflow-renderer.tsx +108 -0
- package/src/extensions/nocobase-ai/components/triggers/ai-chat-floating-trigger.tsx +73 -0
- package/src/extensions/nocobase-ai/components/triggers/ai-employee-shortcut.tsx +149 -0
- package/src/extensions/nocobase-ai/demo/configuration-gate.tsx +49 -0
- package/src/extensions/nocobase-ai/demo/container-showcase.tsx +210 -0
- package/src/extensions/nocobase-ai/demo/floating.tsx +134 -0
- package/src/extensions/nocobase-ai/demo/index.tsx +346 -0
- package/src/extensions/nocobase-ai/demo/interaction-showcase.tsx +151 -0
- package/src/extensions/nocobase-ai/demo/page-context-prompt-generator.tsx +355 -0
- package/src/extensions/nocobase-ai/demo/page-context.tsx +884 -0
- package/src/extensions/nocobase-ai/demo/page-element-showcase.tsx +197 -0
- package/src/extensions/nocobase-ai/demo/prompt-card.tsx +41 -0
- package/src/extensions/nocobase-ai/demo/prompt-generator.tsx +452 -0
- package/src/extensions/nocobase-ai/demo/shortcut.tsx +1207 -0
- package/src/extensions/nocobase-ai/demo/tool-cards.tsx +530 -0
- package/src/extensions/nocobase-ai/extension.tsx +158 -0
- package/src/extensions/nocobase-ai/global-ai-chat.tsx +213 -0
- package/src/extensions/nocobase-ai/index.ts +3 -0
- package/src/extensions/nocobase-ai/providers/ai-provider.tsx +323 -0
- package/src/extensions/nocobase-ai/providers/avatars.ts +817 -0
- package/src/extensions/nocobase-ai/providers/chat-context.tsx +109 -0
- package/src/extensions/nocobase-ai/providers/chat-controller.ts +84 -0
- package/src/extensions/nocobase-ai/providers/chat-message-utils.ts +198 -0
- package/src/extensions/nocobase-ai/providers/chat-provider.tsx +871 -0
- package/src/extensions/nocobase-ai/providers/chat-reducer.ts +147 -0
- package/src/extensions/nocobase-ai/providers/chat-task-utils.ts +105 -0
- package/src/extensions/nocobase-ai/providers/chat-transport.ts +184 -0
- package/src/extensions/nocobase-ai/providers/form-registry.tsx +271 -0
- package/src/extensions/nocobase-ai/providers/frontend-tool-registry.tsx +231 -0
- package/src/extensions/nocobase-ai/providers/index.ts +61 -0
- package/src/extensions/nocobase-ai/providers/model.ts +32 -0
- package/src/extensions/nocobase-ai/providers/page-context.tsx +136 -0
- package/src/extensions/nocobase-ai/providers/stream-coalescer.ts +60 -0
- package/src/extensions/nocobase-ai/providers/stream-event-utils.ts +82 -0
- package/src/extensions/nocobase-ai/providers/stream-parser.ts +61 -0
- package/src/extensions/nocobase-ai/providers/sub-agent-stream.ts +316 -0
- package/src/extensions/nocobase-ai/providers/types.ts +183 -0
- package/src/extensions/nocobase-ai/providers/ui-message-stream.ts +463 -0
- package/src/extensions/nocobase-ai/providers/use-automatic-tool-approval.ts +94 -0
- package/src/extensions/nocobase-ai/providers/use-chat-attachments.ts +206 -0
- package/src/extensions/nocobase-ai/providers/use-chat-message-actions.ts +554 -0
- package/src/extensions/nocobase-ai/providers/use-chat-runtime.ts +210 -0
- package/src/extensions/nocobase-ai/providers/use-chat-work-context.ts +93 -0
- package/src/extensions/nocobase-ai/providers/use-conversation-catalog.ts +108 -0
- package/src/extensions/nocobase-ai/providers/use-conversation-history.ts +178 -0
- package/src/extensions/nocobase-ai/services/index.ts +7 -0
- package/src/extensions/nocobase-ai/services/nocobase-ai-service.ts +454 -0
- package/src/extensions/nocobase-ai/services/types.ts +82 -0
|
@@ -0,0 +1,817 @@
|
|
|
1
|
+
import { createAvatar } from "@dicebear/core";
|
|
2
|
+
import * as nocobaseAvatars from "@nocobase/ai-employee-avatars";
|
|
3
|
+
|
|
4
|
+
const avatarOptions: Record<string, Record<string, unknown>> = {
|
|
5
|
+
"nocobase-001-male": {
|
|
6
|
+
seed: "nocobase-001-male",
|
|
7
|
+
gender: "male",
|
|
8
|
+
base: ["purple"],
|
|
9
|
+
hair: ["man002"],
|
|
10
|
+
mouth: ["unisex001"],
|
|
11
|
+
clothes: ["unisex004"],
|
|
12
|
+
earing: undefined,
|
|
13
|
+
earingProbability: 0,
|
|
14
|
+
glasses: undefined,
|
|
15
|
+
glassesProbability: 0,
|
|
16
|
+
mask: undefined,
|
|
17
|
+
},
|
|
18
|
+
"nocobase-002-male": {
|
|
19
|
+
seed: "nocobase-002-male",
|
|
20
|
+
gender: "male",
|
|
21
|
+
base: ["purple"],
|
|
22
|
+
hair: ["man001"],
|
|
23
|
+
mouth: ["unisex001"],
|
|
24
|
+
clothes: ["unisex016"],
|
|
25
|
+
earing: ["unisex002"],
|
|
26
|
+
earingProbability: 100,
|
|
27
|
+
glasses: ["unisex002"],
|
|
28
|
+
glassesProbability: 100,
|
|
29
|
+
mask: undefined,
|
|
30
|
+
},
|
|
31
|
+
"nocobase-003-female": {
|
|
32
|
+
seed: "nocobase-003-female",
|
|
33
|
+
gender: "female",
|
|
34
|
+
base: ["purple"],
|
|
35
|
+
hair: ["woman012"],
|
|
36
|
+
mouth: ["unisex001"],
|
|
37
|
+
clothes: ["unisex002"],
|
|
38
|
+
earing: undefined,
|
|
39
|
+
earingProbability: 0,
|
|
40
|
+
glasses: ["unisex002"],
|
|
41
|
+
glassesProbability: 100,
|
|
42
|
+
mask: undefined,
|
|
43
|
+
},
|
|
44
|
+
"nocobase-004-male": {
|
|
45
|
+
seed: "nocobase-004-male",
|
|
46
|
+
gender: "male",
|
|
47
|
+
base: ["purple"],
|
|
48
|
+
hair: ["man004"],
|
|
49
|
+
mouth: ["unisex001"],
|
|
50
|
+
clothes: ["unisex015"],
|
|
51
|
+
earing: undefined,
|
|
52
|
+
earingProbability: 0,
|
|
53
|
+
glasses: ["unisex002"],
|
|
54
|
+
glassesProbability: 100,
|
|
55
|
+
mask: undefined,
|
|
56
|
+
},
|
|
57
|
+
"nocobase-005-female": {
|
|
58
|
+
seed: "nocobase-005-female",
|
|
59
|
+
gender: "female",
|
|
60
|
+
base: ["purple"],
|
|
61
|
+
hair: ["woman008"],
|
|
62
|
+
mouth: ["unisex001"],
|
|
63
|
+
clothes: ["unisex007"],
|
|
64
|
+
earing: ["woman004"],
|
|
65
|
+
earingProbability: 100,
|
|
66
|
+
glasses: undefined,
|
|
67
|
+
glassesProbability: 0,
|
|
68
|
+
mask: undefined,
|
|
69
|
+
},
|
|
70
|
+
"nocobase-006-male": {
|
|
71
|
+
seed: "nocobase-006-male",
|
|
72
|
+
gender: "male",
|
|
73
|
+
base: ["purple"],
|
|
74
|
+
hair: ["man007"],
|
|
75
|
+
mouth: ["unisex001"],
|
|
76
|
+
clothes: ["unisex004"],
|
|
77
|
+
earing: undefined,
|
|
78
|
+
earingProbability: 0,
|
|
79
|
+
glasses: undefined,
|
|
80
|
+
glassesProbability: 0,
|
|
81
|
+
mask: undefined,
|
|
82
|
+
},
|
|
83
|
+
"nocobase-007-male": {
|
|
84
|
+
seed: "nocobase-007-male",
|
|
85
|
+
gender: "male",
|
|
86
|
+
base: ["purple"],
|
|
87
|
+
hair: ["man003"],
|
|
88
|
+
mouth: ["unisex001"],
|
|
89
|
+
clothes: ["unisex006"],
|
|
90
|
+
earing: ["unisex002"],
|
|
91
|
+
earingProbability: 100,
|
|
92
|
+
glasses: undefined,
|
|
93
|
+
glassesProbability: 0,
|
|
94
|
+
mask: undefined,
|
|
95
|
+
},
|
|
96
|
+
"nocobase-008-female": {
|
|
97
|
+
seed: "nocobase-008-female",
|
|
98
|
+
gender: "female",
|
|
99
|
+
base: ["purple"],
|
|
100
|
+
hair: ["woman004"],
|
|
101
|
+
mouth: ["unisex001"],
|
|
102
|
+
clothes: ["woman003"],
|
|
103
|
+
earing: undefined,
|
|
104
|
+
earingProbability: 0,
|
|
105
|
+
glasses: ["unisex001"],
|
|
106
|
+
glassesProbability: 100,
|
|
107
|
+
mask: undefined,
|
|
108
|
+
},
|
|
109
|
+
"nocobase-009-female": {
|
|
110
|
+
seed: "nocobase-009-female",
|
|
111
|
+
gender: "female",
|
|
112
|
+
base: ["purple"],
|
|
113
|
+
hair: ["woman004"],
|
|
114
|
+
mouth: ["unisex001"],
|
|
115
|
+
clothes: ["woman002"],
|
|
116
|
+
earing: undefined,
|
|
117
|
+
earingProbability: 0,
|
|
118
|
+
glasses: ["unisex002"],
|
|
119
|
+
glassesProbability: 100,
|
|
120
|
+
mask: undefined,
|
|
121
|
+
},
|
|
122
|
+
"nocobase-010-male": {
|
|
123
|
+
seed: "nocobase-010-male",
|
|
124
|
+
gender: "male",
|
|
125
|
+
base: ["purple"],
|
|
126
|
+
hair: ["man006"],
|
|
127
|
+
mouth: ["unisex001"],
|
|
128
|
+
clothes: ["unisex004"],
|
|
129
|
+
earing: ["unisex002"],
|
|
130
|
+
earingProbability: 100,
|
|
131
|
+
glasses: ["unisex002"],
|
|
132
|
+
glassesProbability: 100,
|
|
133
|
+
mask: undefined,
|
|
134
|
+
},
|
|
135
|
+
"nocobase-011-male": {
|
|
136
|
+
seed: "nocobase-011-male",
|
|
137
|
+
gender: "male",
|
|
138
|
+
base: ["green"],
|
|
139
|
+
hair: ["man006"],
|
|
140
|
+
mouth: ["unisex001"],
|
|
141
|
+
clothes: ["unisex016"],
|
|
142
|
+
earing: ["unisex002"],
|
|
143
|
+
earingProbability: 100,
|
|
144
|
+
glasses: ["unisex001"],
|
|
145
|
+
glassesProbability: 100,
|
|
146
|
+
mask: undefined,
|
|
147
|
+
},
|
|
148
|
+
"nocobase-012-male": {
|
|
149
|
+
seed: "nocobase-012-male",
|
|
150
|
+
gender: "male",
|
|
151
|
+
base: ["green"],
|
|
152
|
+
hair: ["man007"],
|
|
153
|
+
mouth: ["unisex001"],
|
|
154
|
+
clothes: ["unisex004"],
|
|
155
|
+
earing: ["unisex001"],
|
|
156
|
+
earingProbability: 100,
|
|
157
|
+
glasses: ["unisex001"],
|
|
158
|
+
glassesProbability: 100,
|
|
159
|
+
mask: undefined,
|
|
160
|
+
},
|
|
161
|
+
"nocobase-013-female": {
|
|
162
|
+
seed: "nocobase-013-female",
|
|
163
|
+
gender: "female",
|
|
164
|
+
base: ["green"],
|
|
165
|
+
hair: ["woman012"],
|
|
166
|
+
mouth: ["unisex001"],
|
|
167
|
+
clothes: ["unisex010"],
|
|
168
|
+
earing: undefined,
|
|
169
|
+
earingProbability: 0,
|
|
170
|
+
glasses: ["unisex002"],
|
|
171
|
+
glassesProbability: 100,
|
|
172
|
+
mask: undefined,
|
|
173
|
+
},
|
|
174
|
+
"nocobase-014-female": {
|
|
175
|
+
seed: "nocobase-014-female",
|
|
176
|
+
gender: "female",
|
|
177
|
+
base: ["green"],
|
|
178
|
+
hair: ["woman002"],
|
|
179
|
+
mouth: ["unisex001"],
|
|
180
|
+
clothes: ["unisex014"],
|
|
181
|
+
earing: undefined,
|
|
182
|
+
earingProbability: 0,
|
|
183
|
+
glasses: undefined,
|
|
184
|
+
glassesProbability: 0,
|
|
185
|
+
mask: undefined,
|
|
186
|
+
},
|
|
187
|
+
"nocobase-015-male": {
|
|
188
|
+
seed: "nocobase-015-male",
|
|
189
|
+
gender: "male",
|
|
190
|
+
base: ["green"],
|
|
191
|
+
hair: ["man002"],
|
|
192
|
+
mouth: ["unisex001"],
|
|
193
|
+
clothes: ["unisex013"],
|
|
194
|
+
earing: undefined,
|
|
195
|
+
earingProbability: 0,
|
|
196
|
+
glasses: ["unisex001"],
|
|
197
|
+
glassesProbability: 100,
|
|
198
|
+
mask: undefined,
|
|
199
|
+
},
|
|
200
|
+
"nocobase-016-female": {
|
|
201
|
+
seed: "nocobase-016-female",
|
|
202
|
+
gender: "female",
|
|
203
|
+
base: ["green"],
|
|
204
|
+
hair: ["woman009"],
|
|
205
|
+
mouth: ["unisex001"],
|
|
206
|
+
clothes: ["unisex003"],
|
|
207
|
+
earing: undefined,
|
|
208
|
+
earingProbability: 0,
|
|
209
|
+
glasses: undefined,
|
|
210
|
+
glassesProbability: 0,
|
|
211
|
+
mask: undefined,
|
|
212
|
+
},
|
|
213
|
+
"nocobase-017-female": {
|
|
214
|
+
seed: "nocobase-017-female",
|
|
215
|
+
gender: "female",
|
|
216
|
+
base: ["green"],
|
|
217
|
+
hair: ["woman010"],
|
|
218
|
+
mouth: ["unisex001"],
|
|
219
|
+
clothes: ["woman003"],
|
|
220
|
+
earing: ["woman001"],
|
|
221
|
+
earingProbability: 100,
|
|
222
|
+
glasses: ["unisex001"],
|
|
223
|
+
glassesProbability: 100,
|
|
224
|
+
mask: undefined,
|
|
225
|
+
},
|
|
226
|
+
"nocobase-018-female": {
|
|
227
|
+
seed: "nocobase-018-female",
|
|
228
|
+
gender: "female",
|
|
229
|
+
base: ["green"],
|
|
230
|
+
hair: ["woman006"],
|
|
231
|
+
mouth: ["unisex001"],
|
|
232
|
+
clothes: ["unisex014"],
|
|
233
|
+
earing: undefined,
|
|
234
|
+
earingProbability: 0,
|
|
235
|
+
glasses: ["unisex002"],
|
|
236
|
+
glassesProbability: 100,
|
|
237
|
+
mask: undefined,
|
|
238
|
+
},
|
|
239
|
+
"nocobase-019-female": {
|
|
240
|
+
seed: "nocobase-019-female",
|
|
241
|
+
gender: "female",
|
|
242
|
+
base: ["green"],
|
|
243
|
+
hair: ["woman005"],
|
|
244
|
+
mouth: ["unisex001"],
|
|
245
|
+
clothes: ["unisex001"],
|
|
246
|
+
earing: undefined,
|
|
247
|
+
earingProbability: 0,
|
|
248
|
+
glasses: ["unisex002"],
|
|
249
|
+
glassesProbability: 100,
|
|
250
|
+
mask: undefined,
|
|
251
|
+
},
|
|
252
|
+
"nocobase-020-female": {
|
|
253
|
+
seed: "nocobase-020-female",
|
|
254
|
+
gender: "female",
|
|
255
|
+
base: ["green"],
|
|
256
|
+
hair: ["woman011"],
|
|
257
|
+
mouth: ["unisex001"],
|
|
258
|
+
clothes: ["unisex006"],
|
|
259
|
+
earing: undefined,
|
|
260
|
+
earingProbability: 0,
|
|
261
|
+
glasses: undefined,
|
|
262
|
+
glassesProbability: 0,
|
|
263
|
+
mask: undefined,
|
|
264
|
+
},
|
|
265
|
+
"nocobase-021-male": {
|
|
266
|
+
seed: "nocobase-021-male",
|
|
267
|
+
gender: "male",
|
|
268
|
+
base: ["red"],
|
|
269
|
+
hair: ["man006"],
|
|
270
|
+
mouth: ["unisex001"],
|
|
271
|
+
clothes: ["unisex007"],
|
|
272
|
+
earing: ["unisex002"],
|
|
273
|
+
earingProbability: 100,
|
|
274
|
+
glasses: undefined,
|
|
275
|
+
glassesProbability: 0,
|
|
276
|
+
mask: undefined,
|
|
277
|
+
},
|
|
278
|
+
"nocobase-022-male": {
|
|
279
|
+
seed: "nocobase-022-male",
|
|
280
|
+
gender: "male",
|
|
281
|
+
base: ["red"],
|
|
282
|
+
hair: ["man005"],
|
|
283
|
+
mouth: ["unisex001"],
|
|
284
|
+
clothes: ["unisex006"],
|
|
285
|
+
earing: undefined,
|
|
286
|
+
earingProbability: 0,
|
|
287
|
+
glasses: ["unisex002"],
|
|
288
|
+
glassesProbability: 100,
|
|
289
|
+
mask: undefined,
|
|
290
|
+
},
|
|
291
|
+
"nocobase-023-female": {
|
|
292
|
+
seed: "nocobase-023-female",
|
|
293
|
+
gender: "female",
|
|
294
|
+
base: ["red"],
|
|
295
|
+
hair: ["woman006"],
|
|
296
|
+
mouth: ["unisex001"],
|
|
297
|
+
clothes: ["unisex006"],
|
|
298
|
+
earing: ["woman001"],
|
|
299
|
+
earingProbability: 100,
|
|
300
|
+
glasses: ["unisex002"],
|
|
301
|
+
glassesProbability: 100,
|
|
302
|
+
mask: undefined,
|
|
303
|
+
},
|
|
304
|
+
"nocobase-024-male": {
|
|
305
|
+
seed: "nocobase-024-male",
|
|
306
|
+
gender: "male",
|
|
307
|
+
base: ["red"],
|
|
308
|
+
hair: ["man001"],
|
|
309
|
+
mouth: ["unisex001"],
|
|
310
|
+
clothes: ["unisex002"],
|
|
311
|
+
earing: undefined,
|
|
312
|
+
earingProbability: 0,
|
|
313
|
+
glasses: ["unisex002"],
|
|
314
|
+
glassesProbability: 100,
|
|
315
|
+
mask: undefined,
|
|
316
|
+
},
|
|
317
|
+
"nocobase-025-male": {
|
|
318
|
+
seed: "nocobase-025-male",
|
|
319
|
+
gender: "male",
|
|
320
|
+
base: ["red"],
|
|
321
|
+
hair: ["man006"],
|
|
322
|
+
mouth: ["unisex001"],
|
|
323
|
+
clothes: ["unisex006"],
|
|
324
|
+
earing: undefined,
|
|
325
|
+
earingProbability: 0,
|
|
326
|
+
glasses: ["unisex002"],
|
|
327
|
+
glassesProbability: 100,
|
|
328
|
+
mask: undefined,
|
|
329
|
+
},
|
|
330
|
+
"nocobase-026-male": {
|
|
331
|
+
seed: "nocobase-026-male",
|
|
332
|
+
gender: "male",
|
|
333
|
+
base: ["red"],
|
|
334
|
+
hair: ["man002"],
|
|
335
|
+
mouth: ["unisex001"],
|
|
336
|
+
clothes: ["unisex016"],
|
|
337
|
+
earing: undefined,
|
|
338
|
+
earingProbability: 0,
|
|
339
|
+
glasses: undefined,
|
|
340
|
+
glassesProbability: 0,
|
|
341
|
+
mask: undefined,
|
|
342
|
+
},
|
|
343
|
+
"nocobase-027-female": {
|
|
344
|
+
seed: "nocobase-027-female",
|
|
345
|
+
gender: "female",
|
|
346
|
+
base: ["red"],
|
|
347
|
+
hair: ["woman003"],
|
|
348
|
+
mouth: ["unisex001"],
|
|
349
|
+
clothes: ["unisex009"],
|
|
350
|
+
earing: ["woman005"],
|
|
351
|
+
earingProbability: 100,
|
|
352
|
+
glasses: ["unisex001"],
|
|
353
|
+
glassesProbability: 100,
|
|
354
|
+
mask: undefined,
|
|
355
|
+
},
|
|
356
|
+
"nocobase-028-male": {
|
|
357
|
+
seed: "nocobase-028-male",
|
|
358
|
+
gender: "male",
|
|
359
|
+
base: ["red"],
|
|
360
|
+
hair: ["man003"],
|
|
361
|
+
mouth: ["unisex001"],
|
|
362
|
+
clothes: ["unisex012"],
|
|
363
|
+
earing: undefined,
|
|
364
|
+
earingProbability: 0,
|
|
365
|
+
glasses: undefined,
|
|
366
|
+
glassesProbability: 0,
|
|
367
|
+
mask: undefined,
|
|
368
|
+
},
|
|
369
|
+
"nocobase-029-male": {
|
|
370
|
+
seed: "nocobase-029-male",
|
|
371
|
+
gender: "male",
|
|
372
|
+
base: ["red"],
|
|
373
|
+
hair: ["man007"],
|
|
374
|
+
mouth: ["unisex001"],
|
|
375
|
+
clothes: ["unisex011"],
|
|
376
|
+
earing: ["unisex002"],
|
|
377
|
+
earingProbability: 100,
|
|
378
|
+
glasses: ["unisex001"],
|
|
379
|
+
glassesProbability: 100,
|
|
380
|
+
mask: undefined,
|
|
381
|
+
},
|
|
382
|
+
"nocobase-030-male": {
|
|
383
|
+
seed: "nocobase-030-male",
|
|
384
|
+
gender: "male",
|
|
385
|
+
base: ["red"],
|
|
386
|
+
hair: ["man005"],
|
|
387
|
+
mouth: ["unisex001"],
|
|
388
|
+
clothes: ["unisex015"],
|
|
389
|
+
earing: undefined,
|
|
390
|
+
earingProbability: 0,
|
|
391
|
+
glasses: ["unisex001"],
|
|
392
|
+
glassesProbability: 100,
|
|
393
|
+
mask: undefined,
|
|
394
|
+
},
|
|
395
|
+
"nocobase-031-female": {
|
|
396
|
+
seed: "nocobase-031-female",
|
|
397
|
+
gender: "female",
|
|
398
|
+
base: ["brown"],
|
|
399
|
+
hair: ["woman006"],
|
|
400
|
+
mouth: ["unisex001"],
|
|
401
|
+
clothes: ["woman003"],
|
|
402
|
+
earing: ["woman002"],
|
|
403
|
+
earingProbability: 100,
|
|
404
|
+
glasses: ["unisex002"],
|
|
405
|
+
glassesProbability: 100,
|
|
406
|
+
mask: undefined,
|
|
407
|
+
},
|
|
408
|
+
"nocobase-032-male": {
|
|
409
|
+
seed: "nocobase-032-male",
|
|
410
|
+
gender: "male",
|
|
411
|
+
base: ["brown"],
|
|
412
|
+
hair: ["man004"],
|
|
413
|
+
mouth: ["unisex001"],
|
|
414
|
+
clothes: ["unisex004"],
|
|
415
|
+
earing: undefined,
|
|
416
|
+
earingProbability: 0,
|
|
417
|
+
glasses: undefined,
|
|
418
|
+
glassesProbability: 0,
|
|
419
|
+
mask: undefined,
|
|
420
|
+
},
|
|
421
|
+
"nocobase-033-male": {
|
|
422
|
+
seed: "nocobase-033-male",
|
|
423
|
+
gender: "male",
|
|
424
|
+
base: ["brown"],
|
|
425
|
+
hair: ["man001"],
|
|
426
|
+
mouth: ["unisex001"],
|
|
427
|
+
clothes: ["unisex016"],
|
|
428
|
+
earing: ["unisex001"],
|
|
429
|
+
earingProbability: 100,
|
|
430
|
+
glasses: undefined,
|
|
431
|
+
glassesProbability: 0,
|
|
432
|
+
mask: undefined,
|
|
433
|
+
},
|
|
434
|
+
"nocobase-034-female": {
|
|
435
|
+
seed: "nocobase-034-female",
|
|
436
|
+
gender: "female",
|
|
437
|
+
base: ["brown"],
|
|
438
|
+
hair: ["woman011"],
|
|
439
|
+
mouth: ["unisex001"],
|
|
440
|
+
clothes: ["woman003"],
|
|
441
|
+
earing: undefined,
|
|
442
|
+
earingProbability: 0,
|
|
443
|
+
glasses: undefined,
|
|
444
|
+
glassesProbability: 0,
|
|
445
|
+
mask: undefined,
|
|
446
|
+
},
|
|
447
|
+
"nocobase-035-male": {
|
|
448
|
+
seed: "nocobase-035-male",
|
|
449
|
+
gender: "male",
|
|
450
|
+
base: ["brown"],
|
|
451
|
+
hair: ["man001"],
|
|
452
|
+
mouth: ["unisex001"],
|
|
453
|
+
clothes: ["unisex004"],
|
|
454
|
+
earing: undefined,
|
|
455
|
+
earingProbability: 0,
|
|
456
|
+
glasses: undefined,
|
|
457
|
+
glassesProbability: 0,
|
|
458
|
+
mask: undefined,
|
|
459
|
+
},
|
|
460
|
+
"nocobase-036-female": {
|
|
461
|
+
seed: "nocobase-036-female",
|
|
462
|
+
gender: "female",
|
|
463
|
+
base: ["brown"],
|
|
464
|
+
hair: ["woman012"],
|
|
465
|
+
mouth: ["unisex001"],
|
|
466
|
+
clothes: ["woman002"],
|
|
467
|
+
earing: undefined,
|
|
468
|
+
earingProbability: 0,
|
|
469
|
+
glasses: undefined,
|
|
470
|
+
glassesProbability: 0,
|
|
471
|
+
mask: undefined,
|
|
472
|
+
},
|
|
473
|
+
"nocobase-037-male": {
|
|
474
|
+
seed: "nocobase-037-male",
|
|
475
|
+
gender: "male",
|
|
476
|
+
base: ["brown"],
|
|
477
|
+
hair: ["man005"],
|
|
478
|
+
mouth: ["unisex001"],
|
|
479
|
+
clothes: ["unisex004"],
|
|
480
|
+
earing: undefined,
|
|
481
|
+
earingProbability: 0,
|
|
482
|
+
glasses: ["unisex001"],
|
|
483
|
+
glassesProbability: 100,
|
|
484
|
+
mask: undefined,
|
|
485
|
+
},
|
|
486
|
+
"nocobase-038-female": {
|
|
487
|
+
seed: "nocobase-038-female",
|
|
488
|
+
gender: "female",
|
|
489
|
+
base: ["brown"],
|
|
490
|
+
hair: ["woman008"],
|
|
491
|
+
mouth: ["unisex001"],
|
|
492
|
+
clothes: ["woman001"],
|
|
493
|
+
earing: ["woman002"],
|
|
494
|
+
earingProbability: 100,
|
|
495
|
+
glasses: undefined,
|
|
496
|
+
glassesProbability: 0,
|
|
497
|
+
mask: undefined,
|
|
498
|
+
},
|
|
499
|
+
"nocobase-039-female": {
|
|
500
|
+
seed: "nocobase-039-female",
|
|
501
|
+
gender: "female",
|
|
502
|
+
base: ["brown"],
|
|
503
|
+
hair: ["woman010"],
|
|
504
|
+
mouth: ["unisex001"],
|
|
505
|
+
clothes: ["unisex005"],
|
|
506
|
+
earing: undefined,
|
|
507
|
+
earingProbability: 0,
|
|
508
|
+
glasses: ["unisex001"],
|
|
509
|
+
glassesProbability: 100,
|
|
510
|
+
mask: undefined,
|
|
511
|
+
},
|
|
512
|
+
"nocobase-040-female": {
|
|
513
|
+
seed: "nocobase-040-female",
|
|
514
|
+
gender: "female",
|
|
515
|
+
base: ["brown"],
|
|
516
|
+
hair: ["woman010"],
|
|
517
|
+
mouth: ["unisex001"],
|
|
518
|
+
clothes: ["unisex001"],
|
|
519
|
+
earing: undefined,
|
|
520
|
+
earingProbability: 0,
|
|
521
|
+
glasses: undefined,
|
|
522
|
+
glassesProbability: 0,
|
|
523
|
+
mask: undefined,
|
|
524
|
+
},
|
|
525
|
+
"nocobase-041-male": {
|
|
526
|
+
seed: "nocobase-041-male",
|
|
527
|
+
gender: "male",
|
|
528
|
+
base: ["blue"],
|
|
529
|
+
hair: ["man006"],
|
|
530
|
+
mouth: ["unisex001"],
|
|
531
|
+
clothes: ["unisex011"],
|
|
532
|
+
earing: ["unisex002"],
|
|
533
|
+
earingProbability: 100,
|
|
534
|
+
glasses: undefined,
|
|
535
|
+
glassesProbability: 0,
|
|
536
|
+
mask: undefined,
|
|
537
|
+
},
|
|
538
|
+
"nocobase-042-male": {
|
|
539
|
+
seed: "nocobase-042-male",
|
|
540
|
+
gender: "male",
|
|
541
|
+
base: ["blue"],
|
|
542
|
+
hair: ["man003"],
|
|
543
|
+
mouth: ["unisex001"],
|
|
544
|
+
clothes: ["unisex014"],
|
|
545
|
+
earing: ["unisex001"],
|
|
546
|
+
earingProbability: 100,
|
|
547
|
+
glasses: ["unisex002"],
|
|
548
|
+
glassesProbability: 100,
|
|
549
|
+
mask: undefined,
|
|
550
|
+
},
|
|
551
|
+
"nocobase-043-male": {
|
|
552
|
+
seed: "nocobase-043-male",
|
|
553
|
+
gender: "male",
|
|
554
|
+
base: ["blue"],
|
|
555
|
+
hair: ["man003"],
|
|
556
|
+
mouth: ["unisex001"],
|
|
557
|
+
clothes: ["unisex014"],
|
|
558
|
+
earing: undefined,
|
|
559
|
+
earingProbability: 0,
|
|
560
|
+
glasses: ["unisex001"],
|
|
561
|
+
glassesProbability: 100,
|
|
562
|
+
mask: undefined,
|
|
563
|
+
},
|
|
564
|
+
"nocobase-044-male": {
|
|
565
|
+
seed: "nocobase-044-male",
|
|
566
|
+
gender: "male",
|
|
567
|
+
base: ["blue"],
|
|
568
|
+
hair: ["man008"],
|
|
569
|
+
mouth: ["unisex001"],
|
|
570
|
+
clothes: ["unisex002"],
|
|
571
|
+
earing: ["unisex001"],
|
|
572
|
+
earingProbability: 100,
|
|
573
|
+
glasses: undefined,
|
|
574
|
+
glassesProbability: 0,
|
|
575
|
+
mask: undefined,
|
|
576
|
+
},
|
|
577
|
+
"nocobase-045-female": {
|
|
578
|
+
seed: "nocobase-045-female",
|
|
579
|
+
gender: "female",
|
|
580
|
+
base: ["blue"],
|
|
581
|
+
hair: ["woman003"],
|
|
582
|
+
mouth: ["unisex001"],
|
|
583
|
+
clothes: ["woman004"],
|
|
584
|
+
earing: ["woman005"],
|
|
585
|
+
earingProbability: 100,
|
|
586
|
+
glasses: undefined,
|
|
587
|
+
glassesProbability: 0,
|
|
588
|
+
mask: undefined,
|
|
589
|
+
},
|
|
590
|
+
"nocobase-046-female": {
|
|
591
|
+
seed: "nocobase-046-female",
|
|
592
|
+
gender: "female",
|
|
593
|
+
base: ["blue"],
|
|
594
|
+
hair: ["woman001"],
|
|
595
|
+
mouth: ["unisex001"],
|
|
596
|
+
clothes: ["unisex015"],
|
|
597
|
+
earing: undefined,
|
|
598
|
+
earingProbability: 0,
|
|
599
|
+
glasses: undefined,
|
|
600
|
+
glassesProbability: 0,
|
|
601
|
+
mask: undefined,
|
|
602
|
+
},
|
|
603
|
+
"nocobase-047-male": {
|
|
604
|
+
seed: "nocobase-047-male",
|
|
605
|
+
gender: "male",
|
|
606
|
+
base: ["blue"],
|
|
607
|
+
hair: ["man007"],
|
|
608
|
+
mouth: ["unisex001"],
|
|
609
|
+
clothes: ["unisex001"],
|
|
610
|
+
earing: ["unisex002"],
|
|
611
|
+
earingProbability: 100,
|
|
612
|
+
glasses: ["unisex001"],
|
|
613
|
+
glassesProbability: 100,
|
|
614
|
+
mask: undefined,
|
|
615
|
+
},
|
|
616
|
+
"nocobase-048-female": {
|
|
617
|
+
seed: "nocobase-048-female",
|
|
618
|
+
gender: "female",
|
|
619
|
+
base: ["blue"],
|
|
620
|
+
hair: ["woman007"],
|
|
621
|
+
mouth: ["unisex001"],
|
|
622
|
+
clothes: ["unisex009"],
|
|
623
|
+
earing: undefined,
|
|
624
|
+
earingProbability: 0,
|
|
625
|
+
glasses: ["unisex001"],
|
|
626
|
+
glassesProbability: 100,
|
|
627
|
+
mask: undefined,
|
|
628
|
+
},
|
|
629
|
+
"nocobase-049-male": {
|
|
630
|
+
seed: "nocobase-049-male",
|
|
631
|
+
gender: "male",
|
|
632
|
+
base: ["blue"],
|
|
633
|
+
hair: ["man005"],
|
|
634
|
+
mouth: ["unisex001"],
|
|
635
|
+
clothes: ["unisex005"],
|
|
636
|
+
earing: ["unisex002"],
|
|
637
|
+
earingProbability: 100,
|
|
638
|
+
glasses: undefined,
|
|
639
|
+
glassesProbability: 0,
|
|
640
|
+
mask: undefined,
|
|
641
|
+
},
|
|
642
|
+
"nocobase-050-female": {
|
|
643
|
+
seed: "nocobase-050-female",
|
|
644
|
+
gender: "female",
|
|
645
|
+
base: ["blue"],
|
|
646
|
+
hair: ["woman001"],
|
|
647
|
+
mouth: ["unisex001"],
|
|
648
|
+
clothes: ["unisex013"],
|
|
649
|
+
earing: ["unisex002"],
|
|
650
|
+
earingProbability: 100,
|
|
651
|
+
glasses: undefined,
|
|
652
|
+
glassesProbability: 0,
|
|
653
|
+
mask: undefined,
|
|
654
|
+
},
|
|
655
|
+
"nocobase-051-female": {
|
|
656
|
+
seed: "nocobase-051-female",
|
|
657
|
+
gender: "female",
|
|
658
|
+
base: ["yellow"],
|
|
659
|
+
hair: ["woman001"],
|
|
660
|
+
mouth: ["unisex001"],
|
|
661
|
+
clothes: ["unisex002"],
|
|
662
|
+
earing: undefined,
|
|
663
|
+
earingProbability: 0,
|
|
664
|
+
glasses: undefined,
|
|
665
|
+
glassesProbability: 0,
|
|
666
|
+
mask: undefined,
|
|
667
|
+
},
|
|
668
|
+
"nocobase-052-female": {
|
|
669
|
+
seed: "nocobase-052-female",
|
|
670
|
+
gender: "female",
|
|
671
|
+
base: ["yellow"],
|
|
672
|
+
hair: ["woman002"],
|
|
673
|
+
mouth: ["unisex001"],
|
|
674
|
+
clothes: ["unisex008"],
|
|
675
|
+
earing: undefined,
|
|
676
|
+
earingProbability: 0,
|
|
677
|
+
glasses: undefined,
|
|
678
|
+
glassesProbability: 0,
|
|
679
|
+
mask: undefined,
|
|
680
|
+
},
|
|
681
|
+
"nocobase-053-male": {
|
|
682
|
+
seed: "nocobase-053-male",
|
|
683
|
+
gender: "male",
|
|
684
|
+
base: ["yellow"],
|
|
685
|
+
hair: ["man005"],
|
|
686
|
+
mouth: ["unisex001"],
|
|
687
|
+
clothes: ["unisex015"],
|
|
688
|
+
earing: ["unisex002"],
|
|
689
|
+
earingProbability: 100,
|
|
690
|
+
glasses: ["unisex002"],
|
|
691
|
+
glassesProbability: 100,
|
|
692
|
+
mask: undefined,
|
|
693
|
+
},
|
|
694
|
+
"nocobase-054-female": {
|
|
695
|
+
seed: "nocobase-054-female",
|
|
696
|
+
gender: "female",
|
|
697
|
+
base: ["yellow"],
|
|
698
|
+
hair: ["woman012"],
|
|
699
|
+
mouth: ["unisex001"],
|
|
700
|
+
clothes: ["unisex015"],
|
|
701
|
+
earing: undefined,
|
|
702
|
+
earingProbability: 0,
|
|
703
|
+
glasses: ["unisex001"],
|
|
704
|
+
glassesProbability: 100,
|
|
705
|
+
mask: undefined,
|
|
706
|
+
},
|
|
707
|
+
"nocobase-055-male": {
|
|
708
|
+
seed: "nocobase-055-male",
|
|
709
|
+
gender: "male",
|
|
710
|
+
base: ["yellow"],
|
|
711
|
+
hair: ["man003"],
|
|
712
|
+
mouth: ["unisex001"],
|
|
713
|
+
clothes: ["unisex001"],
|
|
714
|
+
earing: ["unisex001"],
|
|
715
|
+
earingProbability: 100,
|
|
716
|
+
glasses: undefined,
|
|
717
|
+
glassesProbability: 0,
|
|
718
|
+
mask: undefined,
|
|
719
|
+
},
|
|
720
|
+
"nocobase-056-female": {
|
|
721
|
+
seed: "nocobase-056-female",
|
|
722
|
+
gender: "female",
|
|
723
|
+
base: ["yellow"],
|
|
724
|
+
hair: ["woman002"],
|
|
725
|
+
mouth: ["unisex001"],
|
|
726
|
+
clothes: ["unisex011"],
|
|
727
|
+
earing: ["unisex001"],
|
|
728
|
+
earingProbability: 100,
|
|
729
|
+
glasses: ["unisex002"],
|
|
730
|
+
glassesProbability: 100,
|
|
731
|
+
mask: undefined,
|
|
732
|
+
},
|
|
733
|
+
"nocobase-057-female": {
|
|
734
|
+
seed: "nocobase-057-female",
|
|
735
|
+
gender: "female",
|
|
736
|
+
base: ["yellow"],
|
|
737
|
+
hair: ["woman009"],
|
|
738
|
+
mouth: ["unisex001"],
|
|
739
|
+
clothes: ["unisex004"],
|
|
740
|
+
earing: ["woman005"],
|
|
741
|
+
earingProbability: 100,
|
|
742
|
+
glasses: undefined,
|
|
743
|
+
glassesProbability: 0,
|
|
744
|
+
mask: undefined,
|
|
745
|
+
},
|
|
746
|
+
"nocobase-058-female": {
|
|
747
|
+
seed: "nocobase-058-female",
|
|
748
|
+
gender: "female",
|
|
749
|
+
base: ["yellow"],
|
|
750
|
+
hair: ["woman010"],
|
|
751
|
+
mouth: ["unisex001"],
|
|
752
|
+
clothes: ["unisex008"],
|
|
753
|
+
earing: ["unisex002"],
|
|
754
|
+
earingProbability: 100,
|
|
755
|
+
glasses: undefined,
|
|
756
|
+
glassesProbability: 0,
|
|
757
|
+
mask: undefined,
|
|
758
|
+
},
|
|
759
|
+
"nocobase-059-male": {
|
|
760
|
+
seed: "nocobase-059-male",
|
|
761
|
+
gender: "male",
|
|
762
|
+
base: ["yellow"],
|
|
763
|
+
hair: ["man005"],
|
|
764
|
+
mouth: ["unisex001"],
|
|
765
|
+
clothes: ["unisex008"],
|
|
766
|
+
earing: ["unisex001"],
|
|
767
|
+
earingProbability: 100,
|
|
768
|
+
glasses: undefined,
|
|
769
|
+
glassesProbability: 0,
|
|
770
|
+
mask: undefined,
|
|
771
|
+
},
|
|
772
|
+
"nocobase-060-female": {
|
|
773
|
+
seed: "nocobase-060-female",
|
|
774
|
+
gender: "female",
|
|
775
|
+
base: ["yellow"],
|
|
776
|
+
hair: ["woman012"],
|
|
777
|
+
mouth: ["unisex001"],
|
|
778
|
+
clothes: ["woman004"],
|
|
779
|
+
earing: undefined,
|
|
780
|
+
earingProbability: 0,
|
|
781
|
+
glasses: undefined,
|
|
782
|
+
glassesProbability: 0,
|
|
783
|
+
mask: undefined,
|
|
784
|
+
},
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
const fallbackAvatar = "nocobase-003-female";
|
|
788
|
+
const cache = new Map<string, string>();
|
|
789
|
+
|
|
790
|
+
export function getAIEmployeeAvatar(
|
|
791
|
+
seed?: string,
|
|
792
|
+
options?: { flip?: boolean }
|
|
793
|
+
) {
|
|
794
|
+
if (
|
|
795
|
+
seed?.startsWith("data:") ||
|
|
796
|
+
seed?.startsWith("blob:") ||
|
|
797
|
+
/^https?:\/\//.test(seed ?? "")
|
|
798
|
+
) {
|
|
799
|
+
return seed;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
const avatarSeed = seed && seed in avatarOptions ? seed : fallbackAvatar;
|
|
803
|
+
const cacheKey = `${avatarSeed}:${
|
|
804
|
+
options?.flip === true ? "flip" : "default"
|
|
805
|
+
}`;
|
|
806
|
+
const cached = cache.get(cacheKey);
|
|
807
|
+
if (cached) return cached;
|
|
808
|
+
|
|
809
|
+
const dataUri = createAvatar(nocobaseAvatars, {
|
|
810
|
+
...(avatarOptions[avatarSeed] as object),
|
|
811
|
+
flip: options?.flip === true,
|
|
812
|
+
mask: undefined,
|
|
813
|
+
scale: 100,
|
|
814
|
+
} as never).toDataUri();
|
|
815
|
+
cache.set(cacheKey, dataUri);
|
|
816
|
+
return dataUri;
|
|
817
|
+
}
|