- Left sidebar as in brain: search at the top (press /), Overview, Inventory, the modules (Content with Inbox, Sources, Scheduled and Published; later phases greyed out), Settings at the bottom; a top bar with breadcrumbs, and a menu that slides in on narrow screens. - brain's colour tokens, type, radius and shadows, with a dark theme that follows the system setting. - Settings as grouped tabs: Profile; Social accounts (was Credentials, now keys and sign-in together per network); Core & Hermes; AI, which now holds the API keys too. Old addresses redirect. - /search matches every word across posts, fetched items, the inventory, products and settings pages. - Overview: a card per module, then the setup checklist, folded once done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
77 lines
4.4 KiB
HTML
77 lines
4.4 KiB
HTML
{{define "content"}}{{template "settings-start" .}}{{with .Data}}{{$cfg := .Cfg}}{{$set := .Set}}
|
|
<h2>AI</h2>
|
|
<p class="lede">The model Supermarket writes with: drafts, the profile draft, and later the other modules. It's called directly, never through Hermes, so text read from the web can't reach an agent with tools.</p>
|
|
|
|
<form method="post" action="/settings/ai" id="ai-form" autocomplete="off">
|
|
<section class="card">
|
|
<fieldset class="choice">
|
|
<legend>Provider</legend>
|
|
<label class="check"><input type="radio" name="provider" value="anthropic" {{if ne $cfg.Provider "openai"}}checked{{end}} data-toggle="provider"> Anthropic (Claude)</label>
|
|
<label class="check"><input type="radio" name="provider" value="openai" {{if eq $cfg.Provider "openai"}}checked{{end}} data-toggle="provider">
|
|
A server on your network (Ollama, LM Studio, llama.cpp, vLLM) or another OpenAI-compatible service</label>
|
|
</fieldset>
|
|
</section>
|
|
|
|
<section class="card" data-show-for="anthropic">
|
|
<h3>Key</h3>
|
|
{{if .HasAnthropicKey}}<p class="ok">Using the key saved here.</p>
|
|
{{else if .Shared}}<p class="ok">Using Hermes' key, shared by <code>supermarket hermes</code>. Hermes uses {{.Shared.Model}}.</p>
|
|
<p class="help">To use a separate key, for example to see Supermarket's costs apart from Hermes', save it below: it takes the place of Hermes'.</p>
|
|
{{else}}<p class="warn-text">No key yet. Save one below, or share Hermes' by running <code>supermarket hermes</code>.</p>{{end}}
|
|
{{range .Keys}}{{if eq .Group "anthropic"}}{{template "key-field" (dict "F" . "Set" (index $set .Name))}}{{end}}{{end}}
|
|
</section>
|
|
|
|
<section class="card" data-show-for="openai">
|
|
<h3>Server</h3>
|
|
<label>Address <input name="base_url" id="base_url" value="{{$cfg.BaseURL}}" placeholder="http://192.168.1.20:11434" list="servers">
|
|
<span class="help">Supermarket runs in Docker: for a server on this computer use <code>http://host.docker.internal:11434</code>, and use an IP address rather than a <code>.local</code> name.</span></label>
|
|
<datalist id="servers">{{range .Servers}}<option value="{{.BaseURL}}">{{.Name}}</option>{{end}}</datalist>
|
|
{{if .Servers}}<p class="help">Found by CoreDesktop's <code>configure ai-servers</code>: {{range $i, $s := .Servers}}{{if $i}}, {{end}}{{$s.Name}} ({{$s.BaseURL}}){{end}}.</p>{{end}}
|
|
<button type="button" class="secondary" hx-get="/settings/ai/models" hx-include="#base_url" hx-target="#model-list">List its models</button>
|
|
<div id="model-list"></div>
|
|
{{range .Keys}}{{if eq .Group "openai"}}{{template "key-field" (dict "F" . "Set" (index $set .Name))}}{{end}}{{end}}
|
|
</section>
|
|
|
|
<section class="card">
|
|
<h3>Model</h3>
|
|
<label>Model <input name="model" value="{{$cfg.Model}}" list="anthropic-models" required></label>
|
|
<datalist id="anthropic-models">{{range .AnthropicModels}}<option value="{{.}}">{{end}}</datalist>
|
|
|
|
<label data-show-for="anthropic">Effort
|
|
<select name="effort">
|
|
{{range .Efforts}}<option value="{{.}}" {{if eq $cfg.Effort .}}selected{{end}}>{{.}}</option>{{end}}
|
|
</select>
|
|
<span class="help">How hard the model thinks. Medium suits drafting; higher costs more and takes longer.</span>
|
|
</label>
|
|
|
|
<details>
|
|
<summary>A different model per task</summary>
|
|
<p class="help">Leave empty to use the model above. Same provider.</p>
|
|
{{range .Tasks}}
|
|
<label>{{.Label}} <input name="task_{{.ID}}" value="{{index $cfg.TaskModels .ID}}" list="anthropic-models"></label>
|
|
{{end}}
|
|
</details>
|
|
</section>
|
|
|
|
<div class="actions">
|
|
<button type="submit">Save</button>
|
|
<button type="button" class="secondary" hx-post="/settings/ai/test" hx-include="#ai-form" hx-target="#test-result" hx-indicator="#testing">Test</button>
|
|
<span id="testing" class="htmx-indicator">Asking the model…</span>
|
|
</div>
|
|
<p class="help">Test uses the provider and model in the form, and the keys already saved: save a new key before testing it.</p>
|
|
<div id="test-result"></div>
|
|
</form>
|
|
{{end}}{{template "settings-end"}}{{end}}
|
|
|
|
{{define "test-result"}}
|
|
{{if .Error}}<p class="error">{{.Error}}</p>
|
|
{{else}}<p class="flash">The model answered in {{.Took}}: “{{.Reply}}”</p>{{end}}
|
|
{{end}}
|
|
|
|
{{define "model-list"}}
|
|
{{if .Error}}<p class="error">{{.Error}}</p>
|
|
{{else if .Models}}<p class="help">Models on this server (click one to use it):</p>
|
|
<ul class="pills">{{range .Models}}<li><button type="button" class="pill" data-fill="model" data-value="{{.}}">{{.}}</button></li>{{end}}</ul>
|
|
{{else}}<p class="help">The server has no models.</p>{{end}}
|
|
{{end}}
|