mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-12-25 04:58:15 +00:00
feat(app): handle new architecture
This commit is contained in:
@@ -1,6 +1,14 @@
|
||||
import { Message } from '@/components/ChatWindow';
|
||||
|
||||
export const getSuggestions = async (chatHistory: Message[]) => {
|
||||
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');
|
||||
|
||||
@@ -10,7 +18,7 @@ export const getSuggestions = async (chatHistory: Message[]) => {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
chatHistory: chatHistory,
|
||||
chatHistory: chatTurns,
|
||||
chatModel: {
|
||||
providerId: chatModelProvider,
|
||||
key: chatModel,
|
||||
|
||||
Reference in New Issue
Block a user