diff --git a/website/src/pages/api/chat/hide.ts b/website/src/pages/api/chat/hide.ts deleted file mode 100644 index ee92debe21..0000000000 --- a/website/src/pages/api/chat/hide.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { withoutRole } from "src/lib/auth"; -import { isChatEnable } from "src/lib/isChatEnable"; -import { createInferenceClient } from "src/lib/oasst_inference_client"; - -const handler = withoutRole("banned", async (req, res, token) => { - if (!isChatEnable()) { - return res.status(404).end(); - } - const client = createInferenceClient(token); - const { chat_id } = req.body as { chat_id: string }; - - await client.update_chat({ chat_id, hidden: true }); - - res.status(200).end(); -}); - -export default handler; diff --git a/website/src/pages/api/chat/index.ts b/website/src/pages/api/chat/index.ts index 1d7aebd888..6fccfdbc83 100644 --- a/website/src/pages/api/chat/index.ts +++ b/website/src/pages/api/chat/index.ts @@ -21,6 +21,9 @@ const handler = withoutRole("banned", async (req, res, token) => { // TODO: re-activate later // await client.delete_chat(req.query.chat_id as string); data = {}; + } else if (req.method === "PUT") { + await client.update_chat(req.body); + return res.status(200).end(); } if (data) { diff --git a/website/src/pages/api/chat/title.ts b/website/src/pages/api/chat/title.ts deleted file mode 100644 index c89f19ae61..0000000000 --- a/website/src/pages/api/chat/title.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { withoutRole } from "src/lib/auth"; -import { isChatEnable } from "src/lib/isChatEnable"; -import { createInferenceClient } from "src/lib/oasst_inference_client"; - -const handler = withoutRole("banned", async (req, res, token) => { - if (!isChatEnable()) { - return res.status(404).end(); - } - const client = createInferenceClient(token); - const { chat_id, title } = req.body as { chat_id: string; title: string }; - - await client.update_chat({ chat_id, title }); - - res.status(200).end(); -}); - -export default handler;