@ganziliang/kb 0.1.2 → 0.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/dist/cli.d.ts +1 -1
- package/dist/cli.js +10 -3
- package/dist/entry.d.ts +1 -0
- package/dist/entry.js +9 -0
- package/package.json +2 -2
package/dist/cli.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export
|
|
2
|
+
export declare function main(): Promise<void>;
|
package/dist/cli.js
CHANGED
|
@@ -6,10 +6,18 @@ import { mkdirSync } from "node:fs";
|
|
|
6
6
|
import { ensureModelConfig, saveModels } from "./config.js";
|
|
7
7
|
import { Agent, fetchTransport } from "./model.js";
|
|
8
8
|
import { copyOriginal, defaultDataRoot, ensureKnowledgeBase, KnowledgeStore, readLocalFile, listKnowledgeBases, deleteKnowledgeBase, backupKnowledgeBase, restoreKnowledgeBase } from "./storage.js";
|
|
9
|
+
const banner = [
|
|
10
|
+
" _ __ ____ ",
|
|
11
|
+
" | |/ // __ ) ",
|
|
12
|
+
" | // __ | ",
|
|
13
|
+
" | |/ /_/ / ",
|
|
14
|
+
" |_|\\_\\____/ ",
|
|
15
|
+
" Welcome to KB Knowledge Base",
|
|
16
|
+
];
|
|
9
17
|
function App({ config, root, knowledgeBase }) {
|
|
10
18
|
const { exit } = useApp();
|
|
11
19
|
const [input, setInput] = useState("");
|
|
12
|
-
const [lines, setLines] = useState([
|
|
20
|
+
const [lines, setLines] = useState([...banner, `knowledge base: ${knowledgeBase.name}`, "Type a question, or /help."]);
|
|
13
21
|
const [busy, setBusy] = useState(false);
|
|
14
22
|
const [messages, setMessages] = useState([]);
|
|
15
23
|
const [modelIndex, setModelIndex] = useState(0);
|
|
@@ -162,7 +170,7 @@ async function ingestOrAsk(value, store, modelConfig, previous) {
|
|
|
162
170
|
const agent = new Agent(store, modelConfig, fetchTransport);
|
|
163
171
|
return agent.answer(`Answer only from the local knowledge below. If it is insufficient, say no knowledge was found. Include source filename and version.\n\n${context}\n\nQuestion: ${value}`, previous);
|
|
164
172
|
}
|
|
165
|
-
async function main() {
|
|
173
|
+
export async function main() {
|
|
166
174
|
const root = defaultDataRoot();
|
|
167
175
|
mkdirSync(root, { recursive: true });
|
|
168
176
|
const knowledgeRoot = root;
|
|
@@ -170,4 +178,3 @@ async function main() {
|
|
|
170
178
|
const configs = await ensureModelConfig();
|
|
171
179
|
render(_jsx(App, { config: configs, root: knowledgeRoot, knowledgeBase: base }));
|
|
172
180
|
}
|
|
173
|
-
void main();
|
package/dist/entry.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/entry.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Install the warning filter before loading node:sqlite through the CLI module.
|
|
2
|
+
process.on("warning", (warning) => {
|
|
3
|
+
if (warning.name === "ExperimentalWarning" && /SQLite/i.test(warning.message))
|
|
4
|
+
return;
|
|
5
|
+
console.warn(warning.stack ?? warning.message);
|
|
6
|
+
});
|
|
7
|
+
const { main } = await import("./cli.js");
|
|
8
|
+
await main();
|
|
9
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ganziliang/kb",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Local knowledge base agent CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"kb": "dist/
|
|
7
|
+
"kb": "dist/entry.js"
|
|
8
8
|
},
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"types": "dist/index.d.ts",
|