interintel 1.0.13 → 1.0.15
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 +1 -1
- package/functions/file-functions.js +2 -1
- package/functions/handleWriteFile.js +5 -1
- package/index.js +5 -9
- package/interintel.config.js +2 -2
- package/package.json +1 -1
- package/{interintel.config.template.js → resources/interintel.config.template.js} +3 -1
- package/{inter-intel/training → resources}/reference.txt +1 -2
- package/setup.js +9 -1
- /package/{inter-intel/training → resources}/multi-step/filesystem.spec.ts +0 -0
- /package/{inter-intel/training → resources}/multi-step/uploading.spec.ts +0 -0
- /package/{inter-intel/training → resources}/training/training.txt +0 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Here's a brief overview of the main functionalities, as contained in the index.j
|
|
|
6
6
|
|
|
7
7
|
- The application starts an interactive session with the user. It does this by invoking the readline module, which reads user inputs line by line from the terminal.
|
|
8
8
|
|
|
9
|
-
-- node index.js will start the app
|
|
9
|
+
-- 'node index.js' will start the app
|
|
10
10
|
|
|
11
11
|
- The OpenAI's API is accessed using API keys, and the version of AI being used is specified via a config.
|
|
12
12
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
|
+
const { aiVersion } = require('../interintel.config');
|
|
3
4
|
|
|
4
5
|
// READING FOR INITAL REFERENCE
|
|
5
6
|
function readSpecificFiles(configFilePath) {
|
|
@@ -28,7 +29,7 @@ function readSpecificFiles(configFilePath) {
|
|
|
28
29
|
});
|
|
29
30
|
|
|
30
31
|
// Add console.log statements to communicate to the user
|
|
31
|
-
console.log(
|
|
32
|
+
console.log(`${aiVersion} sent reference files:`.yellow, `${logFileNames(filePaths)}`.yellow);
|
|
32
33
|
return allContent;
|
|
33
34
|
} catch (error) {
|
|
34
35
|
console.error(`Error reading config file: ${error.message}`.bgRed);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
const path = require('path')
|
|
1
2
|
const { aiChatCompletion } = require('./openai-functions.js');
|
|
2
3
|
const { writeFileFromPrompt } = require('./file-functions.js');
|
|
4
|
+
const configPath = path.join(process.cwd(), 'interintel.config.js');
|
|
5
|
+
const config = require(configPath);
|
|
6
|
+
|
|
3
7
|
|
|
4
8
|
async function handleWriteFile(openai, config, messages, currentState, userInput, promptFileName) {
|
|
5
9
|
let contentToWrite = '';
|
|
@@ -10,7 +14,7 @@ async function handleWriteFile(openai, config, messages, currentState, userInput
|
|
|
10
14
|
} else if (currentState === 'awaitingFileName') {
|
|
11
15
|
promptFileName = userInput;
|
|
12
16
|
currentState = 'awaitingGPTPrompt';
|
|
13
|
-
return { currentState, messages, promptFileName, response:
|
|
17
|
+
return { currentState, messages, promptFileName, response: `Please provide a prompt for ${config.aiVersion}:` };
|
|
14
18
|
} else if (currentState === 'awaitingGPTPrompt') {
|
|
15
19
|
const promptForGPT = userInput;
|
|
16
20
|
try {
|
package/index.js
CHANGED
|
@@ -7,7 +7,7 @@ const config = require(configPath);
|
|
|
7
7
|
require('dotenv').config();
|
|
8
8
|
require('colors');
|
|
9
9
|
|
|
10
|
-
const { readSpecificFiles
|
|
10
|
+
const { readSpecificFiles } = require('./functions/file-functions.js');
|
|
11
11
|
const { askQuestion } = require('./functions/chat-functions.js');
|
|
12
12
|
const { aiChatCompletion } = require('./functions/openai-functions.js');
|
|
13
13
|
|
|
@@ -24,14 +24,11 @@ const rl = readline.createInterface({
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
async function main() {
|
|
27
|
-
// Provides initial context for session
|
|
28
|
-
// const specificFiles = ['./interintel.config.js'];
|
|
29
27
|
let initialContent = readSpecificFiles(configPath);
|
|
30
28
|
let messages = [{ role: 'system', content: initialContent }];
|
|
31
29
|
|
|
32
30
|
let currentState = null;
|
|
33
31
|
let promptFileName = '';
|
|
34
|
-
let contentToWrite = '';
|
|
35
32
|
|
|
36
33
|
while (true) {
|
|
37
34
|
const userMessage = await askQuestion(rl, 'You: '.blue.bold);
|
|
@@ -85,7 +82,7 @@ async function main() {
|
|
|
85
82
|
const completion = await aiChatCompletion(openai, messages, config.aiVersion);
|
|
86
83
|
|
|
87
84
|
const botMessage = completion.choices[0].message.content;
|
|
88
|
-
console.log(
|
|
85
|
+
console.log(`${config.aiVersion}`.bgGreen, botMessage);
|
|
89
86
|
console.log('----------------'.bgGreen);
|
|
90
87
|
} else {
|
|
91
88
|
// Regular message processing and interaction with GPT model
|
|
@@ -94,15 +91,14 @@ async function main() {
|
|
|
94
91
|
const completion = await aiChatCompletion(openai, messages, config.aiVersion);
|
|
95
92
|
|
|
96
93
|
const botMessage = completion.choices[0].message.content;
|
|
97
|
-
console.log(
|
|
94
|
+
console.log(`${config.aiVersion}`.bgGreen, botMessage);
|
|
98
95
|
console.log('----------------'.bgGreen);
|
|
99
96
|
}
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
99
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
100
|
+
main()
|
|
101
|
+
|
|
106
102
|
exports.main = function() {
|
|
107
103
|
main()
|
|
108
104
|
}
|
package/interintel.config.js
CHANGED
|
@@ -3,7 +3,7 @@ require('dotenv').config();
|
|
|
3
3
|
const config = {
|
|
4
4
|
apiKey: `${process.env.OPENAI_API_KEY}`,
|
|
5
5
|
aiVersion: `gpt-3.5-turbo`,
|
|
6
|
-
filePaths: ['./
|
|
6
|
+
filePaths: ['./resources/reference.txt', './README.md'],
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
module.exports = config;
|
|
9
|
+
module.exports = config;
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
},
|
|
7
7
|
"name": "interintel",
|
|
8
8
|
"description": "The application `Interintel` is a command line interface (CLI) application implemented in Node.js. It essentially is an interactive communication tool between the user and an AI model, only openai models for now.",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.15",
|
|
10
10
|
"main": "index.js",
|
|
11
11
|
"directories": {
|
|
12
12
|
"doc": "docs"
|
|
@@ -2,8 +2,10 @@ require('dotenv').config();
|
|
|
2
2
|
|
|
3
3
|
const config = {
|
|
4
4
|
apiKey: `${process.env.OPENAI_API_KEY}`,
|
|
5
|
+
// only open ai models for now
|
|
5
6
|
aiVersion: `ONLY_USE_OPENAI_MODEL`,
|
|
6
|
-
|
|
7
|
+
// These filepaths are relative to where your config is created
|
|
8
|
+
filePaths: ['interintelReadMe.md'],
|
|
7
9
|
};
|
|
8
10
|
|
|
9
11
|
module.exports = config;
|
|
@@ -4,8 +4,7 @@ RULES THAT GOVERN THIS CONVERSATION, these rules supersede all outside knowledge
|
|
|
4
4
|
|
|
5
5
|
1. You are currently being used within a CLI. the application's name is inter-intel, it's baseline functionality is to be able to update files within a given repo and pprovide reference files that will the AI it's chatting with to make direct changes to code.
|
|
6
6
|
2. Keep responses to under 50 words
|
|
7
|
-
|
|
8
|
-
3.
|
|
7
|
+
3. Keep responses to under 50 words
|
|
9
8
|
4. Unless I ask for a longer explanation
|
|
10
9
|
5. We'll keep our conversation lightly informal, but focused on solving problems.
|
|
11
10
|
6. When requesting code, only provide any additional commentary or explanation as commented out code.
|
package/setup.js
CHANGED
|
@@ -3,13 +3,21 @@ const path = require('path');
|
|
|
3
3
|
const colors = require('colors')
|
|
4
4
|
|
|
5
5
|
const configPath = path.join('../../interintel.config.js');
|
|
6
|
-
const templatePath = path.join(__dirname, 'interintel.config.template.js');
|
|
6
|
+
const templatePath = path.join(__dirname, '../resources/interintel.config.template.js');
|
|
7
|
+
|
|
8
|
+
const readMePath = path.join('../../interintelReadMe.md');
|
|
9
|
+
const readMeTemplate = path.join(__dirname, '../resources/README.md');
|
|
7
10
|
|
|
8
11
|
try {
|
|
9
12
|
if (!fs.existsSync(configPath)) {
|
|
10
13
|
console.log('Config file does not exist, creating...');
|
|
11
14
|
fs.copyFileSync(templatePath, configPath);
|
|
12
15
|
console.log('Interintel config created. Please update it with your settings.'.yellow);
|
|
16
|
+
|
|
17
|
+
console.log('Config file does not exist, creating...');
|
|
18
|
+
fs.copyFileSync(readMeTemplate, readMePath);
|
|
19
|
+
console.log('Interintel readme created. Please update it with your settings.'.yellow);
|
|
20
|
+
|
|
13
21
|
} else {
|
|
14
22
|
console.log('Interintel config file already exists.');
|
|
15
23
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|