fix: allow empty responsePrefix

This commit is contained in:
Peter Steinberger
2025-12-27 00:33:04 +00:00
parent 7e380bb6f8
commit 95f8f80e74
3 changed files with 28 additions and 1 deletions

View File

@@ -40,6 +40,7 @@
- System prompt now tags allowlisted owner numbers as the user identity to avoid mistaken “friend” assumptions.
- LM Studio/Ollama replies now require <final> tags; streaming ignores content until <final> begins.
- LM Studio responses API: tools payloads no longer include `strict: null`, and LM Studio no longer gets forced `<think>/<final>` tags.
- Empty `messages.responsePrefix` now disables the identity emoji prefix.
- `process log` pagination is now line-based (omit `offset` to grab the last N lines).
- macOS WebChat: assistant bubbles now update correctly when toggling light/dark mode.
- macOS: avoid spawning a duplicate gateway process when an external listener already exists.

View File

@@ -91,6 +91,32 @@ describe("config identity defaults", () => {
});
});
it("respects empty responsePrefix to disable identity defaults", async () => {
await withTempHome(async (home) => {
const configDir = path.join(home, ".clawdis");
await fs.mkdir(configDir, { recursive: true });
await fs.writeFile(
path.join(configDir, "clawdis.json"),
JSON.stringify(
{
identity: { name: "Samantha", theme: "helpful sloth", emoji: "🦥" },
messages: { responsePrefix: "" },
routing: {},
},
null,
2,
),
"utf-8",
);
vi.resetModules();
const { loadConfig } = await import("./config.js");
const cfg = loadConfig();
expect(cfg.messages?.responsePrefix).toBe("");
});
});
it("does not synthesize agent/session when absent", async () => {
await withTempHome(async (home) => {
const configDir = path.join(home, ".clawdis");

View File

@@ -878,7 +878,7 @@ function applyIdentityDefaults(cfg: ClawdisConfig): ClawdisConfig {
let mutated = false;
const next: ClawdisConfig = { ...cfg };
if (emoji && !messages.responsePrefix) {
if (emoji && messages.responsePrefix === undefined) {
next.messages = { ...(next.messages ?? messages), responsePrefix: emoji };
mutated = true;
}