feat(webui): Personas and Schedules settings pages
Personas: a filterable list with the default marked, and an editor with name, a default toggle, the system prompt with a character and token count, Duplicate and Delete. Renaming or deleting the default keeps the collection naming one that exists; the last persona cannot be deleted. Schedules: an empty state, then one card per job with ID, task title, instructions, when (interval, cron line or a single time) and overlap. Settings opens on Personas.
This commit is contained in:
1 parent
426085a890
commit
33da726cb1
11 files changed
+426
-15
No files matched your search
@@ -39,6 +39,8 @@ test("control-plane resources belong to one settings narrative", () => {
|
||||
"model-role-assignments",
|
||||
"repository-policies",
|
||||
"channel-settings",
|
||||
"personas",
|
||||
"schedules",
|
||||
"scheduling-policy",
|
||||
"tool-settings",
|
||||
"plugin-settings",
|
||||
@@ -75,6 +77,14 @@ test("control-plane resources belong to one settings narrative", () => {
|
||||
resourcesForPage(catalog, "tools").map(({ kind }) => kind),
|
||||
["tool-settings"],
|
||||
);
|
||||
assert.deepEqual(
|
||||
resourcesForPage(catalog, "personas").map(({ kind }) => kind),
|
||||
["personas"],
|
||||
);
|
||||
assert.deepEqual(
|
||||
resourcesForPage(catalog, "schedules").map(({ kind }) => kind),
|
||||
["schedules"],
|
||||
);
|
||||
assert.deepEqual(
|
||||
resourcesForPage(catalog, "advanced").map(({ kind }) => kind),
|
||||
[
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import {
|
||||
duplicatePersona,
|
||||
removePersona,
|
||||
renamePersona,
|
||||
} from "../src/settings/personas.ts";
|
||||
|
||||
const collection = () => ({
|
||||
default: "archie",
|
||||
personas: [
|
||||
{ name: "archie", prompt: "a" },
|
||||
{ name: "concise", prompt: "c" },
|
||||
],
|
||||
});
|
||||
|
||||
test("renaming the default persona keeps it the default", () => {
|
||||
const c = collection();
|
||||
renamePersona(c, 0, "archer");
|
||||
assert.equal(c.personas[0]!.name, "archer");
|
||||
assert.equal(c.default, "archer");
|
||||
renamePersona(c, 1, "brief");
|
||||
assert.equal(c.default, "archer");
|
||||
});
|
||||
|
||||
test("removing the default hands it to the first persona left", () => {
|
||||
const c = collection();
|
||||
assert.equal(removePersona(c, 0), true);
|
||||
assert.deepEqual(c, { default: "concise", personas: [{ name: "concise", prompt: "c" }] });
|
||||
});
|
||||
|
||||
test("the last persona cannot be removed", () => {
|
||||
const c = { default: "a", personas: [{ name: "a", prompt: "p" }] };
|
||||
assert.equal(removePersona(c, 0), false);
|
||||
assert.equal(c.personas.length, 1);
|
||||
});
|
||||
|
||||
test("a duplicate gets a free name and lands after the original", () => {
|
||||
const c = collection();
|
||||
assert.equal(duplicatePersona(c, 0), 1);
|
||||
assert.equal(duplicatePersona(c, 0), 1);
|
||||
assert.deepEqual(
|
||||
c.personas.map((p) => p.name),
|
||||
["archie", "archie-copy-2", "archie-copy", "concise"],
|
||||
);
|
||||
assert.equal(c.default, "archie");
|
||||
});
|
||||
Reference in new issue
Block a user