UNPKG

@websolutespa/payload-plugin-bowl-llm

Version:

LLM plugin for Bowl PayloadCms plugin

71 lines (70 loc) 2.13 kB
import { hasRole, isRole, roles } from '@websolutespa/payload-plugin-bowl'; import { KbFileNoToolOption } from '../api/consts'; import { options } from '../options'; export const LlmVectorDb = { type: 'withCollection', slug: options.slug.llmVectorDb, admin: { group: options.group.llm, defaultColumns: [ 'filename', 'createdAt', 'llmApp', 'appTool' ], hidden: (args)=>!hasRole(args.user, roles.Admin, roles.Contributor, roles.Editor), useAsTitle: 'name' }, access: { create: isRole(roles.Admin, roles.Contributor, roles.Editor), read: ()=>true, update: isRole(roles.Admin, roles.Contributor, roles.Editor), delete: isRole(roles.Admin, roles.Contributor, roles.Editor) }, hooks: { beforeChange: [ async ({ data })=>{ let createdAt = data.createdAt || new Date().toISOString(); createdAt = new Date(createdAt).toLocaleString('it-IT'); return { ...data, name: data.appTool && data.appTool !== KbFileNoToolOption ? `[${createdAt}] ${data.appTool} - ${data.filename}` : `[${createdAt}] ${data.filename}` }; } ] }, upload: true, fields: [ // inherited fields: id, createdAt, updatedAt { name: 'name', type: 'withText', admin: { hidden: true } }, { name: 'notes', type: 'textarea' }, { name: 'llmApp', type: 'relationship', relationTo: options.slug.llmApp, admin: { readOnly: true } }, { name: 'appTool', type: 'withText', admin: { components: { Field: '@websolutespa/payload-plugin-bowl-llm/client#AppTool' }, readOnly: true } } ] }; //# sourceMappingURL=LlmVectorDb.js.map