cloving 0.3.0 → 0.3.2
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/commands/config.js
CHANGED
|
@@ -66,23 +66,25 @@ const config = async () => {
|
|
|
66
66
|
message: `Do you trust ${selectedModel} with sensitive information?`,
|
|
67
67
|
default: false,
|
|
68
68
|
});
|
|
69
|
-
const temperature = await (0, prompts_1.
|
|
69
|
+
const temperature = await (0, prompts_1.input)({
|
|
70
70
|
message: `Enter the temperature for ${selectedModel} (0.0 - 1.0): [0.2]`,
|
|
71
|
-
default: 0.2,
|
|
71
|
+
default: '0.2',
|
|
72
72
|
validate: (value) => {
|
|
73
|
-
|
|
73
|
+
const num = parseFloat(value);
|
|
74
|
+
if (isNaN(num) || num < 0 || num > 1) {
|
|
74
75
|
return 'Please enter a valid number between 0.0 and 1.0.';
|
|
75
76
|
}
|
|
76
77
|
return true;
|
|
77
78
|
},
|
|
78
|
-
})
|
|
79
|
+
});
|
|
80
|
+
const parsedTemperature = parseFloat(temperature);
|
|
79
81
|
const modelConfig = {
|
|
80
82
|
apiKey,
|
|
81
83
|
primary,
|
|
82
84
|
priority: parseInt(priority, 10),
|
|
83
85
|
silent: !review,
|
|
84
86
|
trust,
|
|
85
|
-
temperature,
|
|
87
|
+
temperature: parsedTemperature,
|
|
86
88
|
};
|
|
87
89
|
currentConfig.models[provider][model] = modelConfig;
|
|
88
90
|
if (primary) {
|
|
@@ -313,6 +313,11 @@ class ChatManager {
|
|
|
313
313
|
try {
|
|
314
314
|
this.contextFiles = await (0, command_utils_1.addFileOrDirectoryToContext)(filePath, this.contextFiles, this.options);
|
|
315
315
|
console.log(`\nAdded ${colors_1.default.bold(colors_1.default.green(filePath))} to this chat session's context`);
|
|
316
|
+
// Update the chat history with the new context
|
|
317
|
+
const updatedSystemPrompt = (0, command_utils_1.generateCodegenPrompt)(this.contextFiles);
|
|
318
|
+
this.chatHistory[0] = { role: 'user', content: updatedSystemPrompt };
|
|
319
|
+
// Log the update
|
|
320
|
+
console.log(colors_1.default.yellow(`Updated chat context with new file(s)`));
|
|
316
321
|
}
|
|
317
322
|
catch (error) {
|
|
318
323
|
console.error(`Failed to add ${colors_1.default.bold(colors_1.default.red(filePath))} to this chat session's context:`, error);
|
|
@@ -323,6 +328,10 @@ class ChatManager {
|
|
|
323
328
|
}
|
|
324
329
|
this.rl.prompt();
|
|
325
330
|
}
|
|
331
|
+
refreshContext() {
|
|
332
|
+
const updatedSystemPrompt = (0, command_utils_1.generateCodegenPrompt)(this.contextFiles);
|
|
333
|
+
this.chatHistory[0] = { role: 'user', content: updatedSystemPrompt };
|
|
334
|
+
}
|
|
326
335
|
isRemoveCommand(command) {
|
|
327
336
|
return command.startsWith('rm ');
|
|
328
337
|
}
|
|
@@ -461,6 +470,7 @@ class ChatManager {
|
|
|
461
470
|
this.isProcessing = true;
|
|
462
471
|
this.chunkManager = new ChunkManager_1.default();
|
|
463
472
|
try {
|
|
473
|
+
this.refreshContext(); // make sure the context is up-to-date
|
|
464
474
|
this.initializeChatHistory(input);
|
|
465
475
|
this.prompt = this.generatePrompt(input);
|
|
466
476
|
const responseStream = await this.gpt.streamText({ prompt: this.prompt, messages: this.chatHistory });
|
package/dist/package.json
CHANGED
|
@@ -22,6 +22,15 @@ const getConfig = (options) => {
|
|
|
22
22
|
if (options.silent) {
|
|
23
23
|
config.globalSilent = true;
|
|
24
24
|
}
|
|
25
|
+
// Parse temperature to float if it exists in the config
|
|
26
|
+
for (const provider in config.models) {
|
|
27
|
+
for (const model in config.models[provider]) {
|
|
28
|
+
if (config.models[provider][model].temperature !== undefined) {
|
|
29
|
+
const temp = config.models[provider][model].temperature;
|
|
30
|
+
config.models[provider][model].temperature = typeof temp === 'string' ? parseFloat(temp) : temp;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
25
34
|
return config;
|
|
26
35
|
}
|
|
27
36
|
}
|