From a47316079954bc8ae4270d5a3925a7278e9ecc6a Mon Sep 17 00:00:00 2001 From: "NANLV\\lyj94" Date: Tue, 22 Jul 2025 14:57:23 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E5=9C=A8=E5=BF=AB=E9=80=9F=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E4=B8=AD=E6=B7=BB=E5=8A=A0=E4=BA=86=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=89=80=E9=9C=80=E7=9A=84=E6=AD=A5=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 817e66663..f9d0426a7 100644 --- a/README.md +++ b/README.md @@ -52,9 +52,10 @@ start NcfPackageSources.sln # Windows open NcfPackageSources.sln # macOS ``` -3. 还原包 +3. 还原包并还原工作负载 ```bash dotnet restore +dotnet workload restore ``` 4. 编译运行 From 6975d4ef3b2c3a51522e5397e10884193f02361c Mon Sep 17 00:00:00 2001 From: "NANLV\\lyj94" Date: Sat, 16 Aug 2025 12:03:52 +0800 Subject: [PATCH 02/16] update --- README.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f9d0426a7..756252403 100644 --- a/README.md +++ b/README.md @@ -40,25 +40,34 @@ ## 快速开始 / Quick Start -1. 克隆仓库 + 1.克隆仓库 + ```bash git clone https://github.com/NeuCharFramework/NcfPackageSources.git ``` -2. 打开解决方案 +2.打开解决方案 + ```bash cd NcfPackageSources start NcfPackageSources.sln # Windows open NcfPackageSources.sln # macOS ``` -3. 还原包并还原工作负载 +3.还原包 + ```bash dotnet restore +``` + +4.还原工作负载(可选) + +```bash dotnet workload restore ``` -4. 编译运行 +5.编译运行 + ```bash dotnet build dotnet run From ef8a819f8a70dc1cc2ca7639966e04fedfa429f1 Mon Sep 17 00:00:00 2001 From: "NANLV\\lyj94" Date: Sat, 16 Aug 2025 18:20:48 +0800 Subject: [PATCH 03/16] =?UTF-8?q?1.=E5=9C=A8=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=98=AF=E5=90=A6=E8=BF=9B?= =?UTF-8?q?=E8=A1=8Cai=E8=AF=84=E5=88=86=E7=9A=84=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=AF=B9=E8=BF=99=E4=B8=AA=E6=A8=A1=E5=9D=97=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E4=BA=86=E7=89=88=E6=9C=AC=E5=8F=B7=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Pages/PromptRange/Prompt.cshtml | 4 +- .../20250816100529_Add_IsAIGrade.Designer.cs | 341 ++++++++++++++++++ .../20250816100529_Add_IsAIGrade.cs | 29 ++ ...eSenparcEntities_SqlServerModelSnapshot.cs | 151 ++++---- .../20250816100504_Add_IsAIGrade.Designer.cs | 328 +++++++++++++++++ .../Sqlite/20250816100504_Add_IsAIGrade.cs | 29 ++ ...angeSenparcEntities_SqliteModelSnapshot.cs | 5 +- .../Models/DatabaseModel/Dto/PromptItemDto.cs | 5 + .../Domain/Models/DatabaseModel/PromptItem.cs | 11 +- .../Domain/Services/PromptResultService.cs | 7 +- .../Local/PL/Request/PromptItem_AddRequest.cs | 4 + .../Senparc.Xncf.PromptRange/Register.cs | 3 +- .../Senparc.Xncf.PromptRange.ForNcf.csproj | 114 ------ .../Senparc.Xncf.PromptRange.csproj | 1 - .../wwwroot/js/PromptRange/prompt.js | 6 +- .../BuildXncfAppService.Generated.cs | 324 ++++++++--------- 16 files changed, 1001 insertions(+), 361 deletions(-) create mode 100644 src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Migrations.SqlServer/20250816100529_Add_IsAIGrade.Designer.cs create mode 100644 src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Migrations.SqlServer/20250816100529_Add_IsAIGrade.cs create mode 100644 src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Sqlite/20250816100504_Add_IsAIGrade.Designer.cs create mode 100644 src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Sqlite/20250816100504_Add_IsAIGrade.cs delete mode 100644 src/Extensions/Senparc.Xncf.PromptRange/Senparc.Xncf.PromptRange.ForNcf.csproj diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Areas/Admin/Pages/PromptRange/Prompt.cshtml b/src/Extensions/Senparc.Xncf.PromptRange/Areas/Admin/Pages/PromptRange/Prompt.cshtml index 018e0426d..191ca86ec 100644 --- a/src/Extensions/Senparc.Xncf.PromptRange/Areas/Admin/Pages/PromptRange/Prompt.cshtml +++ b/src/Extensions/Senparc.Xncf.PromptRange/Areas/Admin/Pages/PromptRange/Prompt.cshtml @@ -160,9 +160,9 @@ @* 设置ai评分标准 :disabled="!promptid" aiScoreFormOpenDialog aiScoreFormVisible = true*@
- 设置 AI 评分标准 + 设置 AI 评分标准 +
-
diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Migrations.SqlServer/20250816100529_Add_IsAIGrade.Designer.cs b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Migrations.SqlServer/20250816100529_Add_IsAIGrade.Designer.cs new file mode 100644 index 000000000..53cf78403 --- /dev/null +++ b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Migrations.SqlServer/20250816100529_Add_IsAIGrade.Designer.cs @@ -0,0 +1,341 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Senparc.Xncf.PromptRange.Models; + +#nullable disable + +namespace Senparc.Xncf.PromptRange.Domain.Migrations.SqlServer +{ + [DbContext(typeof(PromptRangeSenparcEntities_SqlServer))] + [Migration("20250816100529_Add_IsAIGrade")] + partial class Add_IsAIGrade + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Senparc.Xncf.PromptRange.Domain.Models.DatabaseModel.LlModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AddTime") + .HasColumnType("datetime2"); + + b.Property("AdminRemark") + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("Alias") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ApiKey") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("ApiVersion") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("DeploymentName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Endpoint") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Flag") + .HasColumnType("bit"); + + b.Property("IsShared") + .HasColumnType("bit"); + + b.Property("LastUpdateTime") + .HasColumnType("datetime2"); + + b.Property("MaxToken") + .HasColumnType("int"); + + b.Property("ModelType") + .HasMaxLength(20) + .HasColumnType("int"); + + b.Property("Note") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("OrganizationId") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Remark") + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("Show") + .HasColumnType("bit"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Senparc_PromptRange_LlModel"); + }); + + modelBuilder.Entity("Senparc.Xncf.PromptRange.Domain.Models.DatabaseModel.PromptItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AddTime") + .HasColumnType("datetime2"); + + b.Property("AdminRemark") + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("Aiming") + .HasMaxLength(5) + .HasColumnType("int"); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("EvalAvgScore") + .HasMaxLength(3) + .HasColumnType("decimal(18,2)"); + + b.Property("EvalMaxScore") + .HasMaxLength(3) + .HasColumnType("decimal(18,2)"); + + b.Property("ExpectedResultsJson") + .HasColumnType("nvarchar(max)"); + + b.Property("Flag") + .HasColumnType("bit"); + + b.Property("FrequencyPenalty") + .HasColumnType("real"); + + b.Property("FullVersion") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsAIGrade") + .HasColumnType("bit"); + + b.Property("IsDraft") + .HasColumnType("bit"); + + b.Property("IsShare") + .HasColumnType("bit"); + + b.Property("LastRunTime") + .HasColumnType("datetime2"); + + b.Property("LastUpdateTime") + .HasColumnType("datetime2"); + + b.Property("MaxToken") + .HasColumnType("int"); + + b.Property("ModelId") + .HasColumnType("int"); + + b.Property("NickName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Note") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("ParentTac") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Prefix") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("PresencePenalty") + .HasColumnType("real"); + + b.Property("RangeId") + .HasColumnType("int"); + + b.Property("RangeName") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("Remark") + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("StopSequences") + .HasColumnType("nvarchar(max)"); + + b.Property("Suffix") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Tactic") + .HasColumnType("nvarchar(max)"); + + b.Property("Temperature") + .HasColumnType("real"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("TopP") + .HasColumnType("real"); + + b.Property("VariableDictJson") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Senparc_PromptRange_PromptItem"); + }); + + modelBuilder.Entity("Senparc.Xncf.PromptRange.Domain.Models.DatabaseModel.PromptRange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AddTime") + .HasColumnType("datetime2"); + + b.Property("AdminRemark") + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("Alias") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Flag") + .HasColumnType("bit"); + + b.Property("LastUpdateTime") + .HasColumnType("datetime2"); + + b.Property("RangeName") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("Remark") + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Senparc_PromptRange_PromptRange"); + }); + + modelBuilder.Entity("Senparc.Xncf.PromptRange.Domain.Models.DatabaseModel.PromptResult", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AddTime") + .HasColumnType("datetime2"); + + b.Property("AdminRemark") + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("CostTime") + .HasColumnType("float"); + + b.Property("FinalScore") + .HasColumnType("decimal(18,2)"); + + b.Property("Flag") + .HasColumnType("bit"); + + b.Property("HumanScore") + .HasColumnType("decimal(18,2)"); + + b.Property("LastUpdateTime") + .HasColumnType("datetime2"); + + b.Property("LlmModelId") + .HasColumnType("int"); + + b.Property("PromptCostToken") + .HasColumnType("int"); + + b.Property("PromptItemId") + .HasColumnType("int"); + + b.Property("PromptItemVersion") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Remark") + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("ResultCostToken") + .HasColumnType("int"); + + b.Property("ResultString") + .HasColumnType("nvarchar(max)"); + + b.Property("RobotScore") + .HasColumnType("decimal(18,2)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("TestType") + .HasColumnType("int"); + + b.Property("TotalCostToken") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Senparc_PromptRange_PromptResult"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Migrations.SqlServer/20250816100529_Add_IsAIGrade.cs b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Migrations.SqlServer/20250816100529_Add_IsAIGrade.cs new file mode 100644 index 000000000..de9824617 --- /dev/null +++ b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Migrations.SqlServer/20250816100529_Add_IsAIGrade.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Senparc.Xncf.PromptRange.Domain.Migrations.SqlServer +{ + /// + public partial class Add_IsAIGrade : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsAIGrade", + table: "Senparc_PromptRange_PromptItem", + type: "bit", + nullable: false, + defaultValue: false); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "IsAIGrade", + table: "Senparc_PromptRange_PromptItem"); + } + } +} diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Migrations/SqlServer/PromptRangeSenparcEntities_SqlServerModelSnapshot.cs b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Migrations/SqlServer/PromptRangeSenparcEntities_SqlServerModelSnapshot.cs index b0dc26bbc..a3b6597c2 100644 --- a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Migrations/SqlServer/PromptRangeSenparcEntities_SqlServerModelSnapshot.cs +++ b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Migrations/SqlServer/PromptRangeSenparcEntities_SqlServerModelSnapshot.cs @@ -17,12 +17,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("ProductVersion", "8.0.10") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - modelBuilder.Entity("Senparc.Xncf.PromptRange.Models.LlModel", b => + modelBuilder.Entity("Senparc.Xncf.PromptRange.Domain.Models.DatabaseModel.LlModel", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -99,77 +99,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Senparc_PromptRange_LlModel"); }); - modelBuilder.Entity("Senparc.Xncf.PromptRange.Models.PromptResult", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AddTime") - .HasColumnType("datetime2"); - - b.Property("AdminRemark") - .HasMaxLength(300) - .HasColumnType("nvarchar(300)"); - - b.Property("CostTime") - .HasColumnType("float"); - - b.Property("FinalScore") - .HasColumnType("decimal(18,2)"); - - b.Property("Flag") - .HasColumnType("bit"); - - b.Property("HumanScore") - .HasColumnType("decimal(18,2)"); - - b.Property("LastUpdateTime") - .HasColumnType("datetime2"); - - b.Property("LlmModelId") - .HasColumnType("int"); - - b.Property("PromptCostToken") - .HasColumnType("int"); - - b.Property("PromptItemId") - .HasColumnType("int"); - - b.Property("PromptItemVersion") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Remark") - .HasMaxLength(300) - .HasColumnType("nvarchar(300)"); - - b.Property("ResultCostToken") - .HasColumnType("int"); - - b.Property("ResultString") - .HasColumnType("nvarchar(max)"); - - b.Property("RobotScore") - .HasColumnType("decimal(18,2)"); - - b.Property("TenantId") - .HasColumnType("int"); - - b.Property("TestType") - .HasColumnType("int"); - - b.Property("TotalCostToken") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("Senparc_PromptRange_PromptResult"); - }); - - modelBuilder.Entity("Senparc.Xncf.PromptRange.PromptItem", b => + modelBuilder.Entity("Senparc.Xncf.PromptRange.Domain.Models.DatabaseModel.PromptItem", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -213,6 +143,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(50) .HasColumnType("nvarchar(50)"); + b.Property("IsAIGrade") + .HasColumnType("bit"); + b.Property("IsDraft") .HasColumnType("bit"); @@ -288,7 +221,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Senparc_PromptRange_PromptItem"); }); - modelBuilder.Entity("Senparc.Xncf.PromptRange.PromptRange", b => + modelBuilder.Entity("Senparc.Xncf.PromptRange.Domain.Models.DatabaseModel.PromptRange", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -329,6 +262,76 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Senparc_PromptRange_PromptRange"); }); + + modelBuilder.Entity("Senparc.Xncf.PromptRange.Domain.Models.DatabaseModel.PromptResult", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AddTime") + .HasColumnType("datetime2"); + + b.Property("AdminRemark") + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("CostTime") + .HasColumnType("float"); + + b.Property("FinalScore") + .HasColumnType("decimal(18,2)"); + + b.Property("Flag") + .HasColumnType("bit"); + + b.Property("HumanScore") + .HasColumnType("decimal(18,2)"); + + b.Property("LastUpdateTime") + .HasColumnType("datetime2"); + + b.Property("LlmModelId") + .HasColumnType("int"); + + b.Property("PromptCostToken") + .HasColumnType("int"); + + b.Property("PromptItemId") + .HasColumnType("int"); + + b.Property("PromptItemVersion") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Remark") + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("ResultCostToken") + .HasColumnType("int"); + + b.Property("ResultString") + .HasColumnType("nvarchar(max)"); + + b.Property("RobotScore") + .HasColumnType("decimal(18,2)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("TestType") + .HasColumnType("int"); + + b.Property("TotalCostToken") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Senparc_PromptRange_PromptResult"); + }); #pragma warning restore 612, 618 } } diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Sqlite/20250816100504_Add_IsAIGrade.Designer.cs b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Sqlite/20250816100504_Add_IsAIGrade.Designer.cs new file mode 100644 index 000000000..91665e5a1 --- /dev/null +++ b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Sqlite/20250816100504_Add_IsAIGrade.Designer.cs @@ -0,0 +1,328 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Senparc.Xncf.PromptRange.Models; + +#nullable disable + +namespace Senparc.Xncf.PromptRange.Domain.Migrations.Sqlite +{ + [DbContext(typeof(PromptRangeSenparcEntities_Sqlite))] + [Migration("20250816100504_Add_IsAIGrade")] + partial class Add_IsAIGrade + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); + + modelBuilder.Entity("Senparc.Xncf.PromptRange.Domain.Models.DatabaseModel.LlModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddTime") + .HasColumnType("TEXT"); + + b.Property("AdminRemark") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("Alias") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ApiKey") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("ApiVersion") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("DeploymentName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Endpoint") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("TEXT"); + + b.Property("Flag") + .HasColumnType("INTEGER"); + + b.Property("IsShared") + .HasColumnType("INTEGER"); + + b.Property("LastUpdateTime") + .HasColumnType("TEXT"); + + b.Property("MaxToken") + .HasColumnType("INTEGER"); + + b.Property("ModelType") + .HasMaxLength(20) + .HasColumnType("INTEGER"); + + b.Property("Note") + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("OrganizationId") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Remark") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("Show") + .HasColumnType("INTEGER"); + + b.Property("TenantId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Senparc_PromptRange_LlModel"); + }); + + modelBuilder.Entity("Senparc.Xncf.PromptRange.Domain.Models.DatabaseModel.PromptItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddTime") + .HasColumnType("TEXT"); + + b.Property("AdminRemark") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("Aiming") + .HasMaxLength(5) + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("EvalAvgScore") + .HasMaxLength(3) + .HasColumnType("REAL"); + + b.Property("EvalMaxScore") + .HasMaxLength(3) + .HasColumnType("REAL"); + + b.Property("ExpectedResultsJson") + .HasColumnType("TEXT"); + + b.Property("Flag") + .HasColumnType("INTEGER"); + + b.Property("FrequencyPenalty") + .HasColumnType("REAL"); + + b.Property("FullVersion") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("IsAIGrade") + .HasColumnType("INTEGER"); + + b.Property("IsDraft") + .HasColumnType("INTEGER"); + + b.Property("IsShare") + .HasColumnType("INTEGER"); + + b.Property("LastRunTime") + .HasColumnType("TEXT"); + + b.Property("LastUpdateTime") + .HasColumnType("TEXT"); + + b.Property("MaxToken") + .HasColumnType("INTEGER"); + + b.Property("ModelId") + .HasColumnType("INTEGER"); + + b.Property("NickName") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Note") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("ParentTac") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Prefix") + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("PresencePenalty") + .HasColumnType("REAL"); + + b.Property("RangeId") + .HasColumnType("INTEGER"); + + b.Property("RangeName") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Remark") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("StopSequences") + .HasColumnType("TEXT"); + + b.Property("Suffix") + .HasMaxLength(10) + .HasColumnType("TEXT"); + + b.Property("Tactic") + .HasColumnType("TEXT"); + + b.Property("Temperature") + .HasColumnType("REAL"); + + b.Property("TenantId") + .HasColumnType("INTEGER"); + + b.Property("TopP") + .HasColumnType("REAL"); + + b.Property("VariableDictJson") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Senparc_PromptRange_PromptItem"); + }); + + modelBuilder.Entity("Senparc.Xncf.PromptRange.Domain.Models.DatabaseModel.PromptRange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddTime") + .HasColumnType("TEXT"); + + b.Property("AdminRemark") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("Alias") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Flag") + .HasColumnType("INTEGER"); + + b.Property("LastUpdateTime") + .HasColumnType("TEXT"); + + b.Property("RangeName") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b.Property("Remark") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Senparc_PromptRange_PromptRange"); + }); + + modelBuilder.Entity("Senparc.Xncf.PromptRange.Domain.Models.DatabaseModel.PromptResult", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddTime") + .HasColumnType("TEXT"); + + b.Property("AdminRemark") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("CostTime") + .HasColumnType("REAL"); + + b.Property("FinalScore") + .HasColumnType("TEXT"); + + b.Property("Flag") + .HasColumnType("INTEGER"); + + b.Property("HumanScore") + .HasColumnType("TEXT"); + + b.Property("LastUpdateTime") + .HasColumnType("TEXT"); + + b.Property("LlmModelId") + .HasColumnType("INTEGER"); + + b.Property("PromptCostToken") + .HasColumnType("INTEGER"); + + b.Property("PromptItemId") + .HasColumnType("INTEGER"); + + b.Property("PromptItemVersion") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Remark") + .HasMaxLength(300) + .HasColumnType("TEXT"); + + b.Property("ResultCostToken") + .HasColumnType("INTEGER"); + + b.Property("ResultString") + .HasColumnType("TEXT"); + + b.Property("RobotScore") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("INTEGER"); + + b.Property("TestType") + .HasColumnType("INTEGER"); + + b.Property("TotalCostToken") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Senparc_PromptRange_PromptResult"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Sqlite/20250816100504_Add_IsAIGrade.cs b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Sqlite/20250816100504_Add_IsAIGrade.cs new file mode 100644 index 000000000..c4fdf4a44 --- /dev/null +++ b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Sqlite/20250816100504_Add_IsAIGrade.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Senparc.Xncf.PromptRange.Domain.Migrations.Sqlite +{ + /// + public partial class Add_IsAIGrade : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsAIGrade", + table: "Senparc_PromptRange_PromptItem", + type: "INTEGER", + nullable: false, + defaultValue: false); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "IsAIGrade", + table: "Senparc_PromptRange_PromptItem"); + } + } +} diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Sqlite/PromptRangeSenparcEntities_SqliteModelSnapshot.cs b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Sqlite/PromptRangeSenparcEntities_SqliteModelSnapshot.cs index 5b35c7afa..52a1f3324 100644 --- a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Sqlite/PromptRangeSenparcEntities_SqliteModelSnapshot.cs +++ b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Migrations/Sqlite/PromptRangeSenparcEntities_SqliteModelSnapshot.cs @@ -15,7 +15,7 @@ partial class PromptRangeSenparcEntities_SqliteModelSnapshot : ModelSnapshot protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.0"); + modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); modelBuilder.Entity("Senparc.Xncf.PromptRange.Domain.Models.DatabaseModel.LlModel", b => { @@ -134,6 +134,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(50) .HasColumnType("TEXT"); + b.Property("IsAIGrade") + .HasColumnType("INTEGER"); + b.Property("IsDraft") .HasColumnType("INTEGER"); diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Models/DatabaseModel/Dto/PromptItemDto.cs b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Models/DatabaseModel/Dto/PromptItemDto.cs index feee4e4d4..3668387f6 100644 --- a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Models/DatabaseModel/Dto/PromptItemDto.cs +++ b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Models/DatabaseModel/Dto/PromptItemDto.cs @@ -81,6 +81,11 @@ public class PromptItemDto : DtoBase /// public string ExpectedResultsJson { get; set; } + /// + /// 是否启用“ai评分标准” + /// + public bool isAIGrade { get; set; } = false; + #endregion diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Models/DatabaseModel/PromptItem.cs b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Models/DatabaseModel/PromptItem.cs index 288886d8e..0d973a216 100644 --- a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Models/DatabaseModel/PromptItem.cs +++ b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Models/DatabaseModel/PromptItem.cs @@ -98,6 +98,9 @@ public class PromptItem : EntityBase /// public string ExpectedResultsJson { get; private set; } + public bool IsAIGrade { get; private set; } = false; + + #endregion #region Full Version @@ -318,7 +321,7 @@ public PromptItem(PromptRangeDto promptRange, string nickName, string tactic) public PromptItem(PromptItemDto dto) : this(dto.RangeId, dto.Content, dto.ModelId, dto.TopP, dto.Temperature, dto.MaxToken, dto.FrequencyPenalty, dto.PresencePenalty, dto.StopSequences, dto.RangeName, dto.Tactic, dto.Aiming, dto.ParentTac, dto.Note, - dto.IsDraft, dto.ExpectedResultsJson, + dto.IsDraft, dto.ExpectedResultsJson, dto.isAIGrade, dto.Prefix, dto.Suffix, dto.VariableDictJson) { Id = dto.Id; @@ -332,7 +335,7 @@ public PromptItem(PromptItemDto dto) : this(dto.RangeId, dto.Content, dto.ModelI public PromptItem(int rangeId, string content, int modelId, float topP, float temperature, int maxToken, float frequencyPenalty, float presencePenalty, string stopSequences, string rangeName, string tactic, int aiming, string parentTac, - string note, bool isDraft, string expectedResultsJson, + string note, bool isDraft, string expectedResultsJson, bool isAIGrade, string prefix, string suffix, string variableDictJson) { RangeId = rangeId; @@ -351,6 +354,7 @@ public PromptItem(int rangeId, string content, Note = note; IsDraft = isDraft; ExpectedResultsJson = expectedResultsJson; + IsAIGrade = isAIGrade; Prefix = prefix; Suffix = suffix; VariableDictJson = variableDictJson; @@ -361,7 +365,7 @@ public PromptItem(int rangeId, string content, public PromptItem(int rangeId, string rangeName, string tactic, int aiming, string parentTac, PromptItem_AddRequest request) : this(rangeId, request.Content, request.ModelId, request.TopP, request.Temperature, request.MaxToken, request.FrequencyPenalty, request.PresencePenalty, request.StopSequences, rangeName, tactic, aiming, parentTac, request.Note, request.IsDraft, - request.ExpectedResultsJson, + request.ExpectedResultsJson, request.isAIGrade, request.Prefix, request.Suffix, request.VariableDictJson) { } @@ -484,6 +488,7 @@ public PromptItem UpdateDraft(PromptItemDto dto) Note = dto.Note; ExpectedResultsJson = dto.ExpectedResultsJson; + IsAIGrade = dto.isAIGrade; Prefix = dto.Prefix; Suffix = dto.Suffix; diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Services/PromptResultService.cs b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Services/PromptResultService.cs index 82e99abea..1db4b2451 100644 --- a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Services/PromptResultService.cs +++ b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Services/PromptResultService.cs @@ -146,9 +146,12 @@ public async Task SenparcGenerateResultAsync(PromptItemDto prom await base.SaveObjectAsync(promptResult); // 有期望结果, 进行自动打分 - if (!string.IsNullOrWhiteSpace(promptItem.ExpectedResultsJson)) + if (promptItem.isAIGrade) { - await this.RobotScoringAsync(promptResult.Id, false, promptItem.ExpectedResultsJson); + if (!string.IsNullOrWhiteSpace(promptItem.ExpectedResultsJson)) + { + await this.RobotScoringAsync(promptResult.Id, false, promptItem.ExpectedResultsJson); + } } return this.Mapper.Map(promptResult); diff --git a/src/Extensions/Senparc.Xncf.PromptRange/OHS/Local/PL/Request/PromptItem_AddRequest.cs b/src/Extensions/Senparc.Xncf.PromptRange/OHS/Local/PL/Request/PromptItem_AddRequest.cs index 980ec6140..70aa644bc 100644 --- a/src/Extensions/Senparc.Xncf.PromptRange/OHS/Local/PL/Request/PromptItem_AddRequest.cs +++ b/src/Extensions/Senparc.Xncf.PromptRange/OHS/Local/PL/Request/PromptItem_AddRequest.cs @@ -64,6 +64,10 @@ public class PromptItem_AddRequest public string Note { get; set; } public string ExpectedResultsJson { get; set; } + /// + /// 是否启用“ai评分标准” + /// + public bool isAIGrade { get; set; } = false; public string Prefix { get; set; } public string Suffix { get; set; } diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Register.cs b/src/Extensions/Senparc.Xncf.PromptRange/Register.cs index 036b886e2..d5decebed 100644 --- a/src/Extensions/Senparc.Xncf.PromptRange/Register.cs +++ b/src/Extensions/Senparc.Xncf.PromptRange/Register.cs @@ -32,7 +32,7 @@ public partial class Register : XncfRegisterBase, IXncfRegister public override string Uid => "C6175B8E-9F79-4053-9523-F8E4AC0C3E18"; //必须确保全局唯一,生成后必须固定,已自动生成,也可自行修改 - public override string Version => "0.19.11"; //必须填写版本号 + public override string Version => "0.19.12"; //必须填写版本号 public override string MenuName => "提示词靶场"; @@ -130,3 +130,4 @@ public override IServiceCollection AddXncfModule(IServiceCollection services, IC + diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Senparc.Xncf.PromptRange.ForNcf.csproj b/src/Extensions/Senparc.Xncf.PromptRange/Senparc.Xncf.PromptRange.ForNcf.csproj deleted file mode 100644 index d605380f7..000000000 --- a/src/Extensions/Senparc.Xncf.PromptRange/Senparc.Xncf.PromptRange.ForNcf.csproj +++ /dev/null @@ -1,114 +0,0 @@ - - - net8.0 - 0.11.5.4-preview1 - - - 10.0 - true - true - ../Senparc.Web/App_Data/ApiDocXML/Senparc.Xncf.PromptRange.XML - Senparc.Xncf.PromptRange - Senparc.Xncf.PromptRange - true - 你的提示词(Prompt)训练场 - Senparc - Senparc,NeuCharFramework,NCF,Senparc.Xncf.PromptRange - Senparc - Senparc - Apache-2.0 - 提示词靶场 - - ../../../../NCF/src/back-end/Senparc.Web/App_Data/ApiDocXml/Senparc.Xncf.PromptRange.XML - $(MSBuildProjectDirectory)\ncf_obj\ - icon.jpg - - v0.1.0 创世 - v0.2.0 完成数据库和基本测试功能 - v0.2.0.1024 升级至 1024 特别版,支持 SK v1.0.0-beta3(2023.10.24发布) - v0.2.1 重构当前解决方案 XNCF 模块自动获取的方法到 Senparc.Xncf.XncfBase 项目中,位于 FunctionHelper.LoadXncfProjects() - v0.3.0 重构 PromptRange 数据库和逻辑 - v0.3.10 引用 Senparc.Xncf.AIKernel - v0.4.0 完成 PromptRange 基本功能 - v0.4.2 优化 PromptRange 模糊查询 - v0.4.7 支持手动打分精确到小数点后 1 位 - v0.4.11 添加 PromptResultService.GetPromptConfigParameterFromAiSetting() 方法 - v0.6.4 更新 Prompt 导入和导出 #207 - v0.6.5 优化通过 PromptRangeCode 查询 - [2024-08-06] v0.9.6.0-preview1 update Senparc.AI.Kernel - [2024-08-29] v0.9.9.0-preview1 更新首页统计 - [2024-08-31] v0.10.0-preview1 PromptRange 支持 Markdown 输出格式展示 - [2024-09-03] v0.10.1-preview1 PromptRange 结果提供“复制”功能 - [2024-09-04] v0.10.2-preview1 PromptRange 完善结果显示样式,添加“复制”功能 - [2024-09-07] v0.10.2.10-preview1 PromptRange 优化输出格式 - [2024-09-07] v0.10.2.11-preview1 PromptRange 修复自动初始化 Prompt 调用过程中的一个 bug - [2024-09-07] v0.10.3-preview1 更新 Senparc.AI 基础库,并在 XncfBuilder 使用 AI 生成代码时,优先使用已选中的模型。 - [2024-09-08] v0.10.3.1-preview1 优化 XncfBuilder AI 代码生成过程的模型选用 - [2024-09-10] v0.10.4-preview1 升级缓存基础库 - [2024-09-27] v0.10.5-preview1 修复首页的下拉栏过长的问题 - [2024-10-09] v0.10.7-preview1 升级基础库 - [2024-10-16] v0.10.8-preview1 添加 Service 对 PagedList 对象快速 Mapping 到 DTO 对象的方法 - - https://github.com/NeuCharFramework/NcfPackageSources - Debug;Release;Debug-Dapr;Test;TemplateRelease;NcfDebugForPromptRange - $(DefineConstants);DEBUG;NcfDebugForPromptRange - objForNcf\ - https://github.com/NeuCharFramework/NcfPackageSources - - - - - ..\..\BuildOutPut - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Senparc.Xncf.PromptRange.csproj b/src/Extensions/Senparc.Xncf.PromptRange/Senparc.Xncf.PromptRange.csproj index 6b42daf34..142c1516a 100644 --- a/src/Extensions/Senparc.Xncf.PromptRange/Senparc.Xncf.PromptRange.csproj +++ b/src/Extensions/Senparc.Xncf.PromptRange/Senparc.Xncf.PromptRange.csproj @@ -112,7 +112,6 @@ - diff --git a/src/Extensions/Senparc.Xncf.PromptRange/wwwroot/js/PromptRange/prompt.js b/src/Extensions/Senparc.Xncf.PromptRange/wwwroot/js/PromptRange/prompt.js index 2e06ee226..0dedd9a28 100644 --- a/src/Extensions/Senparc.Xncf.PromptRange/wwwroot/js/PromptRange/prompt.js +++ b/src/Extensions/Senparc.Xncf.PromptRange/wwwroot/js/PromptRange/prompt.js @@ -2,6 +2,7 @@ var app = new Vue({ el: "#app", data() { return { + isAIGrade: true, devHost: 'http://pr-felixj.frp.senparc.com', pageChange: false, // 页面是否有变化 isAvg: true, // 是否平均分 默认false 不平均 @@ -620,14 +621,15 @@ var app = new Vue({ prefix: this.promptParamForm.prefix } // ai评分标准 + _postData.isAIGrade = this.isAIGrade if (this.aiScoreForm.resultList.length > 0) { let _list = this.aiScoreForm.resultList.map(item => item.value) _list = _list.filter(item => item) if (_list.length > 0) { _postData.expectedResultsJson = JSON.stringify(_list) } - } + if (this.promptParamForm.variableList.length > 0) { _postData.variableDictJson = this.convertData(this.promptParamForm.variableList) } @@ -802,6 +804,7 @@ var app = new Vue({ } // ai评分标准 + _postData.isAIGrade = this.isAIGrade if (this.aiScoreForm.resultList.length > 0) { let _list = this.aiScoreForm.resultList.map(item => item.value) _list = _list.filter(item => item) @@ -809,6 +812,7 @@ var app = new Vue({ _postData.expectedResultsJson = JSON.stringify(_list) } } + // 请求参数 if (this.promptParamForm.variableList.length > 0) { _postData.variableDictJson = this.convertData(this.promptParamForm.variableList) diff --git a/src/Extensions/Senparc.Xncf.XncfBuilder/Senparc.Xncf.XncfBuilder/Generated/Senparc.Xncf.XncfBuilder.DynamicContentGenerator/MultiFileCodeGenerator/BuildXncfAppService.Generated.cs b/src/Extensions/Senparc.Xncf.XncfBuilder/Senparc.Xncf.XncfBuilder/Generated/Senparc.Xncf.XncfBuilder.DynamicContentGenerator/MultiFileCodeGenerator/BuildXncfAppService.Generated.cs index f09d62519..2c2d41eca 100644 --- a/src/Extensions/Senparc.Xncf.XncfBuilder/Senparc.Xncf.XncfBuilder/Generated/Senparc.Xncf.XncfBuilder.DynamicContentGenerator/MultiFileCodeGenerator/BuildXncfAppService.Generated.cs +++ b/src/Extensions/Senparc.Xncf.XncfBuilder/Senparc.Xncf.XncfBuilder/Generated/Senparc.Xncf.XncfBuilder.DynamicContentGenerator/MultiFileCodeGenerator/BuildXncfAppService.Generated.cs @@ -1,19 +1,19 @@ -// -// This file was generated by MultiFileCodeGenerator -// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. -// - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Senparc.Xncf.XncfBuilder.OHS.Local -{ - /// - /// 自动生成的NCF模板常量类,包含所有模板文件的内容 - /// - public partial class BuildXncfAppService - { +// +// This file was generated by MultiFileCodeGenerator +// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. +// + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Senparc.Xncf.XncfBuilder.OHS.Local +{ + /// + /// 自动生成的NCF模板常量类,包含所有模板文件的内容 + /// + public partial class BuildXncfAppService + { public const string BackendTemplate = @$" ## Database EntityFramework DbContext class sample File Name: Template_XncfNameSenparcEntities.cs @@ -47,7 +47,7 @@ public partial class BuildXncfAppService {ColorServiceTemplate} ``` "; - + public const string FrontendTemplate = @$" ## Page UI sample (front-end) File Name: DatabaseSampleIndex.cshtml @@ -81,14 +81,14 @@ public partial class BuildXncfAppService {DatabaseSampleIndexCssTemplate} ``` "; - - - #region CODE Templates - - /// - /// 请求类代码 - /// 类型: code - /// + + + #region CODE Templates + + /// + /// 请求类代码 + /// 类型: code + /// public const string RequestCode = @"using System; using System.Collections.Generic; using System.Linq; @@ -109,16 +109,16 @@ public class Request } } -"; - - #endregion - - #region BACKEND_TEMPLATE Templates - - /// - /// Senparc实体类模板 - /// 类型: backend_template - /// +"; + + #endregion + + #region BACKEND_TEMPLATE Templates + + /// + /// Senparc实体类模板 + /// 类型: backend_template + /// public const string SenparcEntitiesTemplate = @"using Microsoft.EntityFrameworkCore; using Senparc.Ncf.Database; using Senparc.Ncf.Core.Models; @@ -143,12 +143,12 @@ public Template_XncfNameSenparcEntities(DbContextOptions dbContextOptions) : bas //} } } -"; - - /// - /// 颜色模型模板 - /// 类型: backend_template - /// +"; + + /// + /// 颜色模型模板 + /// 类型: backend_template + /// public const string ColorModelTemplate = @"using Senparc.Ncf.Core.Models; using Template_OrgName.Xncf.Template_XncfName.Domain.Models.DatabaseModel.Dto; using System; @@ -244,12 +244,12 @@ public void Update(UpdateColorRequestDto dto) } } } -"; - - /// - /// 颜色DTO模板 - /// 类型: backend_template - /// +"; + + /// + /// 颜色DTO模板 + /// 类型: backend_template + /// public const string ColorDtoTemplate = @"using Senparc.Ncf.Core.Models; namespace Template_OrgName.Xncf.Template_XncfName.Domain.Models.DatabaseModel.Dto @@ -277,12 +277,12 @@ public class ColorDto : DtoBase public ColorDto() { } } } -"; - - /// - /// 颜色服务模板 - /// 类型: backend_template - /// +"; + + /// + /// 颜色服务模板 + /// 类型: backend_template + /// public const string ColorServiceTemplate = @"using Senparc.Ncf.Core.Enums; using Senparc.Ncf.Repository; using Senparc.Ncf.Service; @@ -350,16 +350,16 @@ public async Task Random() //TODO: 更多业务方法可以写到这里 } } -"; - - #endregion - - #region FRONTEND_TEMPLATE Templates - - /// - /// 数据库示例索引页面视图模板 - /// 类型: frontend_template - /// +"; + + #endregion + + #region FRONTEND_TEMPLATE Templates + + /// + /// 数据库示例索引页面视图模板 + /// 类型: frontend_template + /// public const string DatabaseSampleIndexViewTemplate = @"@page @model Template_OrgName.Xncf.Template_XncfName.Areas.Template_XncfName.Pages.DatabaseSampleIndex @{ @@ -535,12 +535,12 @@ @section breadcrumbs { @section scripts{ -} "; - - /// - /// 数据库示例索引页面代码后置模板 - /// 类型: frontend_template - /// +} "; + + /// + /// 数据库示例索引页面代码后置模板 + /// 类型: frontend_template + /// public const string DatabaseSampleIndexCodeBehindTemplate = @"using Microsoft.AspNetCore.Mvc; using Senparc.Ncf.Service; using Senparc.Ncf.Utility; @@ -785,16 +785,16 @@ public async Task OnGetColorDetailAsync(int id) } } } -} "; - - #endregion - - #region FRONTEND_SCRIPT Templates - - /// - /// 数据库示例索引页面JavaScript模板 - /// 类型: frontend_script - /// +} "; + + #endregion + + #region FRONTEND_SCRIPT Templates + + /// + /// 数据库示例索引页面JavaScript模板 + /// 类型: frontend_script + /// public const string DatabaseSampleIndexJsTemplate = @"var app = new Vue({ el: ""#app"", data() { @@ -1222,16 +1222,16 @@ await service.post('/Admin/Template_XncfName/DatabaseSampleIndex?handler=Randomi } } } -}); "; - - #endregion - - #region FRONTEND_STYLE Templates - - /// - /// 数据库示例索引页面CSS模板 - /// 类型: frontend_style - /// +}); "; + + #endregion + + #region FRONTEND_STYLE Templates + + /// + /// 数据库示例索引页面CSS模板 + /// 类型: frontend_style + /// public const string DatabaseSampleIndexCssTemplate = @"/* 通用样式 */ .d-flex{ display: flex; @@ -1450,76 +1450,76 @@ @keyframes fadeIn { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); transition: all 0.3s ease; -} "; - - #endregion - #region Template Types - - /// - /// 模板类型常量 - /// - public static class TemplateTypes - { - public const string CODE = "code"; - public const string BACKENDTEMPLATE = "backend_template"; - public const string FRONTENDTEMPLATE = "frontend_template"; - public const string FRONTENDSCRIPT = "frontend_script"; - public const string FRONTENDSTYLE = "frontend_style"; - } - - #endregion - - #region File Information - - /// - /// 所有模板文件信息 - /// - public static readonly TemplateFileInfo[] AllTemplateFiles = new TemplateFileInfo[] - { - new TemplateFileInfo("RequestCode", "请求类代码", "code", "Request.cs", RequestCode), - new TemplateFileInfo("SenparcEntitiesTemplate", "Senparc实体类模板", "backend_template", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/Domain/Models/DatabaseModel/Template_XncfNameSenparcEntities.cs", SenparcEntitiesTemplate), - new TemplateFileInfo("ColorModelTemplate", "颜色模型模板", "backend_template", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/Domain/Models/DatabaseModel/Color.cs", ColorModelTemplate), - new TemplateFileInfo("ColorDtoTemplate", "颜色DTO模板", "backend_template", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/Domain/Models/DatabaseModel/Dto/ColorDto.cs", ColorDtoTemplate), - new TemplateFileInfo("ColorServiceTemplate", "颜色服务模板", "backend_template", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/Domain/Services/ColorService.cs", ColorServiceTemplate), - new TemplateFileInfo("DatabaseSampleIndexViewTemplate", "数据库示例索引页面视图模板", "frontend_template", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/Areas/Admin/Pages/Template_XncfName/DatabaseSampleIndex.cshtml", DatabaseSampleIndexViewTemplate), - new TemplateFileInfo("DatabaseSampleIndexCodeBehindTemplate", "数据库示例索引页面代码后置模板", "frontend_template", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/Areas/Admin/Pages/Template_XncfName/DatabaseSampleIndex.cshtml.cs", DatabaseSampleIndexCodeBehindTemplate), - new TemplateFileInfo("DatabaseSampleIndexJsTemplate", "数据库示例索引页面JavaScript模板", "frontend_script", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/wwwroot/js/Admin/Template_XncfName/databaseSampleIndex.js", DatabaseSampleIndexJsTemplate), - new TemplateFileInfo("DatabaseSampleIndexCssTemplate", "数据库示例索引页面CSS模板", "frontend_style", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/wwwroot/css/Admin/Template_XncfName/databaseSampleIndex.css", DatabaseSampleIndexCssTemplate), - }; - - /// - /// 模板文件信息结构 - /// - public record TemplateFileInfo(string Name, string Description, string Type, string Path, string Content); - - #endregion - - #region Helper Methods - - /// - /// 根据类型获取模板文件 - /// - public static TemplateFileInfo[] GetTemplatesByType(string templateType) - { - return AllTemplateFiles.Where(f => f.Type == templateType).ToArray(); - } - - /// - /// 根据名称获取模板内容 - /// - public static string? GetTemplateContent(string templateName) - { - return AllTemplateFiles.FirstOrDefault(f => f.Name == templateName)?.Content; - } - - /// - /// 获取所有模板类型 - /// - public static string[] GetAllTemplateTypes() - { - return AllTemplateFiles.Select(f => f.Type).Distinct().ToArray(); - } - - #endregion - } -} +} "; + + #endregion + #region Template Types + + /// + /// 模板类型常量 + /// + public static class TemplateTypes + { + public const string CODE = "code"; + public const string BACKENDTEMPLATE = "backend_template"; + public const string FRONTENDTEMPLATE = "frontend_template"; + public const string FRONTENDSCRIPT = "frontend_script"; + public const string FRONTENDSTYLE = "frontend_style"; + } + + #endregion + + #region File Information + + /// + /// 所有模板文件信息 + /// + public static readonly TemplateFileInfo[] AllTemplateFiles = new TemplateFileInfo[] + { + new TemplateFileInfo("RequestCode", "请求类代码", "code", "Request.cs", RequestCode), + new TemplateFileInfo("SenparcEntitiesTemplate", "Senparc实体类模板", "backend_template", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/Domain/Models/DatabaseModel/Template_XncfNameSenparcEntities.cs", SenparcEntitiesTemplate), + new TemplateFileInfo("ColorModelTemplate", "颜色模型模板", "backend_template", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/Domain/Models/DatabaseModel/Color.cs", ColorModelTemplate), + new TemplateFileInfo("ColorDtoTemplate", "颜色DTO模板", "backend_template", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/Domain/Models/DatabaseModel/Dto/ColorDto.cs", ColorDtoTemplate), + new TemplateFileInfo("ColorServiceTemplate", "颜色服务模板", "backend_template", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/Domain/Services/ColorService.cs", ColorServiceTemplate), + new TemplateFileInfo("DatabaseSampleIndexViewTemplate", "数据库示例索引页面视图模板", "frontend_template", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/Areas/Admin/Pages/Template_XncfName/DatabaseSampleIndex.cshtml", DatabaseSampleIndexViewTemplate), + new TemplateFileInfo("DatabaseSampleIndexCodeBehindTemplate", "数据库示例索引页面代码后置模板", "frontend_template", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/Areas/Admin/Pages/Template_XncfName/DatabaseSampleIndex.cshtml.cs", DatabaseSampleIndexCodeBehindTemplate), + new TemplateFileInfo("DatabaseSampleIndexJsTemplate", "数据库示例索引页面JavaScript模板", "frontend_script", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/wwwroot/js/Admin/Template_XncfName/databaseSampleIndex.js", DatabaseSampleIndexJsTemplate), + new TemplateFileInfo("DatabaseSampleIndexCssTemplate", "数据库示例索引页面CSS模板", "frontend_style", "../../../../tools/NcfSimulatedSite/Template_OrgName.Xncf.Template_XncfName/wwwroot/css/Admin/Template_XncfName/databaseSampleIndex.css", DatabaseSampleIndexCssTemplate), + }; + + /// + /// 模板文件信息结构 + /// + public record TemplateFileInfo(string Name, string Description, string Type, string Path, string Content); + + #endregion + + #region Helper Methods + + /// + /// 根据类型获取模板文件 + /// + public static TemplateFileInfo[] GetTemplatesByType(string templateType) + { + return AllTemplateFiles.Where(f => f.Type == templateType).ToArray(); + } + + /// + /// 根据名称获取模板内容 + /// + public static string? GetTemplateContent(string templateName) + { + return AllTemplateFiles.FirstOrDefault(f => f.Name == templateName)?.Content; + } + + /// + /// 获取所有模板类型 + /// + public static string[] GetAllTemplateTypes() + { + return AllTemplateFiles.Select(f => f.Type).Distinct().ToArray(); + } + + #endregion + } +} From bed8f204f99a41620c7976f6ce31baf71e7263b6 Mon Sep 17 00:00:00 2001 From: "NANLV\\lyj94" Date: Sat, 30 Aug 2025 18:41:07 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E7=9B=98=E7=95=8C=E9=9D=A2=E5=92=8C=E4=BA=A4=E4=BA=92=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 `Index.cshtml` 中添加样式和结构,构建仪表盘用户界面,增强统计数据展示和图表容器的响应式布局,同时引入动画效果。 更新 `Register.Area.cs` 文件,新增指向仪表盘的菜单项。 在 `Senparc.Xncf.AIKernel.csproj` 中移除与仪表盘相关的 JavaScript 文件引用,保持项目结构整洁。 在 `Index.js` 中添加 Vue.js 实例初始化代码,定义数据和方法,提升仪表盘的交互性和动态效果。 --- .../Areas/Admin/Pages/Dashboard/Index.cshtml | 391 ++++++++++++++++++ .../Senparc.Xncf.AIKernel/Register.Area.cs | 3 +- .../Senparc.Xncf.AIKernel.csproj | 1 + .../wwwroot/js/Admin/Dashboard/Index.js | 379 +++++++++++++++++ 4 files changed, 773 insertions(+), 1 deletion(-) create mode 100644 src/Extensions/Senparc.Xncf.AIKernel/Areas/Admin/Pages/Dashboard/Index.cshtml create mode 100644 src/Extensions/Senparc.Xncf.AIKernel/wwwroot/js/Admin/Dashboard/Index.js diff --git a/src/Extensions/Senparc.Xncf.AIKernel/Areas/Admin/Pages/Dashboard/Index.cshtml b/src/Extensions/Senparc.Xncf.AIKernel/Areas/Admin/Pages/Dashboard/Index.cshtml new file mode 100644 index 000000000..0ddb551f0 --- /dev/null +++ b/src/Extensions/Senparc.Xncf.AIKernel/Areas/Admin/Pages/Dashboard/Index.cshtml @@ -0,0 +1,391 @@ +@page +@model Senparc.Xncf.AIKernel.Areas.AIKernel.Pages.Index +@{ + ViewData["Title"] = "AIKernel 仪表盘"; + Layout = "_Layout_Vue"; +} + +@section style { + +} + +@section breadcrumbs { + 扩展模块 + AI 核心模块 + 仪表盘 +} + + + + + + +
+ + + + + +
+
+
+ + +
+
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+ +
+
+
+
+
+
+
+ +@section scripts { + + +} \ No newline at end of file diff --git a/src/Extensions/Senparc.Xncf.AIKernel/Register.Area.cs b/src/Extensions/Senparc.Xncf.AIKernel/Register.Area.cs index 2dd055222..eb8d954a7 100644 --- a/src/Extensions/Senparc.Xncf.AIKernel/Register.Area.cs +++ b/src/Extensions/Senparc.Xncf.AIKernel/Register.Area.cs @@ -25,7 +25,8 @@ public partial class Register : IAreaRegister, //注册 XNCF 页面接口(按 public List AreaPageMenuItems => new List() { new AreaPageMenuItem(GetAreaHomeUrl(),"首页","fa fa-laptop"), -new AreaPageMenuItem(GetAreaUrl($"/Admin/AIVector/Index"),"向量数据库","fa fa-bookmark-o") +new AreaPageMenuItem(GetAreaUrl($"/Admin/AIVector/Index"),"向量数据库","fa fa-bookmark-o"), +new AreaPageMenuItem(GetAreaUrl($"/Admin/Dashboard/Index"),"仪表盘","fa fa-dashboard") //new AreaPageMenuItem(GetAreaUrl($"/Admin/AIKernel/DatabaseSample"),"数据库操作示例","fa fa-bookmark-o") }; diff --git a/src/Extensions/Senparc.Xncf.AIKernel/Senparc.Xncf.AIKernel.csproj b/src/Extensions/Senparc.Xncf.AIKernel/Senparc.Xncf.AIKernel.csproj index 2e212b106..6c79a709a 100644 --- a/src/Extensions/Senparc.Xncf.AIKernel/Senparc.Xncf.AIKernel.csproj +++ b/src/Extensions/Senparc.Xncf.AIKernel/Senparc.Xncf.AIKernel.csproj @@ -76,6 +76,7 @@ +
diff --git a/src/Extensions/Senparc.Xncf.AIKernel/wwwroot/js/Admin/Dashboard/Index.js b/src/Extensions/Senparc.Xncf.AIKernel/wwwroot/js/Admin/Dashboard/Index.js new file mode 100644 index 000000000..14c7b1f3b --- /dev/null +++ b/src/Extensions/Senparc.Xncf.AIKernel/wwwroot/js/Admin/Dashboard/Index.js @@ -0,0 +1,379 @@ +var app = new Vue({ + el: '#app', + data() { + return { + isExpandAll: true, + loading: false, + refreshTable: true, + xncfStat: {}, + xncfOpeningList: {}, + chartData: [], + todayLogData: [], + // 添加动画控制变量 + shakeAllModules: false, + glowUpgradeableModules: false + }; + }, + mounted() { + this.getXncfStat(); + this.getXncfOpening(); + this.fetchChartData(); + // 添加鼠标事件监听 + this.initializeHoverEffects(); + }, + methods: { + async fetchChartData() { + try { + let response = await service.get('/api/Senparc.Areas.Admin/StatAppService/Areas.Admin_StatAppService.GetLogs'); + if (response.data && response.data.data && response.data.data.logs) { + this.chartData = response.data.data.logs; + this.initChart(); + } else { + console.error('Invalid API response:', response); + } + } catch (error) { + console.error('Error fetching chart data:', error); + } + }, + initChart() { + + //----------------------------------下为chart1-------------------------------------- + let chart1 = document.getElementById('firstChart'); + let chartOption1 = { + title: { + text: '全部会话数', + subtext: '近 7 天' + }, + xAxis: { + type: 'category', + data: this.chartData.map(item => item.date) + }, + yAxis: { + type: 'value', + axisLabel: { + formatter: '{value} 次' + } + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'shadow' + } + }, + + series: [ + { + name: '全部会话数', + type: 'line', + stack: '总量', + areaStyle: { color: '#91c7ae' }, // 添加区域填充颜色 + data: this.chartData.map(item => item.normalLogCount), + color: '#91c7ae' + }, + ] + }; + let chartInstance1 = echarts.init(chart1); + chartInstance1.setOption(chartOption1); + + + + + //----------------------------------下为chart2-------------------------------------- + let chart2 = document.getElementById('secondChart'); + let chartOption2 = { + title: { + text: '活跃用户数', + subtext: '近 7 天' + }, + xAxis: { + type: 'category', + data: this.chartData.map(item => item.date) + }, + yAxis: { + type: 'value', + axisLabel: { + formatter: '{value} 人' + } + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'shadow' + } + }, + + series: [ + { + name: '活跃用户数', + type: 'line', + stack: '总量', + areaStyle: { color: '#91c7ae' }, // 添加区域填充颜色 + data: this.chartData.map(item => item.normalLogCount), + color: '#91c7ae' + }, + ] + }; + let chartInstance2 = echarts.init(chart2); + chartInstance2.setOption(chartOption2); + + + + + //----------------------------------下为chart3-------------------------------------- + let chart3 = document.getElementById('Chart3'); + let chartOption3 = { + title: { + text: '平均会话互动数', + subtext: '近 7 天' + }, + xAxis: { + type: 'category', + data: this.chartData.map(item => item.date) + }, + yAxis: { + type: 'value', + axisLabel: { + formatter: '{value} 次' + } + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'shadow' + } + }, + + series: [ + { + name: '平均会话互动数', + type: 'line', + stack: '总量', + areaStyle: { color: '#91c7ae' }, // 添加区域填充颜色 + data: this.chartData.map(item => item.normalLogCount), + color: '#91c7ae' + }, + ] + }; + let chartInstance3 = echarts.init(chart3); + chartInstance3.setOption(chartOption3); + + + + //----------------------------------下为chart4-------------------------------------- + let chart4 = document.getElementById('Chart4'); + let chartOption4 = { + title: { + text: 'Token 输出速度(Token/秒)', + subtext: '近 7 天' + }, + xAxis: { + type: 'category', + data: this.chartData.map(item => item.date) + }, + yAxis: { + type: 'value', + axisLabel: { + formatter: '{value} ' + } + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'shadow' + } + }, + + series: [ + { + name: 'Token 输出速度', + type: 'line', + stack: '总量', + areaStyle: { color: '#91c7ae' }, // 添加区域填充颜色 + data: this.chartData.map(item => item.normalLogCount), + color: '#91c7ae' + }, + ] + }; + let chartInstance4 = echarts.init(chart4); + chartInstance4.setOption(chartOption4); + + + //----------------------------------下为chart5-------------------------------------- + let chart5 = document.getElementById('Chart5'); + let chartOption5 = { + title: { + text: '用户满意度', + subtext: '近 7 天' + }, + xAxis: { + type: 'category', + data: this.chartData.map(item => item.date) + }, + yAxis: { + type: 'value', + axisLabel: { + formatter: '{value} 次' + } + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'shadow' + } + }, + + series: [ + { + name: '用户满意度', + type: 'line', + stack: '总量', + areaStyle: { color: '#91c7ae' }, // 添加区域填充颜色 + data: this.chartData.map(item => item.normalLogCount), + color: '#91c7ae' + }, + ] + }; + let chartInstance5 = echarts.init(chart5); + chartInstance5.setOption(chartOption5); + + + + //----------------------------------下为chart6-------------------------------------- + let chart6 = document.getElementById('Chart6'); + let chartOption6 = { + title: { + text: '全部消息数', + subtext: '近 7 天' + }, + xAxis: { + type: 'category', + data: this.chartData.map(item => item.date) + }, + yAxis: { + type: 'value', + axisLabel: { + formatter: '{value} 次' + } + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'shadow' + } + }, + + series: [ + { + name: '全部消息数', + type: 'line', + stack: '总量', + areaStyle: { color: '#91c7ae' }, // 添加区域填充颜色 + data: this.chartData.map(item => item.normalLogCount), + color: '#91c7ae' + }, + ] + }; + let chartInstance6 = echarts.init(chart6); + chartInstance6.setOption(chartOption6); + + + + + + + + + }, + //XNCF 统计状态 + async getXncfStat() { + let xncfStatData = await service.get('/Admin/Index?handler=XncfStat'); + this.xncfStat = xncfStatData.data.data; + }, + //开放模块数据 + async getXncfOpening() { + let xncfOpeningList = await service.get('/Admin/Index?handler=XncfOpening'); + this.xncfOpeningList = xncfOpeningList.data.data; + }, + //点击打开模块 + navigateTo(uid) { + window.location.href = '/Admin/XncfModule/Start/?uid=' + uid; + }, + getOpenDetail(rowIndex, menus) { + console.log(`rowIndex --- ${JSON.stringify(rowIndex)}`) + console.log(`menus --- ${JSON.stringify(menus)}`) + var menuInfo = menus[rowIndex] + window.location.href = menuInfo.url + }, + // 添加新方法处理悬停效果 + initializeHoverEffects() { + // 获取统计项元素 - 修正选择器 + const installedModulesStat = document.querySelector('.xncf-stat-item'); + const updateModulesStat = document.querySelectorAll('.xncf-stat-item')[1]; + + // 已安装模块统计项的鼠标事件 + if (installedModulesStat) { + installedModulesStat.addEventListener('mouseenter', () => { + this.triggerShakeAnimation(); + }); + } + + // 待更新模块统计项的鼠标事件 + if (updateModulesStat) { + updateModulesStat.addEventListener('mouseenter', () => { + this.triggerGlowAnimation(); + }); + } + }, + + // 触发抖动动画 + triggerShakeAnimation() { + const moduleCards = document.querySelectorAll('#xncf-modules-area .box-card'); + moduleCards.forEach(card => { + // 添加随机延迟 + const delay = Math.random() * 200; // 0-200ms的随机延迟 + setTimeout(() => { + card.classList.add('shake-animation'); + // 动画结束后移除类 + setTimeout(() => { + card.classList.remove('shake-animation'); + }, 800); // 与动画持续时间匹配 + }, delay); + }); + }, + + // 触发发光/淡化动画 + triggerGlowAnimation() { + const allCards = document.querySelectorAll('#xncf-modules-area .box-card'); + const upgradeableVersions = document.querySelectorAll('#xncf-modules-area .version-upgradeable'); + + // 为所有可更新的模块添加发光效果 + upgradeableVersions.forEach(version => { + const card = version.closest('.box-card'); + if (card) { + // 添加随机延迟 + const delay = Math.random() * 200; + setTimeout(() => { + card.classList.add('glow-animation'); + setTimeout(() => { + card.classList.remove('glow-animation'); + }, 1200); // 与动画持续时间匹配 + }, delay); + } + }); + + // 为不可更新的模块添加淡化效果 + allCards.forEach(card => { + if (!card.querySelector('.version-upgradeable')) { + // 添加随机延迟 + const delay = Math.random() * 200; + setTimeout(() => { + card.classList.add('fade-animation'); + setTimeout(() => { + card.classList.remove('fade-animation'); + }, 1200); // 与动画持续时间匹配 + }, delay); + } + }); + } + } +}); From 13b227976a624b5d4b286cb17cbdc81693d949b1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 14:59:27 +0000 Subject: [PATCH 05/16] Initial plan From 6fe96742d31041453d68ed5c340e599cf4c6c47d Mon Sep 17 00:00:00 2001 From: Jeffrey Su Date: Wed, 5 Nov 2025 22:59:32 +0800 Subject: [PATCH 06/16] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 756252403..494e2c871 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ ## 快速开始 / Quick Start - 1.克隆仓库 + 1. 克隆仓库 ```bash git clone https://github.com/NeuCharFramework/NcfPackageSources.git From e903d42b72d24d46beefb8980446815cc8a56319 Mon Sep 17 00:00:00 2001 From: Jeffrey Su Date: Wed, 5 Nov 2025 22:59:48 +0800 Subject: [PATCH 07/16] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 494e2c871..3cc0efc8e 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ git clone https://github.com/NeuCharFramework/NcfPackageSources.git ``` -2.打开解决方案 +2. 打开解决方案 ```bash cd NcfPackageSources From a58f3e18a7595ed9e2b2eb7d35cbca8a8d7c712c Mon Sep 17 00:00:00 2001 From: Jeffrey Su Date: Wed, 5 Nov 2025 22:59:59 +0800 Subject: [PATCH 08/16] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3cc0efc8e..e0e2b9a5a 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ start NcfPackageSources.sln # Windows open NcfPackageSources.sln # macOS ``` -3.还原包 +3. 还原包 ```bash dotnet restore From b16362fe8724fff29348caa7a857dbc7aa7a9389 Mon Sep 17 00:00:00 2001 From: Jeffrey Su Date: Wed, 5 Nov 2025 23:00:07 +0800 Subject: [PATCH 09/16] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e0e2b9a5a..2e5b93bf2 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ open NcfPackageSources.sln # macOS dotnet restore ``` -4.还原工作负载(可选) +4. 还原工作负载(可选) ```bash dotnet workload restore From 2f9de6de6aee914547a2b772d94bf3be2e3586c7 Mon Sep 17 00:00:00 2001 From: Jeffrey Su Date: Wed, 5 Nov 2025 23:00:17 +0800 Subject: [PATCH 10/16] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e5b93bf2..8ad16175b 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ dotnet restore dotnet workload restore ``` -5.编译运行 +5. 编译运行 ```bash dotnet build From d6f8d798418f0d4e38a07d76d7a00be83a0bd8ac Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 15:01:58 +0000 Subject: [PATCH 11/16] Initial plan From 908b90c216f05aa9d72f867db75f021b904ea12a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 15:02:20 +0000 Subject: [PATCH 12/16] Initial plan From fb9fe51819180eec82333595d16c1118340af9fd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 15:02:24 +0000 Subject: [PATCH 13/16] Fix missing whitespace between el-col tags Co-authored-by: JeffreySu <2281927+JeffreySu@users.noreply.github.com> --- .../Areas/Admin/Pages/Dashboard/Index.cshtml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Extensions/Senparc.Xncf.AIKernel/Areas/Admin/Pages/Dashboard/Index.cshtml b/src/Extensions/Senparc.Xncf.AIKernel/Areas/Admin/Pages/Dashboard/Index.cshtml index 0ddb551f0..16f829f19 100644 --- a/src/Extensions/Senparc.Xncf.AIKernel/Areas/Admin/Pages/Dashboard/Index.cshtml +++ b/src/Extensions/Senparc.Xncf.AIKernel/Areas/Admin/Pages/Dashboard/Index.cshtml @@ -366,7 +366,8 @@
- + +
@@ -375,7 +376,8 @@
-
+ +
From a74efa9f8e8f000f87870c598f8622f14481944c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 15:04:15 +0000 Subject: [PATCH 14/16] Fix missing whitespace between closing and opening tags Co-authored-by: JeffreySu <2281927+JeffreySu@users.noreply.github.com> --- .../Areas/Admin/Pages/Dashboard/Index.cshtml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Extensions/Senparc.Xncf.AIKernel/Areas/Admin/Pages/Dashboard/Index.cshtml b/src/Extensions/Senparc.Xncf.AIKernel/Areas/Admin/Pages/Dashboard/Index.cshtml index 0ddb551f0..d47687ef6 100644 --- a/src/Extensions/Senparc.Xncf.AIKernel/Areas/Admin/Pages/Dashboard/Index.cshtml +++ b/src/Extensions/Senparc.Xncf.AIKernel/Areas/Admin/Pages/Dashboard/Index.cshtml @@ -375,7 +375,8 @@
-
+ +
From 43ada08bef793c9e1f1f8d2c136d21e6a7e9bc4b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Nov 2025 15:05:23 +0000 Subject: [PATCH 15/16] Combine nested if statements in PromptResultService.cs Co-authored-by: JeffreySu <2281927+JeffreySu@users.noreply.github.com> --- .../Domain/Services/PromptResultService.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Services/PromptResultService.cs b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Services/PromptResultService.cs index 1db4b2451..024961c05 100644 --- a/src/Extensions/Senparc.Xncf.PromptRange/Domain/Services/PromptResultService.cs +++ b/src/Extensions/Senparc.Xncf.PromptRange/Domain/Services/PromptResultService.cs @@ -146,12 +146,9 @@ public async Task SenparcGenerateResultAsync(PromptItemDto prom await base.SaveObjectAsync(promptResult); // 有期望结果, 进行自动打分 - if (promptItem.isAIGrade) + if (promptItem.isAIGrade && !string.IsNullOrWhiteSpace(promptItem.ExpectedResultsJson)) { - if (!string.IsNullOrWhiteSpace(promptItem.ExpectedResultsJson)) - { - await this.RobotScoringAsync(promptResult.Id, false, promptItem.ExpectedResultsJson); - } + await this.RobotScoringAsync(promptResult.Id, false, promptItem.ExpectedResultsJson); } return this.Mapper.Map(promptResult); From b60b1295e1987e7fbf273eab19e5745a2afd6b7e Mon Sep 17 00:00:00 2001 From: JeffreySu Date: Thu, 6 Nov 2025 00:05:31 +0800 Subject: [PATCH 16/16] Update version numbers in Register.cs and .csproj files to 0.13.18 and 0.14.0-preview.1 respectively --- src/Extensions/Senparc.Xncf.PromptRange/Register.cs | 2 +- .../Senparc.Xncf.PromptRange/Senparc.Xncf.PromptRange.csproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Register.cs b/src/Extensions/Senparc.Xncf.PromptRange/Register.cs index 40e4898a9..9f6240056 100644 --- a/src/Extensions/Senparc.Xncf.PromptRange/Register.cs +++ b/src/Extensions/Senparc.Xncf.PromptRange/Register.cs @@ -32,7 +32,7 @@ public partial class Register : XncfRegisterBase, IXncfRegister public override string Uid => "C6175B8E-9F79-4053-9523-F8E4AC0C3E18"; //必须确保全局唯一,生成后必须固定,已自动生成,也可自行修改 - public override string Version => "0.13.17"; //必须填写版本号 + public override string Version => "0.13.18"; //必须填写版本号 public override string MenuName => "提示词靶场"; diff --git a/src/Extensions/Senparc.Xncf.PromptRange/Senparc.Xncf.PromptRange.csproj b/src/Extensions/Senparc.Xncf.PromptRange/Senparc.Xncf.PromptRange.csproj index 250082203..91f6ddb2e 100644 --- a/src/Extensions/Senparc.Xncf.PromptRange/Senparc.Xncf.PromptRange.csproj +++ b/src/Extensions/Senparc.Xncf.PromptRange/Senparc.Xncf.PromptRange.csproj @@ -1,7 +1,7 @@ net8.0 - 0.13.19-preview + 0.14.0-preview.1 10.0 @@ -65,8 +65,8 @@ [2025-05-18] v0.13.15-preview1 Update Installation [2025-06-20] v0.13.16-preview1 Add MCP functions in XncfRegisterBase class [2025-08-19] v0.13.17-preview.1 remove debug code in prompt.js - [2025-11-01] update basic libraries, including Senparc.AI + [2025-11-06] v0.14.0-preview.1 add AI score standard setting https://github.com/NeuCharFramework/NcfPackageSources Debug;Release;Debug-Dapr;Test;TemplateRelease;NcfDebugForPromptRange