diff options
| author | Igor Soarez <igor@soarez.org> | 2026-11-06 13:58:14 +0200 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-11-06 13:58:14 +0200 |
| commit | e01393235ef52fc05f2a4a3768f22e73eb12cd73 (patch) | |
| tree | 896229abd7d1a0a16492c887a7b422e990e34708 /config/pi/extensions/forum.ts | |
| parent | 3cfe984ab7e26aaad4a2442501526b6a2f232bc0 (diff) | |
pi forum: give a fresh session its notice with the first run
Appended to a session with no conversation yet -- a new pi, or just
after /new -- the join notice sat ahead of the system message pi records
at the first run, and pi then sent that message without its content: the
provider refused every request with a 400. Queue it for the next turn
instead, which pi places after the system message.
Diffstat (limited to 'config/pi/extensions/forum.ts')
| -rw-r--r-- | config/pi/extensions/forum.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/config/pi/extensions/forum.ts b/config/pi/extensions/forum.ts index 05d5edc..4b16103 100644 --- a/config/pi/extensions/forum.ts +++ b/config/pi/extensions/forum.ts @@ -567,10 +567,15 @@ export default function (pi: ExtensionAPI) { deliver(); } + // A notice that wakes nobody. A session with no conversation yet -- a fresh + // pi, or just after /new -- gets it with its first run instead: appended + // now, it would sit ahead of the system message pi records at that run, and + // pi then sends that message without its content, which providers reject. function notice(details: NoticeDetails, text: string) { + const started = session?.sessionManager.getBranch().some((e) => e.type === "message") ?? false; pi.sendMessage<NoticeDetails>( { customType: NOTICE_TYPE, content: text, display: true, details }, - { triggerTurn: false }, + started ? { triggerTurn: false } : { deliverAs: "nextTurn" }, ); } |
