UNPKG

@websolutespa/payload-plugin-bowl-llm

Version:

LLM plugin for Bowl PayloadCms plugin

22 lines (21 loc) 835 B
import { InMemoryCache } from '@websolutespa/payload-plugin-bowl'; import { ResponseSuccess } from '@websolutespa/payload-utils/server'; import { fetchRobot } from '../utils/robot'; import { errorHandler } from './error.handler'; const CACHE_ = new InMemoryCache(); export const endpointPostProcessorsHandler = async (req)=>{ try { let postProcessors; const cacheKey = 'endpoint_post_processors'; if (CACHE_.has(cacheKey)) { postProcessors = CACHE_.get(cacheKey); } else { postProcessors = await fetchRobot('api/llm/extension/json', 'GET'); CACHE_.set(cacheKey, postProcessors); } return ResponseSuccess(postProcessors); } catch (error) { return errorHandler(error); } }; //# sourceMappingURL=endpointPostProcessors.handler.js.map