Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

933 B
Raw Blame
import type { Context } from 'hono';
import { Hono } from 'hono';

import acceptanceReview from './acceptance-review';
import device from './device';

const app = new Hono();

const fetchWith = async (
  c: Context,
  importer: () => Promise<{
    default: { fetch: (request: Request) => Promise<Response> | Response };
  }>,
) => (await importer()).default.fetch(c.req.raw);

app.get('/health', (c) =>
  c.json({
    ok: true,
    service: '@lobechat/server',
  }),
);

app.all('/api/agent', (c) => fetchWith(c, () => import('./agent')));
app.all('/api/agent/*', (c) => fetchWith(c, () => import('./agent')));
app.all('/api/acceptance-review/*', (c) => acceptanceReview.fetch(c.req.raw));
app.all('/api/device/managed/*', (c) => device.fetch(c.req.raw));
app.all('/api/workflows', (c) => fetchWith(c, () => import('./workflows')));
app.all('/api/workflows/*', (c) => fetchWith(c, () => import('./workflows')));

export default app;