mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-10 08:58:31 +00:00
* Feat: v2 * feat: add chat functionality * First cut: integrations * Feat: add conversation API * Enhance conversation handling and memory management * Feat: added conversation --------- Co-authored-by: Manoj K <saimanoj58@gmail.com>
33 lines
946 B
TypeScript
33 lines
946 B
TypeScript
import { json } from "@remix-run/node";
|
|
import { createActionApiRoute } from "~/services/routeBuilders/apiBuilder.server";
|
|
import { OAuthBodySchema } from "~/services/oauth/oauth-utils.server";
|
|
|
|
import { getRedirectURL } from "~/services/oauth/oauth.server";
|
|
import { getWorkspaceByUser } from "~/models/workspace.server";
|
|
|
|
// This route handles the OAuth redirect URL generation, similar to the NestJS controller
|
|
const { action, loader } = createActionApiRoute(
|
|
{
|
|
body: OAuthBodySchema,
|
|
allowJWT: true,
|
|
authorization: {
|
|
action: "oauth",
|
|
},
|
|
corsStrategy: "all",
|
|
},
|
|
async ({ body, authentication, request }) => {
|
|
const workspace = await getWorkspaceByUser(authentication.userId);
|
|
|
|
// Call the service to get the redirect URL
|
|
const redirectURL = await getRedirectURL(
|
|
body,
|
|
authentication.userId,
|
|
workspace?.id,
|
|
);
|
|
|
|
return json(redirectURL);
|
|
},
|
|
);
|
|
|
|
export { action, loader };
|