Skip to content

Commit a16472b

Browse files
committed
feat(actions): prevent double conversion to object array
1 parent 3b8d8be commit a16472b

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/lib/actions.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
export const getSuggestions = async (chatHistory: [string, string][]) => {
2-
const chatTurns = chatHistory.map(([role, content]) => {
3-
if (role === 'human') {
4-
return { role: 'user', content };
5-
} else {
6-
return { role: 'assistant', content };
7-
}
8-
});
9-
102
const chatModel = localStorage.getItem('chatModelKey');
113
const chatModelProvider = localStorage.getItem('chatModelProviderId');
124

@@ -16,7 +8,7 @@ export const getSuggestions = async (chatHistory: [string, string][]) => {
168
'Content-Type': 'application/json',
179
},
1810
body: JSON.stringify({
19-
chatHistory: chatTurns,
11+
chatHistory,
2012
chatModel: {
2113
providerId: chatModelProvider,
2214
key: chatModel,

0 commit comments

Comments
 (0)