@jungtz/wiki-router 1.5.0 → 1.5.1

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
@@ -46,7 +46,7 @@ const wiki = createWikiRouter({
46
46
 
47
47
  ;(async () => {
48
48
  await wiki.build() // 啟動時建構(指紋未變動會自動跳過)
49
- const ctx = await wiki.getContext('住宿規定?')
49
+ const ctx = await wiki.getContext('營業時間?')
50
50
  const persona = await wiki.getPersona() // build 完自動產出的角色設定
51
51
  console.log(persona)
52
52
  })()
@@ -107,8 +107,8 @@ const wiki = createTenantManager({
107
107
 
108
108
  ;(async () => {
109
109
  await wiki.buildAll() // 並行 build 所有 tenant
110
- const ctx = await wiki.getContext('問題', 'hotel-001') // 依 tenantId 取上下文
111
- const persona = await wiki.getPersona('hotel-001') // 自動產出的角色設定
110
+ const ctx = await wiki.getContext('問題', 'tenant-001') // 依 tenantId 取上下文
111
+ const persona = await wiki.getPersona('tenant-001') // 自動產出的角色設定
112
112
  })()
113
113
  ```
114
114
 
@@ -119,9 +119,9 @@ your-project/
119
119
  ├── data/
120
120
  │ └── wiki.db ← 自動建立(含 wiki_files / wiki_manifests / wiki_personas 三張表)
121
121
  └── knowledge/
122
- ├── hotel-001/
122
+ ├── tenant-001/
123
123
  │ └── base.json
124
- └── hotel-002/
124
+ └── tenant-002/
125
125
  └── base.json
126
126
  ```
127
127
 
@@ -168,12 +168,12 @@ app.post('/api/chat', async (req, res) => {
168
168
  const customSource = (tenantId) => ({
169
169
  async list() { return ['base.json'] },
170
170
  async read() {
171
- const res = await fetch(`https://api.example.com/hotels/${tenantId}/knowledge`)
171
+ const res = await fetch(`https://api.example.com/tenants/${tenantId}/knowledge`)
172
172
  return { type: 'json', content: await res.text() }
173
173
  },
174
174
  // 選用:用 ETag / updated_at 當指紋,比 sha256 整檔輕量
175
175
  async getFingerprint() {
176
- const res = await fetch(`https://api.example.com/hotels/${tenantId}/etag`)
176
+ const res = await fetch(`https://api.example.com/tenants/${tenantId}/etag`)
177
177
  return { 'base.json': await res.text() }
178
178
  },
179
179
  })
@@ -183,7 +183,7 @@ createTenantManager({
183
183
  source: customSource,
184
184
  store: tid => sqliteStore({ db, tenantId: tid }), // 仍用 SQLite 儲 wiki
185
185
  listTenants: async () => {
186
- const res = await fetch('https://api.example.com/hotels')
186
+ const res = await fetch('https://api.example.com/tenants')
187
187
  return (await res.json()).map(h => String(h.id))
188
188
  },
189
189
  })
package/dist/index.cjs CHANGED
@@ -541,7 +541,7 @@ function createWikiRouter(config) {
541
541
  *
542
542
  * 用法:
543
543
  * import { sqliteStore } from '@jungtz/wiki-router'
544
- * const store = sqliteStore({ db, tenantId: 'hotel-001' })
544
+ * const store = sqliteStore({ db, tenantId: 'tenant-001' })
545
545
  *
546
546
  * 不直接相依 better-sqlite3;只要傳入的 db 物件支援 prepare(sql) 與 exec(sql) 即可。
547
547
  */
package/dist/index.mjs CHANGED
@@ -539,7 +539,7 @@ function createWikiRouter(config) {
539
539
  *
540
540
  * 用法:
541
541
  * import { sqliteStore } from '@jungtz/wiki-router'
542
- * const store = sqliteStore({ db, tenantId: 'hotel-001' })
542
+ * const store = sqliteStore({ db, tenantId: 'tenant-001' })
543
543
  *
544
544
  * 不直接相依 better-sqlite3;只要傳入的 db 物件支援 prepare(sql) 與 exec(sql) 即可。
545
545
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jungtz/wiki-router",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "LLM Wiki 知識庫路由引擎 - 將結構化知識轉為 Markdown 維基,智慧路由查詢",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -39,6 +39,7 @@
39
39
  "lint:fix": "eslint src/ --fix",
40
40
  "format": "prettier --write src/",
41
41
  "typecheck": "tsc --noEmit --skipLibCheck",
42
+ "prepare": "git config core.hooksPath .githooks 2>/dev/null || true",
42
43
  "prepublishOnly": "npm run build:prod",
43
44
  "release": "npm version patch && git push origin master",
44
45
  "bump:patch": "node scripts/bump-version.js patch",