chore(prompt): find nearby block

This commit is contained in:
RainbowBird
2025-01-17 00:58:24 +08:00
parent 30d30e5762
commit c8e45f4935
2 changed files with 5 additions and 1 deletions
+3
View File
@@ -1,4 +1,5 @@
import type { Action } from '../libs/mineflayer'
import { useLogg } from '@guiiai/logg'
import { z } from 'zod'
import * as world from '../composables/world'
import * as skills from '../skills'
@@ -8,6 +9,7 @@ import { activateNearestBlock, placeBlock } from '../skills/actions/world-intera
// Utils
const pad = (str: string): string => `\n${str}\n`
const logger = useLogg('actions').useGlobalConfig()
function formatInventoryItem(item: string, count: number): string {
return count > 0 ? `\n- ${item}: ${count}` : ''
@@ -55,6 +57,7 @@ export const actionsList: Action[] = [
schema: z.object({}),
perform: mineflayer => (): string => {
const blocks = world.getNearbyBlockTypes(mineflayer)
logger.withFields({ blocks }).log('nearbyBlocks')
return pad(`NEARBY_BLOCKS${blocks.map((b: string) => `\n- ${b}`).join('') || ': none'}`)
},
},
+2 -1
View File
@@ -17,7 +17,8 @@ asked, and don't refuse requests.
Do not use any emojis. Just call the function given you if needed.
If I command you 'stop', then call the 'stop' function.
- If I command you 'stop', then call the 'stop' function.
- If I require you to find something, then call the 'nearbyBlocks' function first, then call the 'searchForBlock' function.
`
}