diff --git a/.env.example b/.env.example index bfc3d7c..98c56e0 100644 --- a/.env.example +++ b/.env.example @@ -22,6 +22,15 @@ APP_URL=http://localhost:3000 # Coolify (or to your cron). See DEPLOYMENT.md. GAME_TICK_NOTIFY_SECRET=YOUR_GAME_TICK_NOTIFY_SECRET +# --- Unsloth AI (Payload AI Compose plugin) --- +# Base URL of the Unsloth Studio OpenAI-compatible API that serves the +# Ornith 9B model (the "Apex" connection lives on the apex-lnx machine). +# Defaults to the Apex box's LAN address; for the deployed site use whatever +# host can actually reach that box (VPN / tunnel / reverse proxy). +UNSLOTH_URL=http://192.168.1.7:8888/v1 +# sk-unsloth-... API key generated in Unsloth Studio (Settings -> API). +UNSLOTH_API_KEY=YOUR_UNSLOTH_API_KEY + # --- Bin script file logging --- # Optional. Payload bin scripts (game-tick, market-tick, mission-tick, # generate-mission) tee their logs to daily files. Defaults to /logs diff --git a/src/collections/game/GameRules.ts b/src/collections/game/GameRules.ts index b377f18..9b098a7 100644 --- a/src/collections/game/GameRules.ts +++ b/src/collections/game/GameRules.ts @@ -88,6 +88,16 @@ export const GameRules: GlobalConfig = { "Assignment(s) considered the intelligence division. Members and leaders of these assignments get elevated access to draft missions and intelligence content.", }, }, + { + name: "infantryAssignment", + type: "relationship", + relationTo: "assignments", + hasMany: false, + admin: { + description: + "Assignment that members are moved to when a division leader removes them from their division (the default destination for leadership-initiated transfers).", + }, + }, { name: "proximityThreshold", type: "number", diff --git a/src/migrations/20261003_060154_change_ai_model_to_ornith.ts b/src/migrations/20261003_060154_change_ai_model_to_ornith.ts new file mode 100644 index 0000000..7f66ebb --- /dev/null +++ b/src/migrations/20261003_060154_change_ai_model_to_ornith.ts @@ -0,0 +1,23 @@ +import { MigrateUpArgs, MigrateDownArgs, sql } from "@payloadcms/db-postgres"; + +export async function up({ db, payload, req }: MigrateUpArgs): Promise { + await db.execute(sql` + ALTER TABLE "plugin_ai_instructions" RENAME COLUMN "gemma_4_settings_model" TO "ornith_9b_settings_model"; + ALTER TABLE "plugin_ai_instructions" ALTER COLUMN "ornith_9b_settings_model" SET DEFAULT 'unsloth/Ornith-1.0-9B-GGUF'; + UPDATE "plugin_ai_instructions" SET "ornith_9b_settings_model" = 'unsloth/Ornith-1.0-9B-GGUF' WHERE "ornith_9b_settings_model" IS DISTINCT FROM 'unsloth/Ornith-1.0-9B-GGUF'; + ALTER TABLE "plugin_ai_instructions" ALTER COLUMN "model_id" SET DATA TYPE text; + DROP TYPE "public"."enum_plugin_ai_instructions_model_id"; + CREATE TYPE "public"."enum_plugin_ai_instructions_model_id" AS ENUM('unsloth/Ornith-1.0-9B-GGUF'); + ALTER TABLE "plugin_ai_instructions" ALTER COLUMN "model_id" SET DATA TYPE "public"."enum_plugin_ai_instructions_model_id" USING CASE WHEN "model_id" IS NULL THEN NULL ELSE 'unsloth/Ornith-1.0-9B-GGUF' END::"public"."enum_plugin_ai_instructions_model_id";`); +} + +export async function down({ db, payload, req }: MigrateDownArgs): Promise { + await db.execute(sql` + ALTER TABLE "plugin_ai_instructions" ALTER COLUMN "model_id" SET DATA TYPE text; + DROP TYPE "public"."enum_plugin_ai_instructions_model_id"; + CREATE TYPE "public"."enum_plugin_ai_instructions_model_id" AS ENUM('unsloth/gemma-4-26B-A4B-it-qat-GGUF'); + ALTER TABLE "plugin_ai_instructions" ALTER COLUMN "model_id" SET DATA TYPE "public"."enum_plugin_ai_instructions_model_id" USING CASE WHEN "model_id" IS NULL THEN NULL ELSE 'unsloth/gemma-4-26B-A4B-it-qat-GGUF' END::"public"."enum_plugin_ai_instructions_model_id"; + UPDATE "plugin_ai_instructions" SET "ornith_9b_settings_model" = 'unsloth/gemma-4-26B-A4B-it-qat-GGUF' WHERE "ornith_9b_settings_model" IS DISTINCT FROM 'unsloth/gemma-4-26B-A4B-it-qat-GGUF'; + ALTER TABLE "plugin_ai_instructions" ALTER COLUMN "ornith_9b_settings_model" SET DEFAULT 'unsloth/gemma-4-26B-A4B-it-qat-GGUF'; + ALTER TABLE "plugin_ai_instructions" RENAME COLUMN "ornith_9b_settings_model" TO "gemma_4_settings_model";`); +}