plugin-build-guide-block 1.1.5 → 1.1.7
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/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/dist/client/index.js +2 -2
- package/dist/client-v2/73.6b8b2eda7d969c69.js +10 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/externalVersion.js +9 -8
- package/dist/node_modules/sanitize-html/index.js +2 -2
- package/dist/node_modules/sanitize-html/package.json +1 -1
- package/dist/server/actions/build.js +687 -85
- package/dist/server/collections/ai-build-guide-spaces.js +20 -0
- package/dist/server/plugin.js +21 -19
- package/dist/server/tools/search-guides.js +41 -30
- package/package.json +7 -3
- package/src/client/components/BuildButton.tsx +20 -9
- package/src/client-v2/plugin.tsx +24 -0
- package/src/server/actions/build.ts +774 -88
- package/src/server/collections/ai-build-guide-spaces.ts +77 -57
- package/src/server/plugin.ts +170 -163
- package/src/server/tools/search-guides.ts +113 -95
- package/dist/client/UserGuideBlock.d.ts +0 -2
- package/dist/client/UserGuideBlockInitializer.d.ts +0 -2
- package/dist/client/UserGuideBlockProvider.d.ts +0 -2
- package/dist/client/UserGuideManager.d.ts +0 -2
- package/dist/client/components/BuildButton.d.ts +0 -2
- package/dist/client/components/LLMServiceSelect.d.ts +0 -2
- package/dist/client/components/ModelSelect.d.ts +0 -2
- package/dist/client/components/SpaceSelect.d.ts +0 -2
- package/dist/client/components/StatusTag.d.ts +0 -2
- package/dist/client/locale.d.ts +0 -3
- package/dist/client/models/UserGuideBlockModel.d.ts +0 -9
- package/dist/client/models/index.d.ts +0 -9
- package/dist/client/plugin.d.ts +0 -5
- package/dist/client/schemaSettings.d.ts +0 -2
- package/dist/client/schemas/spacesSchema.d.ts +0 -437
- package/dist/index.d.ts +0 -2
- package/dist/locale/namespace.d.ts +0 -6
- package/dist/node_modules/sanitize-html/node_modules/nanoid/async/index.browser.cjs +0 -34
- package/dist/node_modules/sanitize-html/node_modules/nanoid/async/index.browser.js +0 -34
- package/dist/node_modules/sanitize-html/node_modules/nanoid/async/index.cjs +0 -35
- package/dist/node_modules/sanitize-html/node_modules/nanoid/async/index.d.ts +0 -56
- package/dist/node_modules/sanitize-html/node_modules/nanoid/async/index.js +0 -35
- package/dist/node_modules/sanitize-html/node_modules/nanoid/async/index.native.js +0 -26
- package/dist/node_modules/sanitize-html/node_modules/nanoid/async/package.json +0 -12
- package/dist/node_modules/sanitize-html/node_modules/nanoid/bin/nanoid.cjs +0 -55
- package/dist/node_modules/sanitize-html/node_modules/nanoid/index.browser.cjs +0 -34
- package/dist/node_modules/sanitize-html/node_modules/nanoid/index.browser.js +0 -34
- package/dist/node_modules/sanitize-html/node_modules/nanoid/index.cjs +0 -45
- package/dist/node_modules/sanitize-html/node_modules/nanoid/index.d.cts +0 -91
- package/dist/node_modules/sanitize-html/node_modules/nanoid/index.d.ts +0 -91
- package/dist/node_modules/sanitize-html/node_modules/nanoid/index.js +0 -45
- package/dist/node_modules/sanitize-html/node_modules/nanoid/nanoid.js +0 -1
- package/dist/node_modules/sanitize-html/node_modules/nanoid/non-secure/index.cjs +0 -21
- package/dist/node_modules/sanitize-html/node_modules/nanoid/non-secure/index.d.ts +0 -33
- package/dist/node_modules/sanitize-html/node_modules/nanoid/non-secure/index.js +0 -21
- package/dist/node_modules/sanitize-html/node_modules/nanoid/non-secure/package.json +0 -6
- package/dist/node_modules/sanitize-html/node_modules/nanoid/package.json +0 -88
- package/dist/node_modules/sanitize-html/node_modules/nanoid/url-alphabet/index.cjs +0 -3
- package/dist/node_modules/sanitize-html/node_modules/nanoid/url-alphabet/index.js +0 -3
- package/dist/node_modules/sanitize-html/node_modules/nanoid/url-alphabet/package.json +0 -6
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/at-rule.d.ts +0 -115
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/at-rule.js +0 -25
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/comment.d.ts +0 -67
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/comment.js +0 -13
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/container.d.ts +0 -452
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/container.js +0 -439
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/css-syntax-error.d.ts +0 -248
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/css-syntax-error.js +0 -100
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/declaration.d.ts +0 -148
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/declaration.js +0 -24
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/document.d.ts +0 -68
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/document.js +0 -33
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/fromJSON.d.ts +0 -9
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/fromJSON.js +0 -54
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/input.d.ts +0 -194
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/input.js +0 -248
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/lazy-result.d.ts +0 -190
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/lazy-result.js +0 -550
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/list.d.ts +0 -57
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/list.js +0 -58
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/map-generator.js +0 -359
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/no-work-result.d.ts +0 -46
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/no-work-result.js +0 -135
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/node.d.ts +0 -536
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/node.js +0 -381
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/parse.d.ts +0 -9
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/parse.js +0 -42
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/parser.js +0 -610
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/postcss.d.mts +0 -72
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/postcss.d.ts +0 -441
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/postcss.js +0 -101
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/previous-map.d.ts +0 -81
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/previous-map.js +0 -142
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/processor.d.ts +0 -115
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/processor.js +0 -67
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/result.d.ts +0 -206
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/result.js +0 -42
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/root.d.ts +0 -86
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/root.js +0 -61
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/rule.d.ts +0 -113
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/rule.js +0 -27
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/stringifier.d.ts +0 -46
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/stringifier.js +0 -353
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/stringify.d.ts +0 -9
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/stringify.js +0 -11
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/symbols.js +0 -5
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/terminal-highlight.js +0 -70
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/tokenize.js +0 -266
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/warn-once.js +0 -13
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/warning.d.ts +0 -147
- package/dist/node_modules/sanitize-html/node_modules/postcss/lib/warning.js +0 -37
- package/dist/node_modules/sanitize-html/node_modules/postcss/node_modules/.bin/nanoid +0 -15
- package/dist/node_modules/sanitize-html/node_modules/postcss/node_modules/.bin/nanoid.cmd +0 -7
- package/dist/node_modules/sanitize-html/node_modules/postcss/package.json +0 -88
- package/dist/server/actions/build.d.ts +0 -2
- package/dist/server/actions/getHtml.d.ts +0 -2
- package/dist/server/actions/getMarkdown.d.ts +0 -2
- package/dist/server/collections/ai-build-guide-pages.d.ts +0 -2
- package/dist/server/collections/ai-build-guide-spaces.d.ts +0 -2
- package/dist/server/index.d.ts +0 -2
- package/dist/server/plugin.d.ts +0 -16
- package/dist/server/tools/index.d.ts +0 -1
- package/dist/server/tools/search-guides.d.ts +0 -28
- /package/{dist/client/index.d.ts → src/client-v2/index.tsx} +0 -0
|
@@ -1,95 +1,113 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
function getValue(record: any, key: string) {
|
|
4
|
+
return record?.get?.(key) ?? record?.[key];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
groupName: 'plugin-build-guide',
|
|
9
|
+
tool: {
|
|
10
|
+
name: 'search_build_guides',
|
|
11
|
+
title: 'Search Build Guides',
|
|
12
|
+
description:
|
|
13
|
+
'Search for available user guides, documentation, or read a specific guide page. Use this to help users find information in the build guide block.',
|
|
14
|
+
execution: 'backend',
|
|
15
|
+
schema: z.object({
|
|
16
|
+
action: z
|
|
17
|
+
.enum(['list_spaces', 'search_pages', 'read_page'])
|
|
18
|
+
.describe(
|
|
19
|
+
'The action to perform: list_spaces (find available guide books), search_pages (search for pages across all or specific spaces), read_page (read the full content of a specific page)',
|
|
20
|
+
),
|
|
21
|
+
query: z.string().optional().describe('Search keyword for finding spaces or pages. Required for search_pages.'),
|
|
22
|
+
pageId: z.string().optional().describe('The ID of the page to read. Required for read_page.'),
|
|
23
|
+
}),
|
|
24
|
+
invoke: async (args: { action: string; query?: string; pageId?: string }, ctx: any) => {
|
|
25
|
+
const { action, query, pageId } = args;
|
|
26
|
+
const { db } = ctx.app;
|
|
27
|
+
|
|
28
|
+
const spaceRepo = db.getRepository('aiBuildGuideSpaces');
|
|
29
|
+
const pageRepo = db.getRepository('aiBuildGuidePages');
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
if (action === 'list_spaces') {
|
|
33
|
+
const filter: any = { status: 'completed' };
|
|
34
|
+
if (query) {
|
|
35
|
+
filter.title = { $iLike: `%${query}%` };
|
|
36
|
+
}
|
|
37
|
+
const spaces = await spaceRepo.find({
|
|
38
|
+
filter,
|
|
39
|
+
fields: ['id', 'title', 'chapterGuidance', 'pageCount'],
|
|
40
|
+
limit: 20,
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
status: 'success',
|
|
44
|
+
content: spaces.map((s: any) => ({
|
|
45
|
+
id: getValue(s, 'id'),
|
|
46
|
+
title: getValue(s, 'title'),
|
|
47
|
+
description: getValue(s, 'chapterGuidance'),
|
|
48
|
+
pageCount: getValue(s, 'pageCount'),
|
|
49
|
+
})),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (action === 'search_pages') {
|
|
54
|
+
const filter: any = { status: 'completed' };
|
|
55
|
+
if (query) {
|
|
56
|
+
filter.$or = [
|
|
57
|
+
{ title: { $iLike: `%${query}%` } },
|
|
58
|
+
{ goal: { $iLike: `%${query}%` } },
|
|
59
|
+
{ generatedMarkdown: { $iLike: `%${query}%` } },
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
const pages = await pageRepo.find({
|
|
63
|
+
filter,
|
|
64
|
+
fields: ['id', 'title', 'slug', 'goal', 'spaceId'],
|
|
65
|
+
limit: 10,
|
|
66
|
+
appends: ['space(id,title,status)'],
|
|
67
|
+
});
|
|
68
|
+
return {
|
|
69
|
+
status: 'success',
|
|
70
|
+
content: pages
|
|
71
|
+
.filter((p: any) => getValue(getValue(p, 'space'), 'status') === 'completed')
|
|
72
|
+
.map((p: any) => ({
|
|
73
|
+
id: getValue(p, 'id'),
|
|
74
|
+
title: getValue(p, 'title'),
|
|
75
|
+
goal: getValue(p, 'goal'),
|
|
76
|
+
spaceName: getValue(getValue(p, 'space'), 'title'),
|
|
77
|
+
})),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (action === 'read_page') {
|
|
82
|
+
if (!pageId) {
|
|
83
|
+
return { status: 'error', content: 'pageId is required for read_page action' };
|
|
84
|
+
}
|
|
85
|
+
const page = await pageRepo.findById(pageId, {
|
|
86
|
+
appends: ['space(id,title,status)'],
|
|
87
|
+
});
|
|
88
|
+
if (!page) {
|
|
89
|
+
return { status: 'error', content: `Page with ID ${pageId} not found.` };
|
|
90
|
+
}
|
|
91
|
+
if (getValue(page, 'status') !== 'completed' || getValue(getValue(page, 'space'), 'status') !== 'completed') {
|
|
92
|
+
return { status: 'error', content: `Page with ID ${pageId} is not completed.` };
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
status: 'success',
|
|
96
|
+
content: {
|
|
97
|
+
id: getValue(page, 'id'),
|
|
98
|
+
title: getValue(page, 'title'),
|
|
99
|
+
spaceName: getValue(getValue(page, 'space'), 'title'),
|
|
100
|
+
goal: getValue(page, 'goal'),
|
|
101
|
+
markdown: getValue(page, 'generatedMarkdown'),
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return { status: 'error', content: 'Invalid action specified' };
|
|
107
|
+
} catch (err: any) {
|
|
108
|
+
ctx.app.logger.error(`[search_build_guides] Error: ${err.message}`, err);
|
|
109
|
+
return { status: 'error', content: `Tool execution failed: ${err.message}` };
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
};
|
package/dist/client/locale.d.ts
DELETED
|
@@ -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,9 +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
|
-
export { UserGuideBlockModel } from './UserGuideBlockModel';
|
package/dist/client/plugin.d.ts
DELETED