chore(prompt): find nearby block
This commit is contained in:
@@ -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'}`)
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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.
|
||||
`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user