Add halt tree, and copy message id features (#1088)

This commit is contained in:
Richard Macarthy
2023-02-05 15:09:39 +09:00
committed by GitHub
parent d10971341f
commit 3b61a26c9c
6 changed files with 81 additions and 11 deletions
@@ -0,0 +1,15 @@
import { withRole } from "src/lib/auth";
import { createApiClient } from "src/lib/oasst_client_factory";
const handler = withRole("admin", async (req, res, token) => {
const { id } = req.query;
try {
const client = await createApiClient(token);
await client.stop_tree(id as string);
res.status(200).json({ message: `Tree ${id} stopped`, id });
} catch (e) {
res.status(500).json(e);
}
});
export default handler;