bitcoinsearch / chat-btc

A conversational AI based on technical bitcoin sources
https://chat.bitcoinsearch.xyz/
MIT License
16 stars 13 forks source link

fix Message History Context #73

Closed kouloumos closed 8 months ago

kouloumos commented 8 months ago

Issue Currently, we only use the first N messages of the chat history instead of the last N.

Details In the constructMessageHistory function, the loop incorrectly iterates over indexes based on the original messages array rather than the messageWindow slice. To fix this and correctly process the last N messages, the loop should iterate over messageWindow instead.

Fix That's what I fix with 81ca8bf55f0b07dca405fd72f819f3652ca1154f. Then, with a16fb258d15cfc994a5d8a8e7084d672b445d7e7, I refactored the related code to make it less error-prone, potentially avoiding issues as the one described here.

vercel[bot] commented 8 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
chat-btc ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2024 1:07pm
github-actions[bot] commented 3 weeks ago

:tada: This PR is included in version 1.0.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: