mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2026-01-03 01:56:56 +00:00
feat(actions): prevent double conversion to object array
This commit is contained in:
@@ -1,12 +1,4 @@
|
|||||||
export const getSuggestions = async (chatHistory: [string, string][]) => {
|
export const getSuggestions = async (chatHistory: [string, string][]) => {
|
||||||
const chatTurns = chatHistory.map(([role, content]) => {
|
|
||||||
if (role === 'human') {
|
|
||||||
return { role: 'user', content };
|
|
||||||
} else {
|
|
||||||
return { role: 'assistant', content };
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const chatModel = localStorage.getItem('chatModelKey');
|
const chatModel = localStorage.getItem('chatModelKey');
|
||||||
const chatModelProvider = localStorage.getItem('chatModelProviderId');
|
const chatModelProvider = localStorage.getItem('chatModelProviderId');
|
||||||
|
|
||||||
@@ -16,7 +8,7 @@ export const getSuggestions = async (chatHistory: [string, string][]) => {
|
|||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
chatHistory: chatTurns,
|
chatHistory,
|
||||||
chatModel: {
|
chatModel: {
|
||||||
providerId: chatModelProvider,
|
providerId: chatModelProvider,
|
||||||
key: chatModel,
|
key: chatModel,
|
||||||
|
|||||||
Reference in New Issue
Block a user