-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(prompting): prompt without any input files and specify prompts w…
…ithin a file
- Loading branch information
1 parent
845eb10
commit 69e0a61
Showing
6 changed files
with
127 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
Take the code from each file sent and produce a comprehensive response in markdown format explaining the code. | ||
|
||
## Structure Requirements: | ||
- Start with a level 1 heading (#) that serves as an appropriate title for the document. This title should not be "README.md". | ||
- Create a level 2 heading (##) titled "Project Structure" to outline the directory structure of the project in a tree format. | ||
- For each file sent, provide a separate level 2 heading (##) with the file name (do not include the relative path). | ||
- Under each file heading, give a detailed explanation of the file's purpose and functionality, including code snippets where relevant. | ||
|
||
## Explanation Requirements: | ||
- Refer to code snippets from the provided files to illustrate your explanations. | ||
- Ensure the explanation is clear, concise, and uses semantic markdown headings to separate different sections and concepts. | ||
- If the file is a script or module, explain the key functions, classes, or exports it contains. | ||
- If there are any dependencies or connections between the files, explain them under the appropriate headings. | ||
|
||
## Example Output: | ||
\`\`\`markdown | ||
# Appropriate Title for the Document | ||
|
||
## Project Structure | ||
\` | ||
├── src | ||
│ ├── ai_models | ||
│ │ └── geminiModels.js | ||
│ ├── commanderProgram.js | ||
│ ├── getFileContent.js | ||
│ ├── ai.js | ||
│ ├── defaultPrompt.js | ||
│ └── _gr.js | ||
\` | ||
|
||
## ai_models/geminiModels.js | ||
Explanation of the contents of geminiModels.js, including key functions, classes, and usage examples. | ||
|
||
## commanderProgram.js | ||
Explanation of commanderProgram.js, highlighting its role in the project, key functionality, and any important code snippets. | ||
|
||
... (continue for each file) | ||
\`\`\` | ||
|
||
Ensure that the markdown uses the appropriate level of headings and references relevant code snippets for clarity. | ||
|
||
--- | ||
|
||
In addition to following the rules above, please look out for the following with regards to the files I'm about to send you. | ||
|
||
I'd like you to help me create the appropriate associations for the models within my `models` folder. | ||
|
||
I also believe that the names of each table's columns in my `_db-scripts/init.sql` need to match what I have listed in my models. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// src/option_handlers/handleNoFilesOption.js | ||
|
||
import chalk from 'chalk'; | ||
import ora from 'ora'; | ||
import path from 'path'; | ||
|
||
import getFileContent from '../file_functions/getFileContent.js'; | ||
import getTOMLFileValues from '../file_functions/getTOMLFileValues.js'; | ||
import promptAI from '../ai.js'; | ||
import defaultPrompt from '../defaultPrompt.js'; | ||
|
||
export default async function handleNoFilesOption(options) { | ||
const toml = getTOMLFileValues(); | ||
|
||
let prompt; | ||
|
||
// Check if both -p and -pf are used | ||
if (options.prompt && options.promptFile) { | ||
console.error(chalk.red("Error: Cannot use both '-p' and '-pf' options simultaneously.")); | ||
process.exit(1); | ||
} | ||
|
||
if (options.promptFile) { | ||
const promptFilePath = path.resolve(process.cwd(), options.promptFile); | ||
try { | ||
prompt = getFileContent(promptFilePath); | ||
} catch (error) { | ||
console.error(chalk.red(`Error reading prompt file: ${error.message}`)); | ||
process.exit(1); | ||
} | ||
} else if (options.prompt) { | ||
prompt = options.prompt || defaultPrompt; | ||
} | ||
|
||
const model = options.model || toml?.preferences.MODEL || process.env.MODEL || 'gemini-1.5-flash'; | ||
const outputFile = options.outputFile || toml?.OUTPUT_FILE || process.env.OUTPUT_FILE || null; | ||
const temperature = | ||
options.temperature || toml?.preferences.TEMPERATURE || process.env.TEMPERATURE || 0.5; | ||
const needToken = options.token || toml?.TOKEN || false; | ||
|
||
console.log(chalk.blue('Sending prompt to the model...')); | ||
|
||
const spinner = ora(` Waiting for a response from the ${chalk.blue(model)} model...\n`).start(); | ||
|
||
try { | ||
await promptAI(prompt, model, temperature, outputFile, needToken); | ||
spinner.succeed(` Response received from ${chalk.blue(model)} model`); | ||
} catch (error) { | ||
spinner.fail(` Failed to receive response from ${chalk.red(model)} model`); | ||
console.error(error); | ||
process.exit(1); | ||
} | ||
|
||
process.exit(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters