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:
@@ -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)
|
||||
|
||||
+1472
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")
|
||||
|
||||
Reference in New Issue
Block a user