mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2026-01-02 17:46: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][]) => {
|
||||
const chatTurns = chatHistory.map(([role, content]) => {
|
||||
if (role === 'human') {
|
||||
return { role: 'user', content };
|
||||
} else {
|
||||
return { role: 'assistant', content };
|
||||
}
|
||||
});
|
||||
|
||||
const chatModel = localStorage.getItem('chatModelKey');
|
||||
const chatModelProvider = localStorage.getItem('chatModelProviderId');
|
||||
|
||||
@@ -16,7 +8,7 @@ export const getSuggestions = async (chatHistory: [string, string][]) => {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
chatHistory: chatTurns,
|
||||
chatHistory,
|
||||
chatModel: {
|
||||
providerId: chatModelProvider,
|
||||
key: chatModel,
|
||||
|
||||
Reference in New Issue
Block a user