Redesign the UI on brain's look: sidebar with search, Overview, modules, grouped Settings
- 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>
This commit is contained in:
@@ -1,32 +1,39 @@
|
||||
{{define "content"}}{{with .Data}}{{$cfg := .Cfg}}
|
||||
<nav class="tabs">
|
||||
<a href="/settings/ai" aria-current="page">AI provider</a>
|
||||
<a href="/settings/credentials">Credentials</a>
|
||||
</nav>
|
||||
<h1>AI provider</h1>
|
||||
{{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">
|
||||
<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)
|
||||
{{if .HasAnthropicKey}}<span class="help">— with the key saved under <a href="/settings/credentials">Credentials</a></span>
|
||||
{{else if .Shared}}<span class="help">— with Hermes' key, shared by <code>supermarket hermes</code> (Hermes uses {{.Shared.Model}}). A key saved under <a href="/settings/credentials">Credentials</a> would take its place.</span>
|
||||
{{else}}<span class="help">— add the API key under <a href="/settings/credentials">Credentials</a>, or share Hermes' by running <code>supermarket hermes</code></span>{{end}}</label>
|
||||
<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>
|
||||
|
||||
<div data-show-for="openai">
|
||||
<label>Server 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>
|
||||
</div>
|
||||
<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>
|
||||
|
||||
@@ -36,14 +43,14 @@
|
||||
</select>
|
||||
<span class="help">How hard the model thinks. Medium suits drafting; higher costs more and takes longer.</span>
|
||||
</label>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Model per task</h2>
|
||||
<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>
|
||||
<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">
|
||||
@@ -51,9 +58,10 @@
|
||||
<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}}{{end}}
|
||||
{{end}}{{template "settings-end"}}{{end}}
|
||||
|
||||
{{define "test-result"}}
|
||||
{{if .Error}}<p class="error">{{.Error}}</p>
|
||||
|
||||
Reference in New Issue
Block a user