mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-25 17:54:34 +08:00
fix(cli): declare sqlite-vec and @huggingface/transformers as runtime dependencies
The CLI tsup build inlines @openchatlab/node-runtime into dist chunks. Both sqlite-vec and @huggingface/transformers load platform-specific native packages at runtime (sqlite-vec-linux-arm64, onnxruntime-node, sharp), so inlining them breaks global/npm and Docker installs of chatlab-cli: the bundled chunks reference native packages that were never installed, and configuring the semantic index vector model fails with HTTP 500 (Cannot find package 'sqlite-vec-linux-arm64'). Declare both packages as chatlab-cli dependencies and mark them as tsup external so they are installed from npm with their native bindings, matching how better-sqlite3 and @node-rs/jieba are already handled.
This commit is contained in:
1 parent
982f37ced6
commit
d48745f00b
3 files changed
+11
-1
No files matched your search
@@ -50,6 +50,7 @@
|
|||||||
"@fastify/static": "^9.1.3",
|
"@fastify/static": "^9.1.3",
|
||||||
"@earendil-works/pi-agent-core": "0.74.2",
|
"@earendil-works/pi-agent-core": "0.74.2",
|
||||||
"@earendil-works/pi-ai": "0.74.2",
|
"@earendil-works/pi-ai": "0.74.2",
|
||||||
|
"@huggingface/transformers": "^4.2.0",
|
||||||
"@modelcontextprotocol/sdk": "^1.12.1",
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
||||||
"better-sqlite3": "^12.4.6",
|
"better-sqlite3": "^12.4.6",
|
||||||
"commander": "^13.1.0",
|
"commander": "^13.1.0",
|
||||||
@@ -57,6 +58,7 @@
|
|||||||
"gray-matter": "^4.0.3",
|
"gray-matter": "^4.0.3",
|
||||||
"js-tiktoken": "^1.0.21",
|
"js-tiktoken": "^1.0.21",
|
||||||
"smol-toml": "^1.3.1",
|
"smol-toml": "^1.3.1",
|
||||||
|
"sqlite-vec": "^0.1.9",
|
||||||
"stream-json": "^1.9.1",
|
"stream-json": "^1.9.1",
|
||||||
"zod": "^3.24.4"
|
"zod": "^3.24.4"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ export default defineConfig({
|
|||||||
noExternal: [/^@openchatlab\/(?!parser-native)/, 'chatlab-mcp', 'stream-json'],
|
noExternal: [/^@openchatlab\/(?!parser-native)/, 'chatlab-mcp', 'stream-json'],
|
||||||
// parser-native 是本地构建的可选 Rust 内核:不打包也不声明依赖,
|
// parser-native 是本地构建的可选 Rust 内核:不打包也不声明依赖,
|
||||||
// 运行时 require 失败会自动回退 TS 解析器。
|
// 运行时 require 失败会自动回退 TS 解析器。
|
||||||
external: ['better-sqlite3', '@node-rs/jieba', '@openchatlab/parser-native'],
|
// sqlite-vec / @huggingface/transformers 依赖按平台分发的原生包(sqlite-vec-*、onnxruntime-node、sharp),
|
||||||
|
// 必须作为真实依赖随 npm 安装,不能内联进 bundle
|
||||||
|
external: ['better-sqlite3', '@node-rs/jieba', 'sqlite-vec', '@huggingface/transformers', '@openchatlab/parser-native'],
|
||||||
banner: {
|
banner: {
|
||||||
js: [
|
js: [
|
||||||
"import { createRequire as __createRequire } from 'module';",
|
"import { createRequire as __createRequire } from 'module';",
|
||||||
|
|||||||
Generated
+6
@@ -162,6 +162,9 @@ importers:
|
|||||||
'@fastify/static':
|
'@fastify/static':
|
||||||
specifier: ^9.1.3
|
specifier: ^9.1.3
|
||||||
version: 9.1.3
|
version: 9.1.3
|
||||||
|
'@huggingface/transformers':
|
||||||
|
specifier: ^4.2.0
|
||||||
|
version: 4.2.0
|
||||||
'@modelcontextprotocol/sdk':
|
'@modelcontextprotocol/sdk':
|
||||||
specifier: ^1.12.1
|
specifier: ^1.12.1
|
||||||
version: 1.29.0(zod@3.25.76)
|
version: 1.29.0(zod@3.25.76)
|
||||||
@@ -183,6 +186,9 @@ importers:
|
|||||||
smol-toml:
|
smol-toml:
|
||||||
specifier: ^1.3.1
|
specifier: ^1.3.1
|
||||||
version: 1.6.1
|
version: 1.6.1
|
||||||
|
sqlite-vec:
|
||||||
|
specifier: ^0.1.9
|
||||||
|
version: 0.1.9
|
||||||
stream-json:
|
stream-json:
|
||||||
specifier: ^1.9.1
|
specifier: ^1.9.1
|
||||||
version: 1.9.1
|
version: 1.9.1
|
||||||
|
|||||||
Reference in new issue
Block a user