Skip to main content

resolve_page_context

Function resolve_page_context 

Source
pub async fn resolve_page_context(
    conn: &mut PgConnection,
    page_context: ChatbotPageContext,
    course_id: Option<Uuid>,
) -> Option<PageChatbotContext>
Expand description

The page the learner claims to have open, or None when nothing about it may be shown to the model.

Read before the conversation is locked, since it depends on nothing the lock protects. The context is advisory, so a page id that leads nowhere is dropped rather than failing the message it came with: the id is the client’s, and a learner whose page was deleted under them would otherwise be unable to write to the chatbot at all. course_id is the course of the chatbot configuration; a configuration with no course accepts no page context at all.