fix import (#242)

* 🐛 fix import (#224)

* 🐛 fix import of corrupted history

see https://github.com/mckaywrigley/chatbot-ui/issues/224#issuecomment-1486080888

* add the run-test-suite github action
This commit is contained in:
Thomas LÉVEIL
2023-03-28 10:27:37 +02:00
committed by GitHub
parent 5aa5be3f43
commit b0c289f7a4
15 changed files with 7061 additions and 55 deletions
+7 -2
View File
@@ -36,13 +36,18 @@ export const cleanSelectedConversation = (conversation: Conversation) => {
return updatedConversation;
};
export const cleanConversationHistory = (history: Conversation[]) => {
export const cleanConversationHistory = (history: any[]): Conversation[] => {
// added model for each conversation (3/20/23)
// added system prompt for each conversation (3/21/23)
// added folders (3/23/23)
// added prompts (3/26/23)
return history.reduce((acc: Conversation[], conversation) => {
if (!Array.isArray(history)) {
console.warn('history is not an array. Returning an empty array.');
return [];
}
return history.reduce((acc: any[], conversation) => {
try {
if (!conversation.model) {
conversation.model = OpenAIModels[OpenAIModelID.GPT_3_5];