Expand description
Runs the built-in assistant for a user and records the run in the
audit log (who, which action, question length, tools, tokens – never the
question or the answer). See crate::assistant for the tool loop.
Structs§
- Context
Note - The resolved page context of a question: what the chip and the thread show.
- Run
- The result of a run as the web UI and the API return it.
Constants§
- MAX_
LIMITS_ CHARS - Longest “use as limits” note of the Fill with AI box, in characters.
Functions§
- admin_
overview - What Admin → AI shows: the local-agent switch (
TEAMCRAFT_LOCAL_AGENTS) and the server-side assistant (provider, model, host, limits). Never the API key or the URL path – only whether a key is set. Pure, for tests. - ask
- Asks the assistant. The tools run with the rights of
me; the draft tools are only offered whenquestion.allow_draftsis set andmemay edit. - ask_
with_ page - A question in the user’s conversation (or, with
threadfalse, a single question that sees the page but is not stored): resolves the page with the user’s rights, quotes the earlier messages of the conversation, runs the assistant with the user’s current rights and stores the new question and answer.pageis what the client sent, unresolved. - chat
- A request of the web sidebar or the REST API: validates the raw fields
and the page context the client sent (
context, seecrate::pagecontext), then asks. - enabled
- Whether the assistant is configured on this server.
- fill_
result_ values - Fill with AI… on the Results card: asks the assistant to propose result
values of a simulation revision from its reports, as drafts (never as
results).
wantednames the values to extract (empty = every key number),limitsis the user’s own note on limits,filesthe report files to read (empty = all). Returns the run and the number of proposals it created. - is_
report_ file - Whether a file of a simulation can be a report the assistant reads
(PDF, HTML or text; the extraction is
textindex/htmltext/pdftext). - resolve_
context - Resolves a page context that a client sent. The client’s identifiers
are hints: every one of them goes through the read guards of
services::accesswith the rights ofme, and only whatmemay read stays. An identifier of a restricted group thatmecannot see is dropped exactly like one that does not exist: the same queries run, the result looks the same and carries no trace of it. Texts typed on the page (query, filter values) are the user’s own and pass through. - switches
- The interface switches the assistant runs under: its own, and
external_llmunless the provider’s base URL is on the administrator’s internal list (TEAMCRAFT_ASSISTANT_INTERNAL_URLS).