chatluna-plugin-kb 0.2.8 → 0.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chatluna-plugin-kb",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "ChatLuna v2 knowledge base plugin: WeKnora REST tools, managed weknora-lite engine and WebUI install wizard",
5
5
  "type": "module",
6
6
  "main": "index.mjs",
@@ -16,6 +16,21 @@ export class PermissionError extends Error {
16
16
  }
17
17
  }
18
18
 
19
+ /** 调用参数缺失/自相矛盾:不是权限拒绝,模型可当场修正后重试。 */
20
+ export class InvalidArgumentError extends Error {
21
+ code = 'INVALID_ARGUMENT'
22
+
23
+ constructor(reason) {
24
+ super(`INVALID_ARGUMENT: ${String(reason ?? 'invalid argument')}`)
25
+ this.name = 'InvalidArgumentError'
26
+ }
27
+ }
28
+
29
+ /** @returns {InvalidArgumentError} */
30
+ export function invalid(reason) {
31
+ return new InvalidArgumentError(reason)
32
+ }
33
+
19
34
  /**
20
35
  * @param {string} reason 不含知识库名称/ID 的简短原因
21
36
  * @returns {PermissionError}
@@ -102,7 +117,11 @@ export async function resolveKbTarget({ requested, defaultKb, spec, client }) {
102
117
  if (typeof client?.listKbsRaw !== 'function') throw denied('knowledge base lookup unavailable')
103
118
  const raw = String(requested ?? '').trim()
104
119
  const target = raw === '' ? String(defaultKb ?? '').trim() : raw
105
- if (target === '') throw denied('no knowledge base specified')
120
+ if (target === '') {
121
+ throw invalid(
122
+ 'knowledge_base is required because this scope has no default KB; pass a KB id or name from list_kbs'
123
+ )
124
+ }
106
125
 
107
126
  let catalog
108
127
  try {
package/web/client.css CHANGED
@@ -17,7 +17,6 @@
17
17
  flex-shrink: 0;
18
18
  flex-direction: column;
19
19
  gap: 0.75rem;
20
- border-bottom: 1px solid var(--border);
21
20
  background: var(--glass-page, var(--background));
22
21
  padding: var(--page-gutter) var(--page-gutter) 0.75rem;
23
22
  }