SendRequest() method » History » Revision 4
Revision 3 (Tomislav Pleše, 09/20/2025 12:17 PM) → Revision 4/19 (Tomislav Pleše, 09/20/2025 02:31 PM)
# SendRequest() method Context is created from message with following roles: * system (content: instructions to AI model), * assistant (content: AI model responses), * user (content: user prompts) Cases for the flow of sending requests to AI model: Cases: 1. Root Point - First Prompt * FE - Create new Point * FE - Show new Point on Screen - only the Prompt * FE - Create Context - messageList from: * message list of previous Points * previous Points (Prompt + Response) * . List is ascending: from the first message, down to the newest prompt. Since (Prompt+Response). Since, there is only this first Prompt, add only that. that * FE - Send new Point and messageList to BE * BE - Save new Point to DB * BE - Send messageList (in this case onltPrompt Prompt to OpenAI * BE - Receive the Response from OpenAI * BE - Save Response to DB (in (with the new Point document) Point) * BE - BE- Send the new Point (with updated Response) to FE * FE - Show updated new Point on Screen - both Prompt and Response 2. Existing Point - Second prompt * FE - Create new Point * FE - Show new Point on Screen Screen, under previous Point - only the Prompt, under the previous Point Prompt * FE - Create Context - message list from of previous Points (Prompt + Response). List is ascending: from the first message, down to the newest prompt. (Prompt+Response) * FE - Send new Point and the messageList to BE * BE - Save new Point to DB * BE - Receive the Response from OpenAI * BE - Send Prompt to OpenAI * BE - Receive the Response from OpenAI * BE - Save Response to DB (with the new Point) * BE- Send the new Point (with updated Response) to FE * FE - Show updated new Point on Screen - both Prompt and Response 3. New shard - prompt 4. Existing Shard - prompt