@ngvuhuy/promptglass 1.0.2 → 1.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/README.md CHANGED
@@ -13,6 +13,24 @@ and record the requests/responses.
13
13
  - Benchmark the LLM inference with input-heavy and output-heavy benchmark.
14
14
 
15
15
  ## Installation
16
+ This project requires Node.js v22.5 or newer
17
+ ### With npx
18
+ ```bash
19
+ npx @ngvuhuy/promptglass
20
+ ```
21
+ This will start both the proxy and the frontend on `localhost:3001`
22
+
23
+ ### With Docker
24
+ If you don't have Node installed, you can run Promptglass directly using Docker:
25
+ ```bash
26
+ docker run -it --rm \
27
+ -p 3001:3001 \
28
+ -v promptglass-data:/root/.promptglass \
29
+ node:24-slim \
30
+ npx -y @ngvuhuy/promptglass
31
+ ```
32
+
33
+ ### Local development
16
34
  ```bash
17
35
  git clone https://github.com/ngvuhuy/promptglass.git
18
36
  cd promptglass
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngvuhuy/promptglass",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -27,7 +27,6 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "axios": "^1.13.6",
30
- "better-sqlite3": "^12.8.0",
31
30
  "cors": "^2.8.6",
32
31
  "dotenv": "^17.3.1",
33
32
  "eventsource-parser": "^3.0.6",
@@ -1,6 +1,6 @@
1
- import Database from 'better-sqlite3';
1
+ import { DatabaseSync } from 'node:sqlite';
2
2
  import { Metrics, RequestMode, StoredRequest } from '../../shared/types.js';
3
- export declare function getDb(dbPath?: string): Database.Database;
3
+ export declare function getDb(dbPath?: string): DatabaseSync;
4
4
  export declare function saveRequest(mode: RequestMode, requestBody: any, responseBody?: any, metrics?: Metrics, contextHash?: string): number;
5
5
  export declare function updateRequest(id: number, responseBody: any, metrics?: Metrics): void;
6
6
  export declare function getRequests(limit?: number, offset?: number): StoredRequest[];
@@ -1,4 +1,4 @@
1
- import Database from 'better-sqlite3';
1
+ import { DatabaseSync } from 'node:sqlite';
2
2
  import path from 'node:path';
3
3
  import fs from 'node:fs';
4
4
  import os from 'node:os';
@@ -18,9 +18,9 @@ export function getDb(dbPath) {
18
18
  if (!fs.existsSync(dir)) {
19
19
  fs.mkdirSync(dir, { recursive: true });
20
20
  }
21
- db = new Database(resolvedPath);
22
- db.pragma('journal_mode = WAL');
23
- db.pragma('foreign_keys = ON');
21
+ db = new DatabaseSync(resolvedPath);
22
+ db.exec('PRAGMA journal_mode = WAL');
23
+ db.exec('PRAGMA foreign_keys = ON');
24
24
  initSchema(db);
25
25
  return db;
26
26
  }
@@ -30,7 +30,8 @@ export function getDb(dbPath) {
30
30
  }
31
31
  }
32
32
  function initSchema(db) {
33
- const setup = db.transaction(() => {
33
+ db.exec('BEGIN');
34
+ try {
34
35
  db.prepare(`
35
36
  CREATE TABLE IF NOT EXISTS requests (
36
37
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -48,8 +49,12 @@ function initSchema(db) {
48
49
  value TEXT NOT NULL
49
50
  );
50
51
  `).run();
51
- });
52
- setup();
52
+ db.exec('COMMIT');
53
+ }
54
+ catch (error) {
55
+ db.exec('ROLLBACK');
56
+ throw error;
57
+ }
53
58
  }
54
59
  export function saveRequest(mode, requestBody, responseBody, metrics, contextHash) {
55
60
  const db = getDb();
@@ -15,7 +15,6 @@
15
15
  "packageManager": "pnpm@10.28.2",
16
16
  "dependencies": {
17
17
  "axios": "^1.13.6",
18
- "better-sqlite3": "^12.8.0",
19
18
  "cors": "^2.8.6",
20
19
  "dotenv": "^17.3.1",
21
20
  "eventsource-parser": "^3.0.6",
@@ -23,7 +22,6 @@
23
22
  "zod": "^4.3.6"
24
23
  },
25
24
  "devDependencies": {
26
- "@types/better-sqlite3": "^7.6.13",
27
25
  "@types/cors": "^2.8.19",
28
26
  "@types/express": "^5.0.6",
29
27
  "@types/node": "^25.5.0",