loz 0.2.13 → 0.3.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 +73 -11
- package/dist/config/index.js +3 -3
- package/dist/config/index.js.map +1 -1
- package/dist/constant.js +6 -0
- package/dist/constant.js.map +1 -0
- package/dist/git/index.js +55 -63
- package/dist/git/index.js.map +1 -1
- package/dist/git/test.js +2 -0
- package/dist/git/test.js.map +1 -0
- package/dist/history/index.js +53 -2
- package/dist/history/index.js.map +1 -1
- package/dist/history/test.js +57 -0
- package/dist/history/test.js.map +1 -0
- package/dist/index.js +110 -381
- package/dist/index.js.map +1 -1
- package/dist/llm/index.js +10 -15
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/test.js +86 -0
- package/dist/llm/test.js.map +1 -0
- package/dist/loz.js +415 -0
- package/dist/loz.js.map +1 -0
- package/dist/prompt/index.js +67 -0
- package/dist/prompt/index.js.map +1 -0
- package/dist/prompt/test.js +59 -0
- package/dist/prompt/test.js.map +1 -0
- package/dist/utils/index.js +75 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +9 -11
- package/bin/index.js +0 -3
- package/dist/cli.js +0 -118
- package/dist/cli.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
# Loz [](https://www.npmjs.com/package/loz)
|
|
2
|
+
|
|
2
3
|

