plugin-build-guide-block 1.1.2 → 1.1.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/README.md CHANGED
@@ -1,74 +1,16 @@
1
- # @nocobase/plugin-build-guide-block
2
-
3
- Plugin tạo **User Guide (Hướng dẫn sử dụng)** dạng HTML từ tài liệu đính kèm bằng LLM, hiển thị dưới dạng block trên trang NocoBase.
4
-
5
- ## Tính năng
6
-
7
- ### Quản Space
8
- - **Tạo Space**: Mỗi Space đại diện cho một bộ hướng dẫn, bao gồm tiêu đề, dịch vụ LLM, model, system prompt, và tài liệu đính kèm (tối đa 10 file).
9
- - **Build bất đồng bộ**: Nhấn "Build" sẽ gửi tài liệu tới LLM để sinh HTML. Quá trình chạy nền — không block request, tránh timeout.
10
- - **Trạng thái**: `draft` → `building` → `completed` | `error`. Build log hiển thị trực tiếp trên bảng quản lý.
11
- - **CRUD đầy đủ**: Tạo, sửa, xóa Space (có xác nhận trước khi xóa).
12
-
13
- ### User Guide Block
14
- - Thêm block **"User Guide"** vào bất kỳ trang NocoBase nào qua menu "Add Block".
15
- - Chọn Space (chỉ hiển thị các Space đã `completed`) trong cài đặt block.
16
- - HTML được sanitize cả server (sanitize-html) client (DOMPurify) để đảm bảo an toàn.
17
-
18
- ### Bảo mật
19
- - **ACL**: Chỉ admin với snippet `pm.ai-build-guide` mới CRUD/build được. User `loggedIn` chỉ đọc được HTML (`getHtml`).
20
- - **HTML Sanitization**: Hai lớp bảo vệ — server-side (sanitize-html) + client-side (DOMPurify).
21
- - **Status guard**: API `getHtml` chỉ trả HTML khi Space ở trạng thái `completed`.
22
-
23
- ### Đa ngôn ngữ
24
- - Hỗ trợ 3 ngôn ngữ: English (`en-US`), Tiếng Việt (`vi-VN`), 中文 (`zh-CN`).
25
-
26
- ## Kiến trúc
27
-
28
- ```
29
- src/
30
- ├── server/
31
- │ ├── plugin.ts # Đăng ký actions, ACL
32
- │ ├── actions/
33
- │ │ ├── build.ts # Build async: đọc docs → gọi LLM → sanitize → lưu HTML
34
- │ │ └── getHtml.ts # Trả raw HTML (Content-Type: text/html)
35
- │ └── collections/
36
- │ └── ai-build-guide-spaces.ts # Collection definition
37
- ├── client/
38
- │ ├── plugin.tsx # Đăng ký settings page, block initializer, FlowEngine model
39
- │ ├── UserGuideBlock.tsx # Render HTML với DOMPurify
40
- │ ├── UserGuideManager.tsx # Trang quản lý CRUD
41
- │ ├── UserGuideBlockInitializer.tsx
42
- │ ├── UserGuideBlockProvider.tsx
43
- │ ├── schemas/
44
- │ │ └── spacesSchema.ts # UI schema cho bảng + form
45
- │ ├── components/
46
- │ │ ├── BuildButton.tsx # Nút Build với auto-refresh
47
- │ │ ├── LLMServiceSelect.tsx
48
- │ │ ├── ModelSelect.tsx
49
- │ │ └── StatusTag.tsx
50
- │ └── models/
51
- │ └── UserGuideBlockModel.ts # FlowEngine block model
52
- └── locale/
53
- ├── en-US.json
54
- ├── vi-VN.json
55
- └── zh-CN.json
56
- ```
57
-
58
- ## Dependencies
59
-
60
- | Package | Loại | Mục đích |
61
- |---------|------|----------|
62
- | `sanitize-html` | dependency | Sanitize HTML phía server |
63
- | `dompurify` | dependency | Sanitize HTML phía client |
64
- | `@nocobase/plugin-ai` | peerDependency | Kết nối LLM service |
65
- | `@nocobase/plugin-file-manager` | peerDependency | Đọc file đính kèm |
66
- | `@langchain/core` | peerDependency | Message types cho LLM |
67
- | `axios` | peerDependency | Fetch file từ URL |
68
-
69
- ## Cách sử dụng
70
-
71
- 1. Bật plugin trong Plugin Manager.
72
- 2. Vào **Settings → Build Guide Block** để tạo Space.
73
- 3. Chọn LLM Service, Model, upload tài liệu, nhấn **Build**.
74
- 4. Khi status = `completed`, vào trang bất kỳ → **Add Block → User Guide** → chọn Space.
1
+ # plugin-build-guide-block
2
+
3
+ ## Overview
4
+ Generate user guides, tutorials, and help books from documents using AI, then render the result as a block (HTML or Markdown).
5
+
6
+ ## Features
7
+ - **AI Processing**: Automatically convert raw manuals or requirements into structured guides.
8
+ - **Multi-format Rendering**: Display output beautifully as Markdown or HTML.
9
+ - **Chapter Navigation**: Supports multi-page or sectioned guides with internal table of contents.
10
+
11
+ ## Usage
12
+ 1. Enable the plugin in the Plugin Manager.
13
+ 2. Add a "Build Guide" block to a page.
14
+ 3. Upload source documents or provide prompts.
15
+ 4. Trigger the AI build phase to generate the content.
16
+ 5. Save and publish. The block will now display the formatted tutorial to end-users.