Private
Public Access
1
0

Make AI categorization prompts user-configurable

Add SystemPrompt and UserPromptTemplate fields to AI categorization
settings so users can customize the prompts sent to Ollama without
code changes. Null/empty values fall back to built-in defaults.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Catherine Renelle
2026-02-08 19:30:26 -05:00
parent 1c7abb7ffc
commit e742b0fbe7
9 changed files with 1750 additions and 40 deletions
@@ -12,6 +12,8 @@ public class AiCategorizationSettingsConfiguration : IEntityTypeConfiguration<Ai
builder.HasKey(s => s.Id);
builder.Property(s => s.OllamaUrl).HasMaxLength(500);
builder.Property(s => s.ModelName).HasMaxLength(100);
builder.Property(s => s.SystemPrompt).HasMaxLength(4000);
builder.Property(s => s.UserPromptTemplate).HasMaxLength(4000);
builder.HasOne(s => s.User)
.WithOne(u => u.AiCategorizationSettings)
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Purrse.Data.Migrations
{
/// <inheritdoc />
public partial class AddAiPromptTemplates : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "SystemPrompt",
table: "ai_categorization_settings",
type: "character varying(4000)",
maxLength: 4000,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "UserPromptTemplate",
table: "ai_categorization_settings",
type: "character varying(4000)",
maxLength: 4000,
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SystemPrompt",
table: "ai_categorization_settings");
migrationBuilder.DropColumn(
name: "UserPromptTemplate",
table: "ai_categorization_settings");
}
}
}
@@ -107,6 +107,10 @@ namespace Purrse.Data.Migrations
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<string>("SystemPrompt")
.HasMaxLength(4000)
.HasColumnType("character varying(4000)");
b.Property<int>("TimeoutSeconds")
.HasColumnType("integer");
@@ -119,6 +123,10 @@ namespace Purrse.Data.Migrations
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<string>("UserPromptTemplate")
.HasMaxLength(4000)
.HasColumnType("character varying(4000)");
b.HasKey("Id");
b.HasIndex("UserId")