mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-18 14:38:28 +00:00
* Feat: clustering fact statements * Feat: cluster drift * Feat: add recall count and model to search * Feat: Github integration * Fix: clustering UI * Improve graph * Bump: new version --------- Co-authored-by: Manoj K <saimanoj58@gmail.com>
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
import { json } from "@remix-run/node";
|
|
import { z } from "zod";
|
|
import { logger } from "~/services/logger.service";
|
|
import {
|
|
createLoaderApiRoute,
|
|
} from "~/services/routeBuilders/apiBuilder.server";
|
|
import { ClusteringService } from "~/services/clustering.server";
|
|
|
|
const clusteringService = new ClusteringService();
|
|
|
|
const loader = createLoaderApiRoute(
|
|
{
|
|
allowJWT: true,
|
|
findResource: async () => 1, // Dummy resource
|
|
authorization: {
|
|
action: "search",
|
|
},
|
|
corsStrategy: "all",
|
|
params: z.object({
|
|
clusterId: z.string(),
|
|
}),
|
|
},
|
|
async ({ authentication, params }) => {
|
|
try {
|
|
const statements = await clusteringService.getClusterStatements(
|
|
params.clusterId,
|
|
authentication.userId,
|
|
);
|
|
|
|
return json({
|
|
success: true,
|
|
data: {
|
|
clusterId: params.clusterId,
|
|
statements: statements,
|
|
},
|
|
});
|
|
} catch (error) {
|
|
logger.error("Error getting cluster statements:", { error });
|
|
return json(
|
|
{
|
|
success: false,
|
|
error: error instanceof Error ? error.message : "Unknown error",
|
|
},
|
|
{ status: 500 },
|
|
);
|
|
}
|
|
},
|
|
);
|
|
|
|
export { loader }; |