Spaces:
Running
Running
File size: 1,227 Bytes
fc69895 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
import { authPlugin } from "$api/authPlugin";
import { conversationGroup } from "$api/routes/groups/conversations";
import { userGroup } from "$api/routes/groups/user";
import { misc } from "$api/routes/groups/misc";
import { modelGroup } from "$api/routes/groups/models";
import { debugGroup } from "$api/routes/groups/debug";
import { Elysia } from "elysia";
import { base } from "$app/paths";
import { swagger } from "@elysiajs/swagger";
import { config } from "$lib/server/config";
import superjson from "superjson";
const prefix = `${base}/api/v2` as unknown as "";
export const app = new Elysia({ prefix })
.mapResponse(({ response, request }) => {
// Skip the /export endpoint
if (request.url.endsWith("/export")) {
return response as unknown as Response;
}
return new Response(superjson.stringify(response), {
headers: {
"Content-Type": "application/json",
},
});
})
.use(
swagger({
documentation: {
info: {
title: "chat-ui API",
version: config.PUBLIC_VERSION,
},
},
provider: "swagger-ui",
path: `swagger`,
})
)
.use(authPlugin)
.use(conversationGroup)
.use(userGroup)
.use(modelGroup)
.use(misc)
.use(debugGroup);
export type App = typeof app;
|