Both were buried in the Server group beside game server plumbing. The nav now carries its own AI section, still superuser-gated by the same permissions, and Server keeps its seven game/server collections.
62 lines
2.1 KiB
TypeScript
62 lines
2.1 KiB
TypeScript
import type { GlobalConfig } from "payload";
|
|
|
|
import { requirePermission } from "@/utils/access-control/hasPermission";
|
|
|
|
/**
|
|
* Which model connection each AI surface uses.
|
|
*
|
|
* Blank means the env defaults (`UNSLOTH_URL`, `UNSLOTH_MODEL`,
|
|
* `UNSLOTH_API_KEY`), which is what ran before connections existed, so an empty
|
|
* global changes nothing. Surfaces are separate on purpose: dialogue drafting wants
|
|
* a model that follows a JSON schema, while a line rewrite only needs prose, and
|
|
* they can reasonably be different price points.
|
|
*
|
|
* Superuser-gated to match the connections it points at: choosing a connection for
|
|
* Compose repoints traffic that includes field content from every allowlisted
|
|
* collection, so this is not a dialogue-author permission.
|
|
*/
|
|
export const AiSettings: GlobalConfig = {
|
|
slug: "ai-settings",
|
|
label: "AI Settings",
|
|
admin: {
|
|
group: "AI",
|
|
description:
|
|
"Which model connection each AI surface uses. Leave a selector blank to use the Unsloth env defaults.",
|
|
},
|
|
access: {
|
|
read: requirePermission("system:admin-access"),
|
|
update: requirePermission("system:admin-access"),
|
|
},
|
|
fields: [
|
|
{
|
|
name: "composeConnection",
|
|
type: "relationship",
|
|
relationTo: "ai-connections",
|
|
hasMany: false,
|
|
admin: {
|
|
description:
|
|
"The AI Compose field assistant across every allowlisted collection. Blank uses the env defaults.",
|
|
},
|
|
},
|
|
{
|
|
name: "dialogueDraftConnection",
|
|
type: "relationship",
|
|
relationTo: "ai-connections",
|
|
hasMany: false,
|
|
admin: {
|
|
description:
|
|
"Whole-conversation NPC dialogue drafting. This one needs a model that reliably returns JSON in the configured structured mode. Blank uses the env defaults.",
|
|
},
|
|
},
|
|
{
|
|
name: "dialogueLineConnection",
|
|
type: "relationship",
|
|
relationTo: "ai-connections",
|
|
hasMany: false,
|
|
admin: {
|
|
description:
|
|
"Per-line rewrites (Rewrite, Shorten, Sharpen). Prose only, so a cheaper model is usually fine. Blank uses the env defaults.",
|
|
},
|
|
},
|
|
],
|
|
};
|