feat(app): handle new architecture

This commit is contained in:
ItzCrazyKns
2025-11-23 19:58:46 +05:30
parent e0ba476ca4
commit 956a768a86
14 changed files with 945 additions and 508 deletions

View File

@@ -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,