Skip to content

Commit b21226e

Browse files
committed
- added draft support for user instructions
1 parent d3c4ab1 commit b21226e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

index.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,15 @@ marked.setOptions({
6767
});
6868
const action_or_question = await general.queryLLM('# Is the following text an action or a question?\n'+argv.input,
6969
z.object({
70-
is_action: z.boolean().describe('True if the input is an action, False if the input is a question'),
71-
is_question: z.boolean().describe('True if the input is a question, True if the input is a question'),
70+
type_of: z.enum(['action','question','instruction']).describe('Type of the input'),
71+
//is_action: z.boolean().describe('True if the input is an action, False if the input is a question'),
72+
//is_question: z.boolean().describe('True if the input is a question, True if the input is a question'),
7273
language: z.enum(['English','Spanish','Portuguese','French','Japanese']).describe('language of the given input'),
7374
})
7475
);
7576
console.log('is action or question?',action_or_question.data);
7677
// 1) if the input is an action, select the best action template from the availables and run it
77-
if (action_or_question.data.is_action) {
78+
if (action_or_question.data.type_of === 'action') {
7879
const user_action = new actionsIndex(argv.input);
7980
const prompt = await user_action.getPrompt();
8081
// declare methods for js code blocks
@@ -159,7 +160,7 @@ marked.setOptions({
159160
}
160161
}
161162
//
162-
} else if (action_or_question.data.is_question) {
163+
} else if (action_or_question.data.type_of === 'question' || action_or_question.data.type_of === 'instruction') {
163164
// 2) if the input is a question, run the question to the model with the 'default-template' and return the response
164165
const question = new code2prompt({
165166
path: currentWorkingDirectory,
@@ -168,7 +169,11 @@ marked.setOptions({
168169
ignore: ["**/node_modules/**","**/*.png","**/*.jpg","**/*.gif","**/package-lock.json","**/.env","**/.gitignore","**/LICENSE"],
169170
OPENAI_KEY: process.env.OPENAI_KEY
170171
});
171-
const response = await question.request(`# Act as a friendly and expert file analyst with 20 years of experience in several programming languages. Analyze the provided codebase sourcetree and files, determine the functionality and then using that info answer the following user question using markdown syntax, nice formatting (emoji's,tables,titles) in a friendly tone using short sentences (max 60 chars per line, avoiding word wrapping). Always reply the specific question asked using the provided context and codebase references and nothing else:\n${argv.input}`);
172+
let prompt_ = `# Act as a friendly and expert generalist analyst with 20 years of experience in several programming languages. Analyze the provided codebase sourcetree and files, determine the functionality and then using that info alongside the sourcetree and code sources, answer the following user question in detail, using markdown syntax, nice formatting (emoji's,tables,titles) in a friendly tone using short sentences (max 60 chars per line, avoiding word wrapping). Always reply the specific question asked using the provided context and codebase references and nothing else:\n${argv.input}`;
173+
if (action_or_question.data.type_of === 'instruction') {
174+
prompt_ = `# Act as an expert software engineer, analize the following question and provide a detailed answer using the provided context and codebase references (use markdown):\n${argv.input}`;
175+
}
176+
const response = await question.request(prompt_);
172177
x_console.out({ message:marked.parse(response.data) });
173178
//console.log('response:\n',response.data);
174179
} else {

0 commit comments

Comments
 (0)