Skip to main content

save_partial_answer

Function save_partial_answer 

Source
pub(super) async fn save_partial_answer(
    conn: &mut PgConnection,
    message_id: Uuid,
    text: &str,
    used_tokens: i32,
) -> ChatbotResult<()>
Expand description

Saves text as the (incomplete) answer of the message message_id already names, billed for used_tokens.

Bumps the parent message row transactionally — see chatbot_conversation_messages::update. Callers decide for themselves whether an empty text is worth saving at all; this always does.