@linkmind_claw/openclaw-faq-kb 2.0.3 → 3.1.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.
- package/dist/index.d.ts +7 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +659 -315
- package/dist/index.js.map +1 -1
- package/dist/lib/api-client.d.ts +23 -39
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +54 -97
- package/dist/lib/api-client.js.map +1 -1
- package/dist/tools/account-manage.d.ts +5 -7
- package/dist/tools/account-manage.d.ts.map +1 -1
- package/dist/tools/account-manage.js +104 -70
- package/dist/tools/account-manage.js.map +1 -1
- package/dist/tools/account-register.d.ts +12 -5
- package/dist/tools/account-register.d.ts.map +1 -1
- package/dist/tools/account-register.js +51 -28
- package/dist/tools/account-register.js.map +1 -1
- package/dist/tools/query-kb.d.ts +4 -5
- package/dist/tools/query-kb.d.ts.map +1 -1
- package/dist/tools/query-kb.js +11 -37
- package/dist/tools/query-kb.js.map +1 -1
- package/package.json +3 -3
- package/skills/faq-kb/SKILL.md +146 -42
- package/linkmind_claw-openclaw-faq-kb-1.0.6.tgz +0 -0
- package/linkmind_claw-openclaw-faq-kb-1.1.0.tgz +0 -0
- package/linkmind_claw-openclaw-faq-kb-1.2.0.tgz +0 -0
- package/linkmind_claw-openclaw-faq-kb-1.3.1.tgz +0 -0
- package/linkmind_claw-openclaw-faq-kb-1.3.2.tgz +0 -0
- package/linkmind_claw-openclaw-faq-kb-1.3.3.tgz +0 -0
- package/linkmind_claw-openclaw-faq-kb-1.4.0.tgz +0 -0
- package/linkmind_claw-openclaw-faq-kb-2.0.0.tgz +0 -0
- package/linkmind_claw-openclaw-faq-kb-2.0.1.tgz +0 -0
- package/linkmind_claw-openclaw-faq-kb-2.0.2.tgz +0 -0
package/skills/faq-kb/SKILL.md
CHANGED
|
@@ -1,69 +1,173 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: faq-knowledge-base
|
|
3
|
-
description:
|
|
3
|
+
description: FAQ 知识库 — 社媒用户注册、权限管理、文档训练、智能问答
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# FAQ Knowledge Base Skill
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
You have access to a FAQ Knowledge Base system with **user identity & permission management** that lets you:
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
1. **Register / login** social-media channel users (Telegram, Discord, etc.)
|
|
11
|
+
2. **Manage permissions** — grant roles and knowledge base access
|
|
12
|
+
3. **Create & train** a knowledge base from a document (PDF/DOCX/TXT/MD)
|
|
13
|
+
4. **Ask questions** against a trained knowledge base
|
|
14
|
+
5. **Browse knowledge bases** — list accessible KBs
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
- 管理员通过 Telegram user ID 绑定
|
|
14
|
-
- 管理员拥有全部权限:创建/训练/删除知识库、管理用户权限
|
|
15
|
-
- 其他用户只能查询管理员开放给他的知识库 + 公开知识库
|
|
16
|
+
## Permission Model
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
```
|
|
19
|
+
Role │ Capabilities
|
|
20
|
+
────────────┼──────────────────────────────────
|
|
21
|
+
viewer │ Query knowledge bases, list KBs
|
|
22
|
+
editor │ + Create KB, train, manage FAQ
|
|
23
|
+
reviewer │ + Delete FAQ, view audit logs
|
|
24
|
+
admin │ + Delete KB, manage users, grant roles
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- New users from social-media channels default to **viewer** (query-only).
|
|
28
|
+
- The Bot Owner (first admin) can promote users via `faq_account_manage`.
|
|
29
|
+
- `kb_scope` controls which KBs a user can access (null = all).
|
|
30
|
+
|
|
31
|
+
## Available Tools
|
|
32
|
+
|
|
33
|
+
### `faq_account_register`
|
|
34
|
+
|
|
35
|
+
Auto-register or login a social-media channel user.
|
|
36
|
+
|
|
37
|
+
**When to use:**
|
|
38
|
+
- A new user interacts with the bot for the first time
|
|
39
|
+
- You need to establish the user's identity before other operations
|
|
40
|
+
- The user explicitly asks to register or log in
|
|
41
|
+
|
|
42
|
+
**Parameters:**
|
|
43
|
+
- `channel_type` (required): telegram / discord / slack / web / whatsapp / line
|
|
44
|
+
- `channel_user_id` (required): The user's unique ID on that platform
|
|
45
|
+
- `channel_bot_id` (optional): Bot identifier (default "default")
|
|
46
|
+
- `display_name` (optional): User display name
|
|
47
|
+
- `role` (optional): Initial role for new users (default "viewer")
|
|
48
|
+
|
|
49
|
+
**Notes:**
|
|
50
|
+
- Returns `is_new: true` for first-time users with a freshly generated `api_key`
|
|
51
|
+
- The API Key is automatically cached; all subsequent requests use this user's identity
|
|
52
|
+
- Existing users just get their current identity info (no new key)
|
|
53
|
+
|
|
54
|
+
### `faq_account_manage`
|
|
55
|
+
|
|
56
|
+
Admin-level account management.
|
|
57
|
+
|
|
58
|
+
**When to use:**
|
|
59
|
+
- Bot Owner wants to promote a user: "让用户 X 也能建库"
|
|
60
|
+
- Admin wants to see who's registered: "看看都有谁在用"
|
|
61
|
+
- User wants to check their own permissions: "我能做什么"
|
|
62
|
+
|
|
63
|
+
**Parameters:**
|
|
64
|
+
- `action` (required): `grant_role` / `list_users` / `my_info`
|
|
65
|
+
- `target_channel_user_id`: Required for `grant_role`
|
|
66
|
+
- `target_channel_type`: Channel type of the target (default "telegram")
|
|
67
|
+
- `role`: The role to grant (required for `grant_role`)
|
|
68
|
+
- `kb_scope`: Array of KB IDs the user can access (null = all)
|
|
69
|
+
|
|
70
|
+
**Notes:**
|
|
71
|
+
- `grant_role` and `list_users` require **admin** permission
|
|
72
|
+
- `my_info` works for any authenticated user
|
|
73
|
+
|
|
74
|
+
### `faq_kb_create_and_train`
|
|
75
|
+
|
|
76
|
+
One-click knowledge base creation + full training pipeline.
|
|
18
77
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
78
|
+
**When to use:**
|
|
79
|
+
- User says "create a knowledge base from this document"
|
|
80
|
+
- User provides a file URL and wants to set up a Q&A system
|
|
22
81
|
|
|
23
|
-
|
|
82
|
+
**Parameters:**
|
|
83
|
+
- `kb_name` (required): Name for the knowledge base
|
|
84
|
+
- `file_url` (required): URL to the document (PDF/DOCX/DOC/TXT/MD)
|
|
85
|
+
- `description` (optional): Description
|
|
86
|
+
- `tag_name` (optional): Tag for categorization
|
|
24
87
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
| `/linkmind_me` | 查看身份信息 | 任何人 |
|
|
30
|
-
| `/linkmind_create <名称> <URL>` | 创建知识库并训练 | 仅管理员 |
|
|
31
|
-
| `/linkmind_query <名称> <问题>` | 知识库问答 | 任何人 |
|
|
32
|
-
| `/linkmind_share <KB名> <用户ID> <角色>` | 管理 KB 权限 | 仅管理员 |
|
|
33
|
-
| `/linkmind_list` | 列出可访问的知识库 | 任何人 |
|
|
88
|
+
**Notes:**
|
|
89
|
+
- Requires **editor** or above permission
|
|
90
|
+
- Runs 2-10 minutes; polls progress internally
|
|
91
|
+
- Returns `kb_id` for subsequent queries
|
|
34
92
|
|
|
35
|
-
###
|
|
93
|
+
### `faq_kb_query`
|
|
94
|
+
|
|
95
|
+
Ask a question against a trained knowledge base.
|
|
96
|
+
|
|
97
|
+
**When to use:**
|
|
98
|
+
- User asks a question and you know which KB to query
|
|
99
|
+
- User says "search the knowledge base for..."
|
|
100
|
+
|
|
101
|
+
**Parameters:**
|
|
102
|
+
- `kb_id` (required): Knowledge base ID
|
|
103
|
+
- `question` (required): The question
|
|
104
|
+
- `enable_polish` (optional): LLM-polished multi-FAQ answer
|
|
105
|
+
- `user_id`, `session_id` (optional): For tracking
|
|
106
|
+
|
|
107
|
+
**Notes:**
|
|
108
|
+
- Requires **viewer** or above permission
|
|
109
|
+
- KB must be trained (is_active=true)
|
|
110
|
+
|
|
111
|
+
### `faq_kb_list`
|
|
112
|
+
|
|
113
|
+
List accessible knowledge bases.
|
|
114
|
+
|
|
115
|
+
**When to use:**
|
|
116
|
+
- User asks "what knowledge bases do I have?"
|
|
117
|
+
- You need to find a kb_id before querying
|
|
118
|
+
|
|
119
|
+
**Parameters:**
|
|
120
|
+
- `keyword` (optional): Search by name
|
|
121
|
+
- `tag_name` (optional): Filter by tag
|
|
122
|
+
- `page`, `page_size` (optional): Pagination
|
|
123
|
+
|
|
124
|
+
## Typical Workflows
|
|
125
|
+
|
|
126
|
+
### Workflow 1: First-time user (social media)
|
|
36
127
|
|
|
37
128
|
```
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
129
|
+
1. faq_account_register(channel_type="telegram", channel_user_id="12345")
|
|
130
|
+
→ registers as viewer, API Key cached
|
|
131
|
+
2. faq_kb_list()
|
|
132
|
+
→ shows available knowledge bases
|
|
133
|
+
3. faq_kb_query(kb_id="...", question="...")
|
|
134
|
+
→ gets answer
|
|
41
135
|
```
|
|
42
136
|
|
|
43
|
-
|
|
137
|
+
### Workflow 2: Bot Owner sets up a new KB
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
1. faq_account_register(channel_type="telegram", channel_user_id="owner_id", role="admin")
|
|
141
|
+
→ registers as admin
|
|
142
|
+
2. faq_kb_create_and_train(kb_name="客服FAQ", file_url="https://...")
|
|
143
|
+
→ creates and trains KB, returns kb_id
|
|
144
|
+
3. faq_kb_query(kb_id="...", question="退款政策是什么?")
|
|
145
|
+
→ verifies the KB works
|
|
146
|
+
```
|
|
44
147
|
|
|
45
|
-
###
|
|
148
|
+
### Workflow 3: Owner grants access to a friend
|
|
46
149
|
|
|
47
150
|
```
|
|
48
|
-
1.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
151
|
+
1. (Friend) faq_account_register(channel_type="telegram", channel_user_id="friend_id")
|
|
152
|
+
→ friend registers as viewer
|
|
153
|
+
2. (Owner) faq_account_manage(action="grant_role",
|
|
154
|
+
target_channel_user_id="friend_id", role="editor", kb_scope=["kb_abc"])
|
|
155
|
+
→ friend can now create/edit in kb_abc
|
|
53
156
|
```
|
|
54
157
|
|
|
55
|
-
###
|
|
158
|
+
### Workflow 4: Check permissions when denied
|
|
56
159
|
|
|
57
160
|
```
|
|
58
|
-
1.
|
|
59
|
-
2.
|
|
60
|
-
|
|
161
|
+
1. User tries faq_kb_create_and_train → gets permission error
|
|
162
|
+
2. faq_account_manage(action="my_info")
|
|
163
|
+
→ shows role=viewer, can only read
|
|
164
|
+
3. Tell user: "你当前是 viewer 角色,只能查询。请联系管理员提升权限。"
|
|
61
165
|
```
|
|
62
166
|
|
|
63
167
|
## Important Notes
|
|
64
168
|
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
169
|
+
- **Always register first**: Before any KB operation, ensure the user has an identity via `faq_account_register`.
|
|
170
|
+
- **Permission errors**: When a 403 error occurs, guide the user to check their role or contact the admin.
|
|
171
|
+
- **KB IDs are UUIDs**: e.g., `a1b2c3d4-e5f6-...`
|
|
172
|
+
- **API server**: `67.212.146.21:8999` by default.
|
|
173
|
+
- The `faq_kb_create_and_train` tool is long-running (minutes). Be patient.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|