Keep only the bot cookie for the last visited bot
CI / check (push) Canceled after 0s

A workspace conversation is never remembered, so /admin/bots always
reopens the bot's own chat.
This commit is contained in:
2026-10-22 13:39:36 +01:00
parent 133e6b87c9
commit 63a93a4262
13 changed files with 48 additions and 147 deletions
@@ -9,8 +9,8 @@ import type { BunextPageServerFn } from "@moduletrace/bunext/types";
* A bot's conversation inside a workspace: the bot works with the
* workspace's context, computers and models. Only the coordinator and the
* workspace's bots have one; anyone else goes back to the workspace
* settings (managers) or their bots. Rendering it records the conversation
* in the last-visited cookies, so `/admin/bots` opens it again.
* settings (managers) or their bots. Rendering it records the bot in the
* last-visited cookie, so `/admin/bots` opens its own chat again.
*/
export const server: BunextPageServerFn<PagePropsType> = async (params) => {
const query: PageQueryObject = params.query;
@@ -37,12 +37,11 @@ export const server: BunextPageServerFn<PagePropsType> = async (params) => {
}
const bot_id = props.bot.id;
const workspace_id = props.workspace?.id ?? query.workspace_id;
return {
props,
res_transform(res) {
return withLastVisitedBotCookies({ req: params.req, res, bot_id, workspace_id });
return withLastVisitedBotCookies({ req: params.req, res, bot_id });
},
};
};