mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-07-24 08:55:23 +02:00
Add setting for number of "relevant_docs_count"
This commit is contained in:
parent
b1dad6beda
commit
72397c4c33
2 changed files with 6 additions and 10 deletions
|
@ -30,6 +30,7 @@ export default
|
|||
|
||||
"allow_insecure_coding": false, // allows newAction command and model can write/run code on your computer. enable at own risk
|
||||
"code_timeout_mins": 3, // minutes code is allowed to run. -1 for no timeout,set 3.Set 3 min to timely code adjustments
|
||||
"relevant_docs_count": 5, // number of relevant docs to show when generating code
|
||||
|
||||
"max_messages": 15, // max number of messages to keep in context
|
||||
"max_commands": -1, // max number of commands to use in a response. -1 for no limit
|
||||
|
|
|
@ -4,7 +4,7 @@ import { getCommandDocs } from './commands/index.js';
|
|||
// import { getSkillDocs } from './library/index.js';
|
||||
import { stringifyTurns } from '../utils/text.js';
|
||||
import { getCommand } from './commands/index.js';
|
||||
|
||||
import settings from '../../settings.js';
|
||||
import { Gemini } from '../models/gemini.js';
|
||||
import { GPT } from '../models/gpt.js';
|
||||
import { Claude } from '../models/claude.js';
|
||||
|
@ -178,19 +178,14 @@ export class Prompter {
|
|||
}
|
||||
if (prompt.includes('$COMMAND_DOCS'))
|
||||
prompt = prompt.replaceAll('$COMMAND_DOCS', getCommandDocs(this.agent.blocked_actions));
|
||||
if (prompt.includes('$CODE_DOCS')){
|
||||
// Find the most recent non-system message containing '!newAction('
|
||||
let code_task_content = messages.slice().reverse().find(msg =>
|
||||
if (prompt.includes('$CODE_DOCS')) {
|
||||
const code_task_content = messages.slice().reverse().find(msg =>
|
||||
msg.role !== 'system' && msg.content.includes('!newAction(')
|
||||
)?.content || '';
|
||||
|
||||
// Extract content between '!newAction(' and ')'
|
||||
const match = code_task_content.match(/!newAction\((.*?)\)/);
|
||||
code_task_content = match ? match[1] : '';
|
||||
)?.content?.match(/!newAction\((.*?)\)/)?.[1] || '';
|
||||
|
||||
prompt = prompt.replaceAll(
|
||||
'$CODE_DOCS',
|
||||
await this.skill_libary.getRelevantSkillDocs(code_task_content, 5)
|
||||
await this.skill_libary.getRelevantSkillDocs(code_task_content, settings.relevant_docs_count)
|
||||
);
|
||||
}
|
||||
if (prompt.includes('$EXAMPLES') && examples !== null)
|
||||
|
|
Loading…
Add table
Reference in a new issue