diff --git a/README.md b/README.md index eee0b16..a5e9b5c 100644 --- a/README.md +++ b/README.md @@ -109,4 +109,4 @@ Perplexica is built on the idea that AI and large language models should be easy If you have any questions or feedback, please feel free to reach out to us. You can create an issue on GitHub or join our Discord server. There, you can connect with other users, share your experiences and reviews, and receive more personalized help. [Click here](https://discord.gg/EFwsmQDgAu) to join the Discord server. To discuss matters outside of regular support, feel free to contact me on Discord at `itzcrazykns`. -Thank you for exploring Perplexica, the AI-powered search engine designed to enhance your search experience. We are constantly working to improve Perplexica and expand its capabilities. We value your feedback and contributions which help us make Perplexica even better. Don't forget to check back for updates and new features! \ No newline at end of file +Thank you for exploring Perplexica, the AI-powered search engine designed to enhance your search experience. We are constantly working to improve Perplexica and expand its capabilities. We value your feedback and contributions which help us make Perplexica even better. Don't forget to check back for updates and new features! diff --git a/src/routes/images.ts b/src/routes/images.ts index 97f0b31..45a4307 100644 --- a/src/routes/images.ts +++ b/src/routes/images.ts @@ -3,12 +3,21 @@ import handleImageSearch from '../agents/imageSearchAgent'; import { BaseChatModel } from '@langchain/core/language_models/chat_models'; import { getAvailableProviders } from '../lib/providers'; import { getChatModel, getChatModelProvider } from '../config'; +import { HumanMessage, AIMessage } from '@langchain/core/messages'; const router = express.Router(); router.post('/', async (req, res) => { try { - const { query, chat_history } = req.body; + let { query, chat_history } = req.body; + + chat_history = chat_history.map((msg: any) => { + if (msg.role === 'user') { + return new HumanMessage(msg.content); + } else if (msg.role === 'assistant') { + return new AIMessage(msg.content); + } + }); const models = await getAvailableProviders(); const provider = getChatModelProvider(); diff --git a/ui/components/MessageBox.tsx b/ui/components/MessageBox.tsx index 9018166..cb9da14 100644 --- a/ui/components/MessageBox.tsx +++ b/ui/components/MessageBox.tsx @@ -116,7 +116,10 @@ const MessageBox = ({