Skip to main content

Module assistant_threads

Module assistant_threads 

Source
Expand description

The assistant’s conversation: one thread per user that survives page navigation and reloads.

What is stored: the text of each question and of each answer, the quick action, and where the question was asked (the label of the resolved page context, for example PRT-000009/A · bom). Not stored: tool results, the model’s reasoning, the page context itself. A follow-up replays the stored text to the model and calls the tools again with the user’s current rights, so nothing they lost access to comes back through a tool. Only the owner reads a thread: every query here is keyed by the user id of the actor, there is no function that takes a thread id from a client. Threads expire after TEAMCRAFT_ASSISTANT_RETENTION_DAYS of inactivity and go with the user.

Structs§

Exchange
A question and its answer to append.
StoredMessage
One stored message, as the thread view shows it.
Thread
The thread of a user.

Constants§

DEFAULT_RETENTION_DAYS
Default retention of an idle thread (days).
MAX_HISTORY_CHARS
Most characters replayed per message.
MAX_HISTORY_MESSAGES
Most messages replayed to the model on a follow-up (the newest ones).
MAX_STORED_MESSAGES
Most messages kept in a thread; the oldest go first.

Functions§

append
Appends a question and its answer in one transaction (the thread is created on the first exchange). Questions that were cancelled or failed are never stored.
history_of
What a follow-up replays to the model: the newest messages, each cut.
load
The user’s thread, newest message last. An expired thread is deleted and reads as empty.
purge_expired
Deletes the idle threads of everybody (the periodic clean-up) and returns how many went.
reset
“New conversation”: deletes the user’s thread.
was_tainted
Whether an earlier answer of the thread came from a tainted run.