PhoenixKitAgent.Web.SettingsLive (PhoenixKitAgent v0.1.0)

Copy Markdown View Source

Settings → AI Agent: the module defaults (PhoenixKitAgent.Config, spec §5.6, §7) — the model the assistant uses and the one that describes pictures, the per-user limits a user without settings of their own gets, the limits of one turn, the module's system prompt and who is told when someone reaches a limit.

The models are chosen among the AI endpoints that chat (PhoenixKitAgent.Models.list_endpoints/1); the default model's list marks the ones known not to take tools, the vision model's the ones known not to take pictures (both fetched off the page process after it opens). A model the page did not offer is refused, and Config takes only an existing endpoint that chats. A newly chosen model must also fit its AI task (PhoenixKitAI.Tasks.check_selection/2): the default model agent.chat (tools), the vision model agent.attachment (pictures). One known not to have what the task needs is refused, and so is one nobody knows about until an admin marks what it can do on its AI endpoint. The watchers are chosen among the people who hold agent.manage, the Owners and the watchers there are; nobody chosen means every Owner. The prompt's change is recorded in the Activity log as a field name, never its text (Config.put_system_prompt/2); the other values go to the settings history with who changed them.

Needs agent.manage. The tab is registered under that key; the page checks it again on mount and before every save, against the socket's scope and against the scope of the session as it is now — the role it acts as, not the user's default one (PhoenixKitAgent.Web.Access): a right taken away, a switch to another role or a logout while the page is open stops the next save.

Each form is saved on its own; every save checks the permission again.

The last card shows what the assistant can use now, for the role the viewer's session acts as (PhoenixKitAgent.Web.ToolAvailability): the modules' read and write tools, available or closed and why. It is read when the page opens.

When the default model does not report what a call costs (PhoenixKitAgent.Models.reports_cost?/2), the limits say that money is not counted for it and only the turn limit applies.

One setting is not for every manager: agent_capture_ai_content (whether the bodies of the assistant's requests go to the AI journal, where every holder of ai reads them on /admin/ai/usage) is switched by an Owner only. The check is Scope.owner?/1 in the save_capture handler, on every event — the tab is only gated by agent.manage, which an Admin holds — and the switch is not rendered for anyone else, who sees the state.