interintel 1.0.15 → 1.0.17

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
@@ -1,6 +1,6 @@
1
1
  ## INTERINTEL
2
2
 
3
- The application `inter-intel` 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 GPTs for now.
3
+ 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 GPTs for now.
4
4
 
5
5
  Here's a brief overview of the main functionalities, as contained in the index.js file:
6
6
 
@@ -14,8 +14,8 @@ Here's a brief overview of the main functionalities, as contained in the index.j
14
14
  - If a user types '//writefile', the application prompts the user to provide a name for the file and then a prompt for the AI. It then automatically generates some text (by communicating with OpenAI's GPT-3 model), writes this to a file and stores it in the application's directory.
15
15
 
16
16
  ### //readRefs
17
- - If a user writes '//readRefs', the application reads the content of the specified files in the inter-intel.config.js (in the current implementation) and uses this as part of the conversation with the AI.
18
- - So as you work on your project and files change or you move to other parts of the code base you can adjust where inter-intel points and what is referenced by AI conversation.
17
+ - If a user writes '//readRefs', the application reads the content of the specified files in the interintel.config.js (in the current implementation) and uses this as part of the conversation with the AI.
18
+ - So as you work on your project and files change or you move to other parts of the code base you can adjust where interintel points and what is referenced by AI conversation.
19
19
 
20
20
  ### everything else
21
21
  - For all user inputs outside of these special keywords, the chat conversation is simply updated with the user's message and a call is made to the OpenAI API to generate the AI's response. This is then displayed on the console.
@@ -24,7 +24,6 @@ The application relies heavily on async-await pattern for handling the asynchron
24
24
 
25
25
  Keep in mind that this is a high level overview and each functionality has its own level of implementation detail.
26
26
 
27
-
28
27
  File Structure
29
28
 
30
29
  project/
@@ -35,5 +34,5 @@ project/
35
34
  │ ├── messageUtils.js
36
35
  │ ├── writeFileHandler.js
37
36
  │ └── readRefsHandler.js
38
- ├── inter-intel.config.js
37
+ ├── interintel.config.js
39
38
  └── index.js
@@ -1,32 +1,57 @@
1
- const path = require('path')
1
+ const path = require('path');
2
2
  const { aiChatCompletion } = require('./openai-functions.js');
3
3
  const { writeFileFromPrompt } = require('./file-functions.js');
4
4
  const configPath = path.join(process.cwd(), 'interintel.config.js');
5
5
  const config = require(configPath);
6
6
 
7
-
8
7
  async function handleWriteFile(openai, config, messages, currentState, userInput, promptFileName) {
9
8
  let contentToWrite = '';
10
9
 
11
10
  if (currentState === null) {
12
11
  currentState = 'awaitingFileName';
13
- return { currentState, messages, promptFileName, response: 'Please provide a name for the session file:' };
12
+ return {
13
+ currentState,
14
+ messages,
15
+ promptFileName,
16
+ response: 'Please provide a name for the session file:',
17
+ };
14
18
  } else if (currentState === 'awaitingFileName') {
15
19
  promptFileName = userInput;
16
20
  currentState = 'awaitingGPTPrompt';
17
- return { currentState, messages, promptFileName, response: `Please provide a prompt for ${config.aiVersion}:` };
21
+ return {
22
+ currentState,
23
+ messages,
24
+ promptFileName,
25
+ response: `Please provide a prompt for ${config.aiVersion}:`,
26
+ };
18
27
  } else if (currentState === 'awaitingGPTPrompt') {
19
28
  const promptForGPT = userInput;
20
29
  try {
21
- let gptResponse = await aiChatCompletion(openai, [{ role: 'user', content: promptForGPT }], config.aiVersion);
30
+ let gptResponse = await aiChatCompletion(
31
+ openai,
32
+ [{ role: 'user', content: promptForGPT }],
33
+ config.aiVersion
34
+ );
22
35
  contentToWrite = gptResponse.choices[0].message.content;
23
36
  await writeFileFromPrompt(promptFileName, contentToWrite, __dirname); // Assuming this function handles file writing
24
37
 
25
38
  currentState = null; // Reset state after completing the operation
26
- return { currentState, messages, promptFileName, contentToWrite, response: `Content written to ${promptFileName}`.yellow };
39
+ return {
40
+ currentState,
41
+ messages,
42
+ promptFileName,
43
+ contentToWrite,
44
+ response: `Content written to ${promptFileName}`.yellow,
45
+ };
27
46
  } catch (error) {
28
47
  console.error('Error in handleWriteFile:', error);
29
- return { currentState, messages, promptFileName, contentToWrite, response: 'An error occurred while writing the file.' };
48
+ return {
49
+ currentState,
50
+ messages,
51
+ promptFileName,
52
+ contentToWrite,
53
+ response: 'An error occurred while writing the file.',
54
+ };
30
55
  }
31
56
  }
32
57
 
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.15",
9
+ "version": "1.0.17",
10
10
  "main": "index.js",
11
11
  "directories": {
12
12
  "doc": "docs"
@@ -5,7 +5,7 @@ const config = {
5
5
  // only open ai models for now
6
6
  aiVersion: `ONLY_USE_OPENAI_MODEL`,
7
7
  // These filepaths are relative to where your config is created
8
- filePaths: ['interintelReadMe.md'],
8
+ filePaths: ['interintel/interintelReadMe.md'],
9
9
  };
10
10
 
11
11
  module.exports = config;
package/setup.js CHANGED
@@ -3,10 +3,10 @@ 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, '../resources/interintel.config.template.js');
6
+ const templatePath = path.join(__dirname, '/resources/interintel.config.template.js');
7
7
 
8
8
  const readMePath = path.join('../../interintelReadMe.md');
9
- const readMeTemplate = path.join(__dirname, '../resources/README.md');
9
+ const readMeTemplate = path.join(__dirname, '/interintel/README.md');
10
10
 
11
11
  try {
12
12
  if (!fs.existsSync(configPath)) {
@@ -14,15 +14,25 @@ try {
14
14
  fs.copyFileSync(templatePath, configPath);
15
15
  console.log('Interintel config created. Please update it with your settings.'.yellow);
16
16
 
17
- console.log('Config file does not exist, creating...');
17
+ } else {
18
+ console.log('Interintel config file already exists.');
19
+ }
20
+ } catch (error) {
21
+ console.error('Error occurred during setup:', error);
22
+ }
23
+
24
+
25
+ try {
26
+ if (!fs.existsSync(readMePath)) {
27
+ console.log('Readme file does not exist, creating...');
18
28
  fs.copyFileSync(readMeTemplate, readMePath);
19
29
  console.log('Interintel readme created. Please update it with your settings.'.yellow);
20
30
 
21
31
  } else {
22
- console.log('Interintel config file already exists.');
32
+ console.log('Interintel readme file already exists.');
23
33
  }
24
34
  } catch (error) {
25
35
  console.error('Error occurred during setup:', error);
26
36
  }
27
37
 
28
- console.log("Finished setup.js script.");
38
+ console.log("Finished running setup.js script.");