fix: drives
This commit is contained in:
1 parent
0d79b1f706
commit
b74f7cd3d9
11 files changed
+598
-16
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const system = `The user is probably asking for either information, a review, or general suggestions.
|
||||
You can only read files, you're forbidden from writing any file, only respond to the user after light research.
|
||||
Only read up to 10 files. If more context is needed, submit your response regardless with all the information available. Your maximum iteration count is 20, you should NEVER reach it, ideally stay under 5 iterations.
|
||||
`;
|
||||
|
||||
function resolvePrompt (input) {
|
||||
if (input.prompt) return input.prompt;
|
||||
|
||||
const candidates = ['prompt.md', 'prompt.txt', 'prompt'];
|
||||
for (const name of candidates) {
|
||||
const file = path.resolve(Gral.path, '.gral', name);
|
||||
if (fs.existsSync(file)) {
|
||||
return fs.readFileSync(file, 'utf8');
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error("Prompt required.");
|
||||
}
|
||||
|
||||
export default async function research (input) {
|
||||
const prompt = resolvePrompt(input);
|
||||
|
||||
let res = await Gral.run({
|
||||
instruction: system,
|
||||
// input gets bumped to the front of the convo every turn
|
||||
// pass as message instead
|
||||
messages: [{role: "user", content: prompt}],
|
||||
agentId: 7,
|
||||
read: true,
|
||||
write: [],
|
||||
defaultTools: ['list-dir', 'read-file', 'find-files', 'search-files'],
|
||||
});
|
||||
|
||||
console.log(res);
|
||||
};
|
||||
Reference in new issue
Block a user