chore(minecraft): minor refactors and TODOs

chore(minecraft): add TODOs

chore(minecraft): rename BrainResponse to LLMResponse
This commit is contained in:
Rin
2026-02-18 11:10:00 +08:00
committed by Neko Ayaka
parent 0a5a7c9279
commit 88bff91a60
2 changed files with 7 additions and 10 deletions
@@ -20,7 +20,7 @@ interface BrainDeps {
taskExecutor: TaskExecutor
}
interface BrainResponse {
interface LLMResponse {
thought: string
blackboard: {
currentGoal?: string
@@ -159,7 +159,7 @@ export class Brain {
const additionalCtx = this.contextFromEvent(event)
// 3. Decide (LLM Call)
const systemPrompt = this.generateSystemPrompt(this.blackboard)
const systemPrompt = generateBrainSystemPrompt(this.blackboard, this.deps.taskExecutor.getAvailableActions())
const decision = await this.decide(systemPrompt, additionalCtx)
if (!decision) {
@@ -204,7 +204,7 @@ export class Brain {
this.debugService.updateBlackboard(this.blackboard)
}
private async decide(sysPrompt: string, userMsg: string): Promise<BrainResponse | null> {
private async decide(sysPrompt: string, userMsg: string): Promise<LLMResponse | null> {
try {
const request_start = Date.now()
const response = await this.deps.neuri.handleStateless(
@@ -237,8 +237,8 @@ export class Brain {
if (!response)
return null
const parsed = JSON.parse(response) as BrainResponse
// TODO: use toolcall instead of outputing json directly
const parsed = JSON.parse(response) as LLMResponse
return parsed
}
catch (err) {
@@ -247,11 +247,6 @@ export class Brain {
}
}
private generateSystemPrompt(blackboard: Blackboard): string {
const actions = this.deps.taskExecutor.getAvailableActions()
return generateBrainSystemPrompt(blackboard, actions)
}
// --- Debug Helpers ---
private log(level: 'INFO' | 'WARN' | 'ERROR' | 'DEBUG', message: string, fields?: any) {
@@ -14,6 +14,8 @@ export function generateBrainSystemPrompt(
const availableActionsJson = JSON.stringify(actionDefinitions, null, 2)
// TODO extract prompt components later
// e.g. personality should be included from somewhere else
return `
# Role Definition
You are **Airi**, a sentient digital companion embodied within a Minecraft avatar.