Show a newly created bot in the rail at once
The rail was built from page props and only knew bots it already had, so a bot the coordinator created did not appear until a reload. create_bot and add_bot_to_workspace now push server:bot-created (BotCreatedData) to everyone who sees the bot: its rail row, the workspaces it is in, and whether it belongs in that user's own chat list. useLiveBots inserts it, after the pinned coordinator outside a workspace and only when the open workspace is one it joined. liveRelay pushes created bots too, so a bot added by another process still shows.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import BunSQLite from "@moduletrace/bun-sqlite";
|
||||
import { z } from "zod";
|
||||
import type { BUN_SQLITE_COBBLE_BOTS, BUN_SQLITE_COBBLE_WORKSPACES } from "@/db/types/db";
|
||||
import pushBotCreated from "@/src/bots-queue/push-bot-created";
|
||||
import addBotToWorkspace from "@/src/functions/backend/db/workspaces/add-bot-to-workspace";
|
||||
import type { HarnessTool } from "../../types";
|
||||
|
||||
@@ -74,6 +75,8 @@ export default function addBotToWorkspaceTool({
|
||||
bot_id: worker.id,
|
||||
});
|
||||
|
||||
await pushBotCreated({ bot: worker });
|
||||
|
||||
return `${worker.name} joined ${workspace.name}.`;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user