|
|
3
4
|
|
|
4
|
-
Loz is a command-line tool that enables your preferred LLM to utilize Unix pipes, integrating AI capabilities with other Unix tools.
|
|
5
|
+
Loz is a command-line tool that enables your preferred LLM to execute system commands and utilize Unix pipes, integrating AI capabilities with other Unix tools.
|
|
5
6
|
|
|
6
7
|
## What's New
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
### v0.3.1 - 2024-03-18
|
|
8
10
|
- **Added**
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
+
- Git commit log files are now stored in .loz_log within each Git repository where Loz is executed.
|
|
12
|
+
- The ability to enable/disable appending 'generated by ${model name}' at the end of the Git commit message by running config attribution true or config attribution false.
|
|
13
|
+
- Added --attribution (-a) runtime argument to override the config attribution setting. The original attribution value stored remains unchanged.
|
|
14
|
+
|
|
15
|
+
### v0.3.0 - 2024-02-24
|
|
16
|
+
|
|
11
17
|
- **Added**
|
|
12
|
-
-
|
|
13
|
-
|
|
18
|
+
- Run Linux commands based on user prompts. Users can now execute Linux commands using natural language. For example, by running `loz "find the largest file in the current directory"`,
|
|
19
|
+
`Loz` will interpret the instruction and execute the corresponding Linux commands like `find . -type f -exec ls -l {} + | sort -k 5 -nr | head -n 1` to find the largest file. See more [examples](#examples).
|
|
20
|
+
|
|
21
|
+
### v0.2.13 - 2024-02-22
|
|
22
|
+
|
|
14
23
|
- **Added**
|
|
15
|
-
-
|
|
24
|
+
- Enhanced Git Commit Formatting: Commit messages are now structured with a clear separation between the title and body, improving readability and adherence to Git best practices.
|
|
16
25
|
|
|
17
26
|
## Getting Started
|
|
18
27
|
|
|
@@ -41,6 +50,7 @@ $ ./install.sh
|
|
|
41
50
|
Loz supports [OpenAI API](https://platform.openai.com/docs/quickstart?context=node) and [Ollama](https://github.com/ollama/ollama) so you can switch between these LLM services easily, using the `config` command in the interactive mode.
|
|
42
51
|
|
|
43
52
|
### Set up Ollama
|
|
53
|
+
|
|
44
54
|
To utilize Ollama on your local system, you'll need to install both llama2 and codellama models. Here's how you can do it on a Linux system:
|
|
45
55
|
|
|
46
56
|
```
|
|
@@ -89,18 +99,21 @@ Choose your LLM service: (ollama, openai)
|
|
|
89
99
|
```
|
|
90
100
|
|
|
91
101
|
You can modify your LLM service preference at any time by using the `config` command in the interactive mode:
|
|
102
|
+
|
|
92
103
|
```
|
|
93
104
|
> config api openai
|
|
94
105
|
```
|
|
95
106
|
|
|
96
107
|
Additionally, you can change the model by entering:
|
|
108
|
+
|
|
97
109
|
```
|
|
98
110
|
> config model llama2
|
|
99
111
|
```
|
|
112
|
+
|
|
100
113
|
or
|
|
101
114
|
|
|
102
115
|
```
|
|
103
|
-
> config model
|
|
116
|
+
> config model codellama
|
|
104
117
|
```
|
|
105
118
|
|
|
106
119
|
You can check the current settings by entering:
|
|
@@ -111,7 +124,7 @@ You can check the current settings by entering:
|
|
|
111
124
|
model: llama2
|
|
112
125
|
```
|
|
113
126
|
|
|
114
|
-
Currently, gpt-3.5-turbo
|
|
127
|
+
Currently, gpt-3.5-turbo and all models provided by Ollama are supported.
|
|
115
128
|
|
|
116
129
|
### Interactive mode
|
|
117
130
|
|
|
@@ -121,6 +134,55 @@ $ loz
|
|
|
121
134
|
|
|
122
135
|
Once loz is running, you can start a conversation by interacting with it. loz will respond with a relevant message based on the input.
|
|
123
136
|
|
|
137
|
+
### Run Linux Commands with Loz
|
|
138
|
+
|
|
139
|
+
Loz empowers users to execute Linux commands using natural language. Below are some examples demonstrating how `loz`'s LLM backend translates natural language into Linux commands:
|
|
140
|
+
|
|
141
|
+
#### Examples
|
|
142
|
+
|
|
143
|
+
- Find the largest file in the current directory:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
loz "find the largest file in the current directory"
|
|
147
|
+
-rw-rw-r-- 1 foo bar 9020257 Jan 31 19:49 ./node_modules/typescript/lib/typescript.js
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
- Check if Apache2 is running:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
loz "check if apache2 is running on this system"
|
|
154
|
+
● apache2.service - The Apache HTTP Server
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
- Detect GPUs on the system:
|
|
158
|
+
```
|
|
159
|
+
loz "Detect GPUs on this system"
|
|
160
|
+
00:02.0 VGA compatible controller: Intel Corporation Device a780 (rev 04)
|
|
161
|
+
```
|
|
162
|
+
For your information, this feature has only been tested with the OpenAI API.
|
|
163
|
+
|
|
164
|
+
#### Caution
|
|
165
|
+
|
|
166
|
+
To prevent unintentional system modifications, avoid running commands that can alter or remove system files or configurations, such as `rm`, `mv`, `rmdir`, or `mkfs`.
|
|
167
|
+
|
|
168
|
+
#### Safe Mode
|
|
169
|
+
|
|
170
|
+
To enhance security and avoid unintended command execution, loz can be run in Safe Mode. When activated, this mode requires user confirmation before executing any Linux command.
|
|
171
|
+
|
|
172
|
+
Activate Safe Mode by setting the LOZ_SAFE=true environment variable:
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
LOZ_SAFE=true loz "Check available memory on this system"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Upon execution, loz will prompt:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
Do you want to run this command?: free -h (y/n)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Respond with 'y' to execute the command or 'n' to cancel. This feature ensures that you have full control over the commands executed, preventing accidental changes or data loss.
|
|
185
|
+
|
|
124
186
|
### Pipe mode
|
|
125
187
|
|
|
126
188
|
Loz is capable of processing input from other command-line tools by utilizing a Unix pipe.
|
|
@@ -153,7 +215,7 @@ $ ls -l | loz "convert the input to JSON"
|
|
|
153
215
|
[
|
|
154
216
|
{
|
|
155
217
|
"permissions": "-rw-r--r--",
|
|
156
|
-
"owner": "
|
|
218
|
+
"owner": "foo",
|
|
157
219
|
"group": "staff",
|
|
158
220
|
"size": 792,
|
|
159
221
|
"date": "Mar 1 21:02",
|
|
@@ -161,7 +223,7 @@ $ ls -l | loz "convert the input to JSON"
|
|
|
161
223
|
},
|
|
162
224
|
{
|
|
163
225
|
"permissions": "-rw-r--r--",
|
|
164
|
-
"owner": "
|
|
226
|
+
"owner": "foo",
|
|
165
227
|
"group": "staff",
|
|
166
228
|
"size": 4427,
|
|
167
229
|
"date": "Mar 1 20:43",
|
package/dist/config/index.js
CHANGED
|
@@ -147,9 +147,9 @@ class Config {
|
|
|
147
147
|
this.save();
|
|
148
148
|
return false;
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
for (
|
|
150
|
+
const rawData = fs.readFileSync(this.configFilePath);
|
|
151
|
+
const config = JSON.parse(rawData);
|
|
152
|
+
for (const item of config.items) {
|
|
153
153
|
this.set(item.name, item.value);
|
|
154
154
|
}
|
|
155
155
|
return true;
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yBAAyB;AACzB,6BAA6B;AAC7B,sDAAsD;AAEzC,QAAA,oBAAoB,GAAG,QAAQ,CAAC;AAChC,QAAA,oBAAoB,GAAG,eAAe,CAAC;AAWpD,MAAa,UAAU;IAIrB,YAAY,IAAY,EAAE,KAAa;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AARD,gCAQC;AAEM,MAAM,aAAa,GAAG,CAC3B,EAA8B,EACb,EAAE;IACnB,KAAK,MAAM,GAAG,IAAI,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,EAAE,CAAC;QAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,gBAAgB,GAAG,MAAM,EAAE,CAAC,QAAQ,CACxC,KAAK,GAAG,gEAAgE,CACzE,CAAC;YACF,IAAI,gBAAgB,CAAC,WAAW,EAAE,KAAK,GAAG,EAAE,CAAC;gBAC3C,OAAO,KAAK,CAAC;YACf,CAAC;YACD,IAAI,gBAAgB,CAAC,WAAW,EAAE,KAAK,GAAG,EAAE,CAAC;gBAC3C,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;gBAC5D,OAAO,MAAM,IAAA,qBAAa,EAAC,EAAE,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC,CAAC;IACnE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,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C;gBACtB,EAAE,CAAC,KAAK,EAAE,CAAC;gBAEX,IAAI,CAAC,IAAI,EAAE,CAAC;gBAEZ,OAAO,KAAK,CAAC;YACf,CAAC;YACD,MAAM,OAAO,GAAQ,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC1D,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAEnC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;gBAChC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAClC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAEM,IAAI;QACT,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC3C,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;CACF;AA5HD,wBA4HC"}
|
package/dist/constant.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LOG_DEV_PATH = exports.DEBUG = void 0;
|
|
4
|
+
exports.DEBUG = process.env.LOZ_DEBUG === "true" ? true : false;
|
|
5
|
+
exports.LOG_DEV_PATH = ".loz_logs";
|
|
6
|
+
//# sourceMappingURL=constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../src/constant.ts"],"names":[],"mappings":";;;AAAa,QAAA,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AACxD,QAAA,YAAY,GAAG,WAAW,CAAC"}
|
package/dist/git/index.js
CHANGED
|
@@ -1,84 +1,76 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.Git = void 0;
|
|
13
4
|
const child_process_1 = require("child_process");
|
|
14
|
-
// Define a class for the git commands
|
|
15
|
-
// Path: src/git/index.ts
|
|
16
|
-
// generated by copilot
|
|
17
5
|
class Git {
|
|
18
|
-
// Define a method to get the diff
|
|
19
|
-
// Path: src/git/index.ts
|
|
20
|
-
// generated by copilot
|
|
21
6
|
getDiffFromStaged() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
7
|
+
// Run a Git diff --staged command
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
|
+
(0, child_process_1.exec)("git diff --staged", (error, stdout, stderr) => {
|
|
10
|
+
if (error) {
|
|
11
|
+
console.error(`Error: ${error.message}`);
|
|
12
|
+
reject(error.message);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (stderr) {
|
|
16
|
+
console.error(`Stderr: ${stderr}`);
|
|
17
|
+
reject(stderr);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
resolve(stdout);
|
|
33
21
|
});
|
|
34
22
|
});
|
|
35
23
|
}
|
|
36
24
|
commit(message) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
25
|
+
// Sanitize the message to avoid command injection
|
|
26
|
+
const sanitizedMessage = message.replace(/`/g, "\\`").replace(/"/g, '\\"');
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
(0, child_process_1.exec)(`git commit -m "${sanitizedMessage}"`, (error, stdout, stderr) => {
|
|
29
|
+
if (error) {
|
|
30
|
+
console.error(`Error: ${error.message}`);
|
|
31
|
+
reject(error.message);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (stderr) {
|
|
35
|
+
console.error(`Stderr: ${stderr}`);
|
|
36
|
+
reject(stderr);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
resolve(stdout);
|
|
50
40
|
});
|
|
51
41
|
});
|
|
52
42
|
}
|
|
53
43
|
commitAmend() {
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
(0, child_process_1.exec)("git commit --amend", (error, stdout, stderr) => {
|
|
46
|
+
if (error) {
|
|
47
|
+
console.error(`Error: ${error.message}`);
|
|
48
|
+
reject(error.message);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (stderr) {
|
|
52
|
+
console.error(`Stderr: ${stderr}`);
|
|
53
|
+
reject(stderr);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
resolve(stdout);
|
|
64
57
|
});
|
|
65
58
|
});
|
|
66
59
|
}
|
|
67
60
|
showHEAD() {
|
|
68
|
-
return
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
(0, child_process_1.exec)("git show HEAD", (error, stdout, stderr) => {
|
|
63
|
+
if (error) {
|
|
64
|
+
console.error(`Error: ${error.message}`);
|
|
65
|
+
reject(error.message);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (stderr) {
|
|
69
|
+
console.error(`Stderr: ${stderr}`);
|
|
70
|
+
reject(stderr);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
resolve(stdout);
|
|
82
74
|
});
|
|
83
75
|
});
|
|
84
76
|
}
|
package/dist/git/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/git/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/git/index.ts"],"names":[],"mappings":";;;AAAA,iDAAqC;AAErC,MAAa,GAAG;IACP,iBAAiB;QACtB,kCAAkC;QAClC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAA,oBAAI,EACF,mBAAmB,EACnB,CAAC,KAAmB,EAAE,MAAc,EAAE,MAAc,EAAE,EAAE;gBACtD,IAAI,KAAK,EAAE,CAAC;oBACV,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;oBACzC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;oBACtB,OAAO;gBACT,CAAC;gBACD,IAAI,MAAM,EAAE,CAAC;oBACX,OAAO,CAAC,KAAK,CAAC,WAAW,MAAM,EAAE,CAAC,CAAC;oBACnC,MAAM,CAAC,MAAM,CAAC,CAAC;oBACf,OAAO;gBAC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oBACX,OAAO,CAAC,KAAK,CAAC,WAAW,MAAM,EAAE,CAAC,CAAC;oBACnC,MAAM,CAAC,MAAM,CAAC,CAAC;oBACf,OAAO;gBACT,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAA,oBAAI,EACF,eAAe,EACf,CAAC,KAAmB,EAAE,MAAc,EAAE,MAAc,EAAE,EAAE;gBACtD,IAAI,KAAK,EAAE,CAAC;oBACV,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;oBACzC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;oBACtB,OAAO;gBACT,CAAC;gBACD,IAAI,MAAM,EAAE,CAAC;oBACX,OAAO,CAAC,KAAK,CAAC,WAAW,MAAM,EAAE,CAAC,CAAC;oBACnC,MAAM,CAAC,MAAM,CAAC,CAAC;oBACf,OAAO;gBACT,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAxFD,kBAwFC"}
|
package/dist/git/test.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/git/test.ts"],"names":[],"mappings":""}
|
package/dist/history/index.js
CHANGED
|
@@ -1,12 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PromptAndAnswer = void 0;
|
|
12
|
+
exports.ChatHistoryManager = exports.PromptAndAnswer = void 0;
|
|
13
|
+
// npx mocha -r ts-node/register src/history/test.ts
|
|
14
|
+
const fs = require("fs");
|
|
15
|
+
const path = require("path");
|
|
16
|
+
const constant_1 = require("../constant");
|
|
4
17
|
class PromptAndAnswer {
|
|
5
|
-
constructor(mode, prompt, answer) {
|
|
18
|
+
constructor(mode, model, prompt, answer) {
|
|
6
19
|
this.mode = mode;
|
|
20
|
+
this.model = model;
|
|
7
21
|
this.prompt = prompt;
|
|
8
22
|
this.answer = answer;
|
|
9
23
|
}
|
|
10
24
|
}
|
|
11
25
|
exports.PromptAndAnswer = PromptAndAnswer;
|
|
26
|
+
class ChatHistoryManager {
|
|
27
|
+
constructor(configPath) {
|
|
28
|
+
this.configPath = configPath;
|
|
29
|
+
this.chatHistory = {
|
|
30
|
+
date: "",
|
|
31
|
+
dialogue: [],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
addChat(chat) {
|
|
35
|
+
this.chatHistory.dialogue.push(chat);
|
|
36
|
+
}
|
|
37
|
+
// Save chat history (JSON) to file.
|
|
38
|
+
saveChatHistory() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const date = new Date();
|
|
41
|
+
const fileName = date.getFullYear() +
|
|
42
|
+
"-" +
|
|
43
|
+
(date.getMonth() + 1) +
|
|
44
|
+
"-" +
|
|
45
|
+
date.getDate() +
|
|
46
|
+
"-" +
|
|
47
|
+
date.getHours() +
|
|
48
|
+
"-" +
|
|
49
|
+
date.getMinutes() +
|
|
50
|
+
"-" +
|
|
51
|
+
date.getSeconds() +
|
|
52
|
+
".json";
|
|
53
|
+
const filePath = path.join(this.configPath, fileName);
|
|
54
|
+
this.chatHistory.date = date.toString();
|
|
55
|
+
const json = JSON.stringify(this.chatHistory, null, 2);
|
|
56
|
+
if (constant_1.DEBUG)
|
|
57
|
+
console.log("Saving chat history to " + filePath);
|
|
58
|
+
fs.writeFileSync(filePath, json);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.ChatHistoryManager = ChatHistoryManager;
|
|
12
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/history/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/history/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAoD;AACpD,yBAAyB;AACzB,6BAA6B;AAE7B,0CAAoC;AAcpC,MAAa,eAAe;IAM1B,YAAY,IAAY,EAAE,KAAa,EAAE,MAAc,EAAE,MAAc;QACrE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAZD,0CAYC;AAED,MAAa,kBAAkB;IAI7B,YAAY,UAAkB;QAC5B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG;YACjB,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE,EAAE;SACb,CAAC;IACJ,CAAC;IAEM,OAAO,CAAC,IAAqB;QAClC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,oCAAoC;IACvB,eAAe;;YAC1B,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YAExB,MAAM,QAAQ,GACZ,IAAI,CAAC,WAAW,EAAE;gBAClB,GAAG;gBACH,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;gBACrB,GAAG;gBACH,IAAI,CAAC,OAAO,EAAE;gBACd,GAAG;gBACH,IAAI,CAAC,QAAQ,EAAE;gBACf,GAAG;gBACH,IAAI,CAAC,UAAU,EAAE;gBACjB,GAAG;gBACH,IAAI,CAAC,UAAU,EAAE;gBACjB,OAAO,CAAC;YACV,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YACtD,IAAI,CAAC,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YACxC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YACvD,IAAI,gBAAK;gBAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,GAAG,QAAQ,CAAC,CAAC;YAC7D,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC;KAAA;CACF;AAvCD,gDAuCC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
// npx mocha -r ts-node/register src/history/test.ts
|
|
13
|
+
const chai_1 = require("chai");
|
|
14
|
+
const _1 = require(".");
|
|
15
|
+
const fs = require("fs");
|
|
16
|
+
const path = require("path");
|
|
17
|
+
describe("ChatHistoryManager", () => {
|
|
18
|
+
describe("addChat and saveChatHistory", () => {
|
|
19
|
+
const testConfigPath = "testConfigPath";
|
|
20
|
+
let chatHistoryManager;
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
// Setup a new ChatHistoryManager and create test directory before each test
|
|
23
|
+
chatHistoryManager = new _1.ChatHistoryManager(testConfigPath);
|
|
24
|
+
if (!fs.existsSync(testConfigPath)) {
|
|
25
|
+
fs.mkdirSync(testConfigPath);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
// Cleanup: remove the created test directory and its contents after each test
|
|
30
|
+
if (fs.existsSync(testConfigPath)) {
|
|
31
|
+
fs.readdirSync(testConfigPath).forEach((file) => {
|
|
32
|
+
const curPath = path.join(testConfigPath, file);
|
|
33
|
+
fs.unlinkSync(curPath);
|
|
34
|
+
});
|
|
35
|
+
fs.rmdirSync(testConfigPath);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
it("should add a chat and save the chat history", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
const chat = new _1.PromptAndAnswer("mode1", "openai", "prompt1", "answer1");
|
|
40
|
+
chatHistoryManager.addChat(chat);
|
|
41
|
+
yield chatHistoryManager.saveChatHistory();
|
|
42
|
+
// Check if the file was created
|
|
43
|
+
const files = fs.readdirSync(testConfigPath);
|
|
44
|
+
(0, chai_1.expect)(files.length).to.equal(1);
|
|
45
|
+
// Read the file and check its content
|
|
46
|
+
const savedData = JSON.parse(fs.readFileSync(path.join(testConfigPath, files[0]), "utf8"));
|
|
47
|
+
(0, chai_1.expect)(savedData.dialogue.length).to.equal(1);
|
|
48
|
+
(0, chai_1.expect)(savedData.dialogue[0]).to.deep.equal({
|
|
49
|
+
mode: "mode1",
|
|
50
|
+
model: "openai",
|
|
51
|
+
prompt: "prompt1",
|
|
52
|
+
answer: "answer1",
|
|
53
|
+
});
|
|
54
|
+
}));
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/history/test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,oDAAoD;AACpD,+BAA8B;AAC9B,wBAAwD;AACxD,yBAAyB;AACzB,6BAA6B;AAE7B,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;QAC3C,MAAM,cAAc,GAAG,gBAAgB,CAAC;QACxC,IAAI,kBAAsC,CAAC;QAE3C,UAAU,CAAC,GAAG,EAAE;YACd,4EAA4E;YAC5E,kBAAkB,GAAG,IAAI,qBAAkB,CAAC,cAAc,CAAC,CAAC;YAC5D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;gBACnC,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,SAAS,CAAC,GAAG,EAAE;YACb,8EAA8E;YAC9E,IAAI,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;gBAClC,EAAE,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;oBAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;oBAChD,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBACzB,CAAC,CAAC,CAAC;gBACH,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;YAC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