feat(#130): add Personality Prisma schema and backend

Implement Personality system backend with database schema, service,
controller, and comprehensive tests. Personalities define assistant
behavior with system prompts and LLM configuration.

Changes:
- Update Personality model in schema.prisma with LLM provider relation
- Create PersonalitiesService with CRUD and default management
- Create PersonalitiesController with REST endpoints
- Add DTOs with validation (create/update)
- Add entity for type safety
- Remove unused PromptFormatterService
- Achieve 26 tests with full coverage

Endpoints:
- GET /personality - List all
- GET /personality/default - Get default
- GET /personality/by-name/:name - Get by name
- GET /personality/:id - Get one
- POST /personality - Create
- PATCH /personality/:id - Update
- DELETE /personality/:id - Delete
- POST /personality/:id/set-default - Set default

Fixes #130

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 12:44:50 -06:00
parent 1f97e6de40
commit 64cb5c1edd
12 changed files with 516 additions and 549 deletions

View File

@@ -1,15 +1,20 @@
import type { Personality as PrismaPersonality, FormalityLevel } from "@prisma/client";
import type { Personality as PrismaPersonality } from "@prisma/client";
/**
* Personality entity representing an assistant configuration
*/
export class Personality implements PrismaPersonality {
id!: string;
workspaceId!: string;
name!: string;
name!: string; // unique identifier slug
displayName!: string; // human-readable name
description!: string | null;
tone!: string;
formalityLevel!: FormalityLevel;
systemPromptTemplate!: string;
systemPrompt!: string;
temperature!: number | null; // null = use provider default
maxTokens!: number | null; // null = use provider default
llmProviderInstanceId!: string | null; // FK to LlmProviderInstance
isDefault!: boolean;
isActive!: boolean;
isEnabled!: boolean;
createdAt!: Date;
updatedAt!: Date;
}