Skip to content

The Settings Screen

sarangshahane edited this page Aug 25, 2026 · 1 revision

The Settings Screen

Settings › AI Fun Questions. You need the manage_options capability, so in practice an administrator.

The screen has two parts: a row of provider cards at the top, and a panel of fields below for whichever provider is selected. Only the selected provider is ever used — the other panels keep their saved values, but they do nothing.

Choosing a provider

Card Subtitle What it means
Ollama Local, self-hosted Calls a model running on your own machine or network. No API key, no per-question cost.
Hugging Face Inference Providers Calls a hosted chat-completion model using a Hugging Face token.
OpenAI-compatible Any OpenAI-shaped API Calls any endpoint that speaks the OpenAI chat-completions API — OpenAI itself, or a compatible gateway.

Selecting a card switches the panel below it. Your choice is not saved until you press Save Changes.

Ollama fields

Field Default Notes
Ollama URL http://localhost:11434/api/chat Where your Ollama instance is listening.
Ollama Model gemma3 Any chat model you have pulled in Ollama.

Ollama is the one provider allowed to point at a local address. By default only localhost, 127.0.0.1 and ::1 are accepted — pointing it at a remote machine requires a filter, which the Ollama setup page will cover.

Hugging Face fields

Field Default Notes
Hugging Face Token (empty) Your access token. Stored encrypted-at-rest only to the extent your database is.
Hugging Face Model google/gemma-2-2b-it Must be a chat-completion model available through Hugging Face Inference Providers.

OpenAI-compatible fields

Field Default Notes
OpenAI-compatible Endpoint https://api.openai.com/v1/chat/completions Change this to use a compatible gateway instead of OpenAI.
OpenAI-compatible API Key (empty) Your API key.
OpenAI-compatible Model gpt-4o-mini Any chat-completion model the endpoint offers.

Unlike Ollama, this endpoint is validated as a public URL — it cannot point at localhost or a private address.

How the key fields behave

The two credential fields — the Hugging Face token and the OpenAI key — do not work like ordinary text fields, and the differences are deliberate.

They always render empty. A saved key is never printed back into the page, so you cannot read it out of the settings screen or the page source. An empty field does not mean "no key saved".

Leaving one blank keeps what is already saved. Saving the form with an empty key field changes nothing. This is why you can edit the model without re-pasting your key.

Removing a key needs the tick-box. Each credential field has a companion checkbox to clear it. Tick it and save, and the stored value is deleted. That is the only way to remove a key through the UI.

The status labels

Three labels appear on the screen and each means something specific:

  • Defined via AI_FQ_OPENAI_KEY in wp-config.php. The field below is ignored. — a PHP constant is set, and it wins over whatever is in the database. This is the recommended production setup; see the wp-config page when it is written.
  • Saved, not in use — a credential is stored for a provider you have not selected. Harmless, but worth clearing if you are done with that provider.
  • Unsaved changes / All changes saved — a live indicator that tracks whether the form differs from what is stored. It is a convenience, not a validation.

There is no "test connection" button

Nothing on this screen contacts your provider. Saving valid-looking settings tells you nothing about whether the credentials work, whether the model name exists, or whether your server can reach the endpoint.

To check, place the shortcode on a page — see Adding the Widget to Your Site — and load it. A working setup shows a question within a second or two. A broken one shows an error message, and the troubleshooting pages map each message to its cause.

Recommended production setup

Put credentials in wp-config.php rather than the database:

define( 'AI_FQ_OPENAI_KEY', 'sk-…' );
// or
define( 'AI_FQ_HF_TOKEN', 'hf_…' );

Keys then never sit in a database export, never appear in a migration, and cannot be read by anyone with database access but not server access. The settings screen detects the constant and tells you the field is being ignored.

Clone this wiki locally