plugin-build-guide-block 1.0.9 → 1.0.10

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 (49) hide show
  1. package/README.md +74 -74
  2. package/dist/client/index.js +1 -1
  3. package/dist/externalVersion.js +7 -7
  4. package/dist/locale/en-US.json +28 -27
  5. package/dist/locale/vi-VN.json +28 -27
  6. package/dist/locale/zh-CN.json +28 -27
  7. package/dist/server/actions/build.js +3 -0
  8. package/dist/server/index.js +10 -3
  9. package/dist/server/plugin.js +14 -0
  10. package/package.json +31 -31
  11. package/src/client/UserGuideBlock.tsx +53 -53
  12. package/src/client/UserGuideBlockInitializer.tsx +26 -26
  13. package/src/client/UserGuideBlockProvider.tsx +12 -12
  14. package/src/client/UserGuideManager.tsx +127 -107
  15. package/src/client/components/BuildButton.tsx +78 -43
  16. package/src/client/components/LLMServiceSelect.tsx +44 -44
  17. package/src/client/components/ModelSelect.tsx +41 -41
  18. package/src/client/components/StatusTag.tsx +17 -17
  19. package/src/client/models/UserGuideBlockModel.ts +54 -54
  20. package/src/client/models/index.ts +1 -3
  21. package/src/client/plugin.tsx +30 -30
  22. package/src/client/schemas/spacesSchema.ts +316 -316
  23. package/src/locale/en-US.json +28 -27
  24. package/src/locale/vi-VN.json +28 -27
  25. package/src/locale/zh-CN.json +28 -27
  26. package/src/server/actions/build.ts +176 -171
  27. package/src/server/actions/getHtml.ts +26 -26
  28. package/src/server/collections/ai-build-guide-spaces.ts +50 -50
  29. package/src/server/index.ts +2 -0
  30. package/src/server/plugin.ts +76 -60
  31. package/dist/client/UserGuideBlock.d.ts +0 -2
  32. package/dist/client/UserGuideBlockInitializer.d.ts +0 -2
  33. package/dist/client/UserGuideBlockProvider.d.ts +0 -2
  34. package/dist/client/UserGuideManager.d.ts +0 -2
  35. package/dist/client/components/BuildButton.d.ts +0 -2
  36. package/dist/client/components/LLMServiceSelect.d.ts +0 -2
  37. package/dist/client/components/ModelSelect.d.ts +0 -2
  38. package/dist/client/components/StatusTag.d.ts +0 -2
  39. package/dist/client/index.d.ts +0 -1
  40. package/dist/client/models/UserGuideBlockModel.d.ts +0 -9
  41. package/dist/client/models/index.d.ts +0 -11
  42. package/dist/client/plugin.d.ts +0 -5
  43. package/dist/client/schemas/spacesSchema.d.ts +0 -315
  44. package/dist/index.d.ts +0 -2
  45. package/dist/server/actions/build.d.ts +0 -2
  46. package/dist/server/actions/getHtml.d.ts +0 -2
  47. package/dist/server/collections/ai-build-guide-spaces.d.ts +0 -2
  48. package/dist/server/index.d.ts +0 -1
  49. package/dist/server/plugin.d.ts +0 -12
@@ -1,50 +1,50 @@
1
- import { defineCollection } from '@nocobase/database';
2
-
3
- export default defineCollection({
4
- name: 'aiBuildGuideSpaces',
5
- shared: true,
6
- dumpRules: 'required',
7
- migrationRules: ['overwrite', 'schema-only'],
8
- timestamps: true,
9
- fields: [
10
- {
11
- type: 'uid',
12
- name: 'id',
13
- primaryKey: true,
14
- },
15
- {
16
- type: 'string',
17
- name: 'title',
18
- },
19
- {
20
- type: 'string',
21
- name: 'llmService',
22
- },
23
- {
24
- type: 'string',
25
- name: 'model',
26
- },
27
- {
28
- type: 'text',
29
- name: 'systemPrompt',
30
- },
31
- {
32
- type: 'text',
33
- name: 'generatedHtml',
34
- },
35
- {
36
- type: 'string',
37
- name: 'status',
38
- defaultValue: 'draft',
39
- },
40
- {
41
- type: 'text',
42
- name: 'buildLog',
43
- },
44
- {
45
- type: 'belongsToMany',
46
- name: 'documents',
47
- target: 'attachments',
48
- },
49
- ],
50
- });
1
+ import { defineCollection } from '@nocobase/database';
2
+
3
+ export default defineCollection({
4
+ name: 'aiBuildGuideSpaces',
5
+ shared: true,
6
+ dumpRules: 'required',
7
+ migrationRules: ['overwrite', 'schema-only'],
8
+ timestamps: true,
9
+ fields: [
10
+ {
11
+ type: 'uid',
12
+ name: 'id',
13
+ primaryKey: true,
14
+ },
15
+ {
16
+ type: 'string',
17
+ name: 'title',
18
+ },
19
+ {
20
+ type: 'string',
21
+ name: 'llmService',
22
+ },
23
+ {
24
+ type: 'string',
25
+ name: 'model',
26
+ },
27
+ {
28
+ type: 'text',
29
+ name: 'systemPrompt',
30
+ },
31
+ {
32
+ type: 'text',
33
+ name: 'generatedHtml',
34
+ },
35
+ {
36
+ type: 'string',
37
+ name: 'status',
38
+ defaultValue: 'draft',
39
+ },
40
+ {
41
+ type: 'text',
42
+ name: 'buildLog',
43
+ },
44
+ {
45
+ type: 'belongsToMany',
46
+ name: 'documents',
47
+ target: 'attachments',
48
+ },
49
+ ],
50
+ });
@@ -1 +1,3 @@
1
+ import { name } from '../../package.json';
1
2
  export { default } from './plugin';
3
+ export const namespace = name;
@@ -1,60 +1,76 @@
1
- import { InstallOptions, Plugin } from '@nocobase/server';
2
- import path from 'path';
3
- import { build } from './actions/build';
4
- import { getHtml } from './actions/getHtml';
5
-
6
- export class PluginBuildGuideBlockServer extends Plugin {
7
- afterAdd() {}
8
-
9
- beforeLoad() {}
10
-
11
- async load() {
12
- this.app.resourceManager.registerActionHandlers({
13
- 'aiBuildGuideSpaces:build': build,
14
- 'aiBuildGuideSpaces:getHtml': getHtml,
15
- });
16
-
17
- this.app.acl.allow('aiBuildGuideSpaces', 'getHtml', 'loggedIn');
18
- this.app.acl.registerSnippet({
19
- name: 'pm.ai-build-guide',
20
- actions: [
21
- 'aiBuildGuideSpaces:create',
22
- 'aiBuildGuideSpaces:update',
23
- 'aiBuildGuideSpaces:destroy',
24
- 'aiBuildGuideSpaces:list',
25
- 'aiBuildGuideSpaces:get',
26
- 'aiBuildGuideSpaces:build',
27
- ],
28
- });
29
- }
30
-
31
- async install(options?: InstallOptions) {
32
- const collection = this.db.getCollection('aiBuildGuideSpaces');
33
- if (collection) {
34
- await collection.model.sync();
35
- }
36
- const repo = this.db.getRepository<any>('collections');
37
- if (repo) {
38
- await repo.db2cm('aiBuildGuideSpaces');
39
- }
40
- }
41
-
42
- async upgrade() {
43
- const collection = this.db.getCollection('aiBuildGuideSpaces');
44
- if (collection) {
45
- await collection.model.sync();
46
- }
47
- const repo = this.db.getRepository<any>('collections');
48
- if (repo) {
49
- await repo.db2cm('aiBuildGuideSpaces');
50
- }
51
- }
52
-
53
- async afterEnable() {}
54
-
55
- async afterDisable() {}
56
-
57
- async remove() {}
58
- }
59
-
60
- export default PluginBuildGuideBlockServer;
1
+ import { InstallOptions, Plugin } from '@nocobase/server';
2
+ import path from 'path';
3
+ import { build } from './actions/build';
4
+ import { getHtml } from './actions/getHtml';
5
+
6
+ export class PluginBuildGuideBlockServer extends Plugin {
7
+ afterAdd() {}
8
+
9
+ beforeLoad() {}
10
+
11
+ async load() {
12
+ this.app.resourceManager.registerActionHandlers({
13
+ 'aiBuildGuideSpaces:build': build,
14
+ 'aiBuildGuideSpaces:getHtml': getHtml,
15
+ });
16
+
17
+ this.app.acl.allow('aiBuildGuideSpaces', 'getHtml', 'loggedIn');
18
+ this.app.acl.registerSnippet({
19
+ name: 'pm.ai-build-guide',
20
+ actions: [
21
+ 'aiBuildGuideSpaces:create',
22
+ 'aiBuildGuideSpaces:update',
23
+ 'aiBuildGuideSpaces:destroy',
24
+ 'aiBuildGuideSpaces:list',
25
+ 'aiBuildGuideSpaces:get',
26
+ 'aiBuildGuideSpaces:build',
27
+ ],
28
+ });
29
+
30
+ // Recover stale "building" status after server restart
31
+ this.app.on('afterStart', async () => {
32
+ try {
33
+ const repo = this.db.getRepository('aiBuildGuideSpaces');
34
+ await repo.update({
35
+ filter: { status: 'building' },
36
+ values: {
37
+ status: 'error',
38
+ buildLog: 'Build interrupted by server restart',
39
+ },
40
+ });
41
+ } catch (err) {
42
+ this.app.logger.warn('[plugin-build-guide-block] Failed to recover stale builds', err);
43
+ }
44
+ });
45
+ }
46
+
47
+ async install(options?: InstallOptions) {
48
+ const collection = this.db.getCollection('aiBuildGuideSpaces');
49
+ if (collection) {
50
+ await collection.model.sync();
51
+ }
52
+ const repo = this.db.getRepository<any>('collections');
53
+ if (repo) {
54
+ await repo.db2cm('aiBuildGuideSpaces');
55
+ }
56
+ }
57
+
58
+ async upgrade() {
59
+ const collection = this.db.getCollection('aiBuildGuideSpaces');
60
+ if (collection) {
61
+ await collection.model.sync();
62
+ }
63
+ const repo = this.db.getRepository<any>('collections');
64
+ if (repo) {
65
+ await repo.db2cm('aiBuildGuideSpaces');
66
+ }
67
+ }
68
+
69
+ async afterEnable() {}
70
+
71
+ async afterDisable() {}
72
+
73
+ async remove() {}
74
+ }
75
+
76
+ export default PluginBuildGuideBlockServer;
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const UserGuideBlock: React.MemoExoticComponent<import("@formily/react").ReactFC<Omit<any, "ref">>>;
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const UserGuideBlockInitializer: () => React.JSX.Element;
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const UserGuideBlockProvider: (props: any) => React.JSX.Element;
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const UserGuideManager: () => React.JSX.Element;
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const BuildButton: () => React.JSX.Element;
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const LLMServiceSelect: (props: any) => React.JSX.Element;
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const ModelSelect: React.MemoExoticComponent<import("@formily/react").ReactFC<Omit<any, "ref">>>;
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const StatusTag: (props: any) => React.JSX.Element;
@@ -1 +0,0 @@
1
- export { default } from './plugin';
@@ -1,9 +0,0 @@
1
- import { BlockModel } from '@nocobase/client';
2
- import React from 'react';
3
- export declare class UserGuideBlockModel extends BlockModel {
4
- renderComponent(): React.FunctionComponentElement<Omit<{
5
- children?: React.ReactNode;
6
- }, string | number | symbol> & Omit<any, "ref"> & {
7
- children?: any;
8
- }>;
9
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { ModelConstructor } from '@nocobase/flow-engine';
10
- declare const _default: Record<string, ModelConstructor>;
11
- export default _default;
@@ -1,5 +0,0 @@
1
- import { Plugin } from '@nocobase/client';
2
- export declare class PluginBuildGuideBlockClient extends Plugin {
3
- load(): Promise<void>;
4
- }
5
- export default PluginBuildGuideBlockClient;
@@ -1,315 +0,0 @@
1
- export declare const spacesSchema: {
2
- type: string;
3
- name: string;
4
- properties: {
5
- card: {
6
- type: string;
7
- 'x-component': string;
8
- 'x-decorator': string;
9
- 'x-decorator-props': {
10
- collection: string;
11
- action: string;
12
- rowKey: string;
13
- params: {
14
- appends: string[];
15
- sort: string[];
16
- };
17
- };
18
- properties: {
19
- actions: {
20
- type: string;
21
- 'x-component': string;
22
- 'x-component-props': {
23
- style: {
24
- marginBottom: number;
25
- };
26
- };
27
- properties: {
28
- create: {
29
- type: string;
30
- 'x-component': string;
31
- 'x-component-props': {
32
- type: string;
33
- title: string;
34
- icon: string;
35
- };
36
- properties: {
37
- drawer: {
38
- type: string;
39
- 'x-component': string;
40
- 'x-component-props': {
41
- title: string;
42
- };
43
- properties: {
44
- form: {
45
- type: string;
46
- 'x-component': string;
47
- 'x-use-component-props': string;
48
- properties: {
49
- title: {
50
- type: string;
51
- title: string;
52
- required: boolean;
53
- 'x-decorator': string;
54
- 'x-component': string;
55
- };
56
- llmService: {
57
- type: string;
58
- title: string;
59
- required: boolean;
60
- 'x-decorator': string;
61
- 'x-component': string;
62
- };
63
- model: {
64
- type: string;
65
- title: string;
66
- required: boolean;
67
- 'x-decorator': string;
68
- 'x-component': string;
69
- 'x-reactions': {
70
- dependencies: string[];
71
- fulfill: {
72
- state: {
73
- value: string;
74
- };
75
- };
76
- };
77
- };
78
- systemPrompt: {
79
- type: string;
80
- title: string;
81
- 'x-decorator': string;
82
- 'x-component': string;
83
- 'x-component-props': {
84
- rows: number;
85
- };
86
- default: string;
87
- };
88
- documents: {
89
- type: string;
90
- title: string;
91
- 'x-decorator': string;
92
- 'x-component': string;
93
- 'x-component-props': {
94
- multiple: boolean;
95
- action: string;
96
- maxCount: number;
97
- };
98
- };
99
- footer: {
100
- type: string;
101
- 'x-component': string;
102
- properties: {
103
- cancel: {
104
- type: string;
105
- title: string;
106
- 'x-component': string;
107
- 'x-use-component-props': string;
108
- };
109
- submit: {
110
- type: string;
111
- title: string;
112
- 'x-component': string;
113
- 'x-use-component-props': string;
114
- };
115
- };
116
- };
117
- };
118
- };
119
- };
120
- };
121
- };
122
- };
123
- };
124
- };
125
- table: {
126
- type: string;
127
- 'x-component': string;
128
- 'x-use-component-props': string;
129
- 'x-component-props': {
130
- rowKey: string;
131
- rowSelection: {
132
- type: string;
133
- };
134
- };
135
- properties: {
136
- title: {
137
- type: string;
138
- title: string;
139
- 'x-decorator': string;
140
- 'x-component': string;
141
- properties: {
142
- title: {
143
- type: string;
144
- 'x-component': string;
145
- 'x-read-pretty': boolean;
146
- };
147
- };
148
- };
149
- status: {
150
- type: string;
151
- title: string;
152
- 'x-decorator': string;
153
- 'x-component': string;
154
- properties: {
155
- status: {
156
- type: string;
157
- 'x-component': string;
158
- 'x-read-pretty': boolean;
159
- };
160
- };
161
- };
162
- buildLog: {
163
- type: string;
164
- title: string;
165
- 'x-decorator': string;
166
- 'x-component': string;
167
- properties: {
168
- buildLog: {
169
- type: string;
170
- 'x-component': string;
171
- 'x-read-pretty': boolean;
172
- };
173
- };
174
- };
175
- actions: {
176
- type: string;
177
- title: string;
178
- 'x-decorator': string;
179
- 'x-component': string;
180
- properties: {
181
- actions: {
182
- type: string;
183
- 'x-component': string;
184
- 'x-component-props': {
185
- split: string;
186
- };
187
- properties: {
188
- build: {
189
- type: string;
190
- 'x-component': string;
191
- };
192
- update: {
193
- type: string;
194
- title: string;
195
- 'x-component': string;
196
- 'x-component-props': {
197
- type: string;
198
- };
199
- properties: {
200
- drawer: {
201
- type: string;
202
- 'x-component': string;
203
- 'x-component-props': {
204
- title: string;
205
- };
206
- properties: {
207
- form: {
208
- type: string;
209
- 'x-component': string;
210
- 'x-use-component-props': string;
211
- properties: {
212
- title: {
213
- type: string;
214
- title: string;
215
- required: boolean;
216
- 'x-decorator': string;
217
- 'x-component': string;
218
- };
219
- llmService: {
220
- type: string;
221
- title: string;
222
- required: boolean;
223
- 'x-decorator': string;
224
- 'x-component': string;
225
- };
226
- model: {
227
- type: string;
228
- title: string;
229
- required: boolean;
230
- 'x-decorator': string;
231
- 'x-component': string;
232
- };
233
- systemPrompt: {
234
- type: string;
235
- title: string;
236
- 'x-decorator': string;
237
- 'x-component': string;
238
- 'x-component-props': {
239
- rows: number;
240
- };
241
- };
242
- documents: {
243
- type: string;
244
- title: string;
245
- 'x-decorator': string;
246
- 'x-component': string;
247
- 'x-component-props': {
248
- multiple: boolean;
249
- action: string;
250
- maxCount: number;
251
- };
252
- };
253
- generatedHtml: {
254
- type: string;
255
- title: string;
256
- 'x-decorator': string;
257
- 'x-component': string;
258
- 'x-component-props': {
259
- rows: number;
260
- };
261
- 'x-read-pretty': boolean;
262
- };
263
- buildLog: {
264
- type: string;
265
- title: string;
266
- 'x-decorator': string;
267
- 'x-component': string;
268
- 'x-read-pretty': boolean;
269
- };
270
- footer: {
271
- type: string;
272
- 'x-component': string;
273
- properties: {
274
- cancel: {
275
- type: string;
276
- title: string;
277
- 'x-component': string;
278
- 'x-use-component-props': string;
279
- };
280
- submit: {
281
- type: string;
282
- title: string;
283
- 'x-component': string;
284
- 'x-use-component-props': string;
285
- };
286
- };
287
- };
288
- };
289
- };
290
- };
291
- };
292
- };
293
- };
294
- delete: {
295
- type: string;
296
- title: string;
297
- 'x-component': string;
298
- 'x-use-component-props': string;
299
- 'x-component-props': {
300
- confirm: {
301
- title: string;
302
- content: string;
303
- };
304
- };
305
- };
306
- };
307
- };
308
- };
309
- };
310
- };
311
- };
312
- };
313
- };
314
- };
315
- };
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './server';
2
- export { default } from './server';
@@ -1,2 +0,0 @@
1
- import { Context, Next } from '@nocobase/actions';
2
- export declare function build(ctx: Context, next: Next): Promise<void>;
@@ -1,2 +0,0 @@
1
- import { Context, Next } from '@nocobase/actions';
2
- export declare function getHtml(ctx: Context, next: Next): Promise<void>;
@@ -1,2 +0,0 @@
1
- declare const _default: import("@nocobase/database").CollectionOptions;
2
- export default _default;
@@ -1 +0,0 @@
1
- export { default } from './plugin';