Skip to content

Sparql based rag

on_chat_input(e)

Capture chat text input.

Source code in TimelineKGQA/demo/sparql_based_rag.py
67
68
69
70
def on_chat_input(e: me.InputEvent):
    """Capture chat text input."""
    state = me.state(State)
    state.question_id = e.value

on_click_submit_chat_msg(e)

Handles submitting a chat message.

Source code in TimelineKGQA/demo/sparql_based_rag.py
79
80
81
82
83
84
85
86
def on_click_submit_chat_msg(e: me.ClickEvent | me.InputEnterEvent):
    """Handles submitting a chat message."""
    state = me.state(State)
    if state.in_progress or not state.input:
        return
    input = state.input
    state.input = ""
    yield

on_rewrite_input(e)

Capture rewrite text input.

Source code in TimelineKGQA/demo/sparql_based_rag.py
73
74
75
76
def on_rewrite_input(e: me.InputEvent):
    """Capture rewrite text input."""
    state = me.state(State)
    state.preview_rewrite = e.value