Feature #3579
Add conversation support to Assistants GCF
100%
Description
call_openai_api(model, index, thread_id, new_chat)
-get <assistant_id, instructions, prompt prefix, prompt suffix> for <model, index> from DS
-if (assistant_id == "")
--return error //this will not happen to users
-else
--assistant_id = GET https://api.openai.com/v1/assistants/{assistant_id}
-if (thread_id == "")
--thread_id = create_thread() [POST https://api.openai.com/v1/threads]
-else
--thread_id = GET https://api.openai.com/v1/threads/{thread_id}
-if (new_chat) //delete all messages
--messages = GET https://api.openai.com/v1/threads/{thread_id}/messages
--delete messages [In a loop: 1. GET https://api.openai.com/v1/threads/{thread_id}/messages/{message_id} 2. DELETE https://api.openai.com/v1/threads/{thread_id}/messages/{message_id}]
-create message [POST https://api.openai.com/v1/threads/{thread_id}/messages]
-return thread_id, response