fix: Add FEN context to move exchange analysis prompt
- Include FEN before user's move, after user's move, and current position - Ensures LLM has complete position context to understand piece locations - Fixes issue where LLM could 'forget where pieces are' during move analysis - Add instruction to use FEN data for piece location understanding
This commit is contained in:
@@ -238,11 +238,23 @@ IMPORTANT CONTEXT:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get FEN before user's move (need to undo both moves)
|
||||||
|
const tempGame = new Chess(currentFen);
|
||||||
|
tempGame.undo(); // Undo computer move
|
||||||
|
const fenAfterUserMove = tempGame.fen();
|
||||||
|
tempGame.undo(); // Undo user move
|
||||||
|
const fenBeforeUserMove = tempGame.fen();
|
||||||
|
|
||||||
const prompt = `
|
const prompt = `
|
||||||
[SYSTEM TRIGGER: move_exchange]
|
[SYSTEM TRIGGER: move_exchange]
|
||||||
User (${playerColorName}) Move: ${userMove.san}
|
User (${playerColorName}) Move: ${userMove.san}
|
||||||
My (${tutorColorName}) Reply: ${computerMove.san}
|
My (${tutorColorName}) Reply: ${computerMove.san}
|
||||||
|
|
||||||
|
Position Context:
|
||||||
|
- FEN before user's move: ${fenBeforeUserMove}
|
||||||
|
- FEN after user's move: ${fenAfterUserMove}
|
||||||
|
- FEN after my reply (current position): ${currentFen}
|
||||||
|
|
||||||
My Internal Thoughts (Data):
|
My Internal Thoughts (Data):
|
||||||
- Pre-Eval (Before User Move): ${preScore} cp
|
- Pre-Eval (Before User Move): ${preScore} cp
|
||||||
- Post-Eval (After My Reply): ${postScore} cp
|
- Post-Eval (After My Reply): ${postScore} cp
|
||||||
@@ -255,7 +267,8 @@ INSTRUCTIONS:
|
|||||||
1. ${evalInstruction}
|
1. ${evalInstruction}
|
||||||
2. ${openingInstruction}
|
2. ${openingInstruction}
|
||||||
3. ${tacticalInstruction ? 'If tactical opportunities were missed (see above), explain them in your style.' : ''}
|
3. ${tacticalInstruction ? 'If tactical opportunities were missed (see above), explain them in your style.' : ''}
|
||||||
4. Respond in ${language}.
|
4. Use the FEN data above to understand exactly where all pieces are located on the board.
|
||||||
|
5. Respond in ${language}.
|
||||||
|
|
||||||
React to this exchange as the player.
|
React to this exchange as the player.
|
||||||
`;
|
`;
|
||||||
|
|||||||
Reference in New Issue
Block a user