diff --git a/QYZH.InteractiveMagazine.IService/IAiBasePromptService.cs b/QYZH.InteractiveMagazine.IService/IAiBasePromptService.cs
new file mode 100644
index 0000000..79df82c
--- /dev/null
+++ b/QYZH.InteractiveMagazine.IService/IAiBasePromptService.cs
@@ -0,0 +1,45 @@
+using QYZH.InteractiveMagazine.Models.Dto;
+using QYZH.InteractiveMagazine.Models.Entity;
+
+namespace QYZH.InteractiveMagazine.IService;
+
+///
+/// AIPrompt配置服务接口
+///
+public interface IAiBasePromptService : IBaseService
+{
+ ///
+ /// 创建Prompt配置
+ ///
+ /// Prompt配置输入
+ /// 创建的Prompt配置信息
+ Task CreateAsync(AiBasePromptInput input);
+
+ ///
+ /// 更新Prompt配置
+ ///
+ /// Prompt配置ID
+ /// Prompt配置输入
+ /// 更新后的Prompt配置信息
+ Task UpdateAsync(long id, AiBasePromptInput input);
+
+ ///
+ /// 删除Prompt配置(软删除)
+ ///
+ /// Prompt配置ID
+ Task DeleteAsync(long id);
+
+ ///
+ /// 根据ID获取Prompt配置
+ ///
+ /// Prompt配置ID
+ /// Prompt配置信息
+ Task GetByIdAsync(long id);
+
+ ///
+ /// 分页查询Prompt配置列表
+ ///
+ /// 查询条件
+ /// 分页结果
+ Task> GetListAsync(AiBasePromptQueryInput input);
+}
diff --git a/QYZH.InteractiveMagazine.Models/Dto/Ai/AiBasePromptDto.cs b/QYZH.InteractiveMagazine.Models/Dto/Ai/AiBasePromptDto.cs
new file mode 100644
index 0000000..016a38b
--- /dev/null
+++ b/QYZH.InteractiveMagazine.Models/Dto/Ai/AiBasePromptDto.cs
@@ -0,0 +1,116 @@
+using QYZH.InteractiveMagazine.Models.Dto;
+
+namespace QYZH.InteractiveMagazine.Models.Dto;
+
+///
+/// AIPrompt配置创建/更新输入
+///
+public class AiBasePromptInput
+{
+ ///
+ /// 配置标识(如:DEFAULT, READING, COMPREHENSION)
+ ///
+ public string PromptKey { get; set; } = string.Empty;
+
+ ///
+ /// 配置名称(如:默认Prompt、阅读理解专用)
+ ///
+ public string PromptName { get; set; } = string.Empty;
+
+ ///
+ /// Prompt模板内容
+ ///
+ public string PromptTemplate { get; set; } = string.Empty;
+
+ ///
+ /// 配置说明
+ ///
+ public string? Description { get; set; }
+
+ ///
+ /// 优先级(数值越小优先级越高)
+ ///
+ public int Priority { get; set; }
+
+ ///
+ /// 是否为默认模板
+ ///
+ public bool IsDefault { get; set; } = true;
+}
+
+///
+/// AIPrompt配置输出
+///
+public class AiBasePromptOutput
+{
+ ///
+ /// 主键ID
+ ///
+ public long Id { get; set; }
+
+ ///
+ /// 配置标识
+ ///
+ public string PromptKey { get; set; } = string.Empty;
+
+ ///
+ /// 配置名称
+ ///
+ public string PromptName { get; set; } = string.Empty;
+
+ ///
+ /// Prompt模板内容
+ ///
+ public string PromptTemplate { get; set; } = string.Empty;
+
+ ///
+ /// 配置说明
+ ///
+ public string? Description { get; set; }
+
+ ///
+ /// 优先级
+ ///
+ public int Priority { get; set; }
+
+ ///
+ /// 是否为默认模板
+ ///
+ public bool IsDefault { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ public string? CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime CreatedAt { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ public string? UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ public DateTime? UpdatedAt { get; set; }
+}
+
+///
+/// AIPrompt配置分页查询输入
+///
+public class AiBasePromptQueryInput : PageQueryModel
+{
+ ///
+ /// 配置标识(精确匹配)
+ ///
+ public string? PromptKey { get; set; }
+
+ ///
+ /// 配置名称(模糊查询)
+ ///
+ public string? PromptName { get; set; }
+}
diff --git a/QYZH.InteractiveMagazine.Models/Dto/UsersDto.cs b/QYZH.InteractiveMagazine.Models/Dto/UsersDto.cs
index 29f0b3f..101178c 100644
--- a/QYZH.InteractiveMagazine.Models/Dto/UsersDto.cs
+++ b/QYZH.InteractiveMagazine.Models/Dto/UsersDto.cs
@@ -86,7 +86,7 @@ public class UserJournalItemOutput
///
/// 期刊标题
///
- public string JournalTitle { get; set; } = string.Empty;
+ public string Name { get; set; } = string.Empty;
///
/// 期刊封面
diff --git a/QYZH.InteractiveMagazine.Models/Entity/Journal.cs b/QYZH.InteractiveMagazine.Models/Entity/Journal.cs
index 2b8a678..38b930c 100644
--- a/QYZH.InteractiveMagazine.Models/Entity/Journal.cs
+++ b/QYZH.InteractiveMagazine.Models/Entity/Journal.cs
@@ -92,8 +92,6 @@ namespace QYZH.InteractiveMagazine.Models.Entity
public string PdfPreviewUrl { get; set; }
- public string Title { get; set; }
-
///
/// Desc:下载书籍页码点阵码PDF文件名称
/// Default:
diff --git a/QYZH.InteractiveMagazine.Models/Entity/JournalPageTask.cs b/QYZH.InteractiveMagazine.Models/Entity/JournalPageTask.cs
index 2a465f4..7907d61 100644
--- a/QYZH.InteractiveMagazine.Models/Entity/JournalPageTask.cs
+++ b/QYZH.InteractiveMagazine.Models/Entity/JournalPageTask.cs
@@ -152,5 +152,33 @@ namespace QYZH.InteractiveMagazine.Models.Entity
///
public string CustomPrompt {get;set;}
+ ///
+ /// Desc:理解力评分
+ /// Default:0
+ /// Nullable:False
+ ///
+ public float Comprehension {get;set;}
+
+ ///
+ /// Desc:判断力评分
+ /// Default:0
+ /// Nullable:False
+ ///
+ public float Judgment {get;set;}
+
+ ///
+ /// Desc:表达力评分
+ /// Default:0
+ /// Nullable:False
+ ///
+ public float Expression {get;set;}
+
+ ///
+ /// Desc:说服力评分
+ /// Default:0
+ /// Nullable:False
+ ///
+ public float Persuasiveness {get;set;}
+
}
}
diff --git a/QYZH.InteractiveMagazine.Models/Entity/JournalPageTaskUserAnswer.cs b/QYZH.InteractiveMagazine.Models/Entity/JournalPageTaskUserAnswer.cs
new file mode 100644
index 0000000..21849fd
--- /dev/null
+++ b/QYZH.InteractiveMagazine.Models/Entity/JournalPageTaskUserAnswer.cs
@@ -0,0 +1,216 @@
+using SqlSugar;
+using System;
+using System.Linq;
+using System.Text;
+
+namespace QYZH.InteractiveMagazine.Models.Entity
+{
+ ///
+ ///杂志任务用户作答记录;
+ ///
+ [SugarTable("JournalPageTaskUserAnswer")]
+ public partial class JournalPageTaskUserAnswer : SqlSugarBaseEntity
+ {
+ public JournalPageTaskUserAnswer(){
+
+
+ }
+
+ ///
+ /// Desc:书id
+ /// Default:
+ /// Nullable:False
+ ///
+ public long JournalId {get;set;}
+
+ ///
+ /// Desc:书页id
+ /// Default:
+ /// Nullable:False
+ ///
+ public long JournalPageId {get;set;}
+
+ ///
+ /// Desc:任务id
+ /// Default:
+ /// Nullable:False
+ ///
+ public long JournalPageTaskId {get;set;}
+
+ ///
+ /// Desc:任务分组id
+ /// Default:
+ /// Nullable:False
+ ///
+ public long JournalPageTaskGroupId {get;set;}
+
+ ///
+ /// Desc:用户id
+ /// Default:
+ /// Nullable:False
+ ///
+ public long UserId {get;set;}
+
+ ///
+ /// Desc:作答结果
+ /// Default:
+ /// Nullable:True
+ ///
+ public string Result {get;set;}
+
+ ///
+ /// Desc:积分
+ /// Default:0
+ /// Nullable:False
+ ///
+ public float Points {get;set;}
+
+ ///
+ /// Desc:成长值
+ /// Default:0
+ /// Nullable:False
+ ///
+ public float GrowthPoints {get;set;}
+
+ ///
+ /// Desc:题目作答图片地址
+ /// Default:
+ /// Nullable:True
+ ///
+ public string QuestionAnswerUrl {get;set;}
+
+ ///
+ /// Desc:答案图片地址
+ /// Default:
+ /// Nullable:True
+ ///
+ public string AnswerUrl {get;set;}
+
+ ///
+ /// Desc:页面作答图片地址
+ /// Default:
+ /// Nullable:True
+ ///
+ public string PageAnswerUrl {get;set;}
+
+ ///
+ /// Desc:乐观锁
+ /// Default:
+ /// Nullable:False
+ ///
+ public int Revision {get;set;}
+
+ ///
+ /// Desc:作答状态
+ /// Default:
+ /// Nullable:False
+ ///
+ public int AnswerStatus {get;set;}
+
+ ///
+ /// Desc:作答开始时间
+ /// Default:
+ /// Nullable:True
+ ///
+ public DateTime AnswerStartTime {get;set;}
+
+ ///
+ /// Desc:作答结束时间
+ /// Default:
+ /// Nullable:True
+ ///
+ public DateTime AnswerEndTime {get;set;}
+
+ ///
+ /// Desc:作答耗时(秒)
+ /// Default:0
+ /// Nullable:False
+ ///
+ public int AnswerSeconds {get;set;}
+
+ ///
+ /// Desc:图像识别结果
+ /// Default:
+ /// Nullable:False
+ ///
+ public int ImageRecognition {get;set;}
+
+ ///
+ /// Desc:书页序号
+ /// Default:
+ /// Nullable:False
+ ///
+ public int JournalPageNum {get;set;}
+
+ ///
+ /// Desc:修改次数
+ /// Default:
+ /// Nullable:False
+ ///
+ public int Modify {get;set;}
+
+ ///
+ /// Desc:最后标签id
+ /// Default:
+ /// Nullable:False
+ ///
+ public long LastTag {get;set;}
+
+ ///
+ /// Desc:点读书页序号
+ /// Default:
+ /// Nullable:False
+ ///
+ public int DotPageNum {get;set;}
+
+ ///
+ /// Desc:页面结果图片地址
+ /// Default:
+ /// Nullable:True
+ ///
+ public string PageResultUrl {get;set;}
+
+ ///
+ /// Desc:题型
+ /// Default:
+ /// Nullable:True
+ ///
+ public string Type {get;set;}
+
+ ///
+ /// Desc:点读书页编号
+ /// Default:
+ /// Nullable:True
+ ///
+ public string DotPageNo {get;set;}
+
+ ///
+ /// Desc:页面作答点读图片地址
+ /// Default:
+ /// Nullable:True
+ ///
+ public string PageAnswerDotUrl {get;set;}
+
+ ///
+ /// Desc:中断次数
+ /// Default:0
+ /// Nullable:False
+ ///
+ public int BreakCount {get;set;}
+
+ ///
+ /// Desc:中断时间记录
+ /// Default:
+ /// Nullable:True
+ ///
+ public string BreakTimes {get;set;}
+
+ ///
+ /// Desc:作业状态
+ /// Default:
+ /// Nullable:True
+ ///
+ public string AssignmentStatus {get;set;}
+
+ }
+}
diff --git a/QYZH.InteractiveMagazine.Service/AiBasePromptService.cs b/QYZH.InteractiveMagazine.Service/AiBasePromptService.cs
new file mode 100644
index 0000000..8d1d68c
--- /dev/null
+++ b/QYZH.InteractiveMagazine.Service/AiBasePromptService.cs
@@ -0,0 +1,254 @@
+using Microsoft.Extensions.Logging;
+using QYZH.InteractiveMagazine.IService;
+using QYZH.InteractiveMagazine.Models.Common;
+using QYZH.InteractiveMagazine.Models.Dto;
+using QYZH.InteractiveMagazine.Models.Entity;
+using QYZH.InteractiveMagazine.Repository;
+using SqlSugar;
+
+namespace QYZH.InteractiveMagazine.Service;
+
+///
+/// AIPrompt配置服务实现
+///
+public class AiBasePromptService(
+ BaseRepository promptRepository,
+ ILogger logger) : BaseRepository, IAiBasePromptService
+{
+
+ ///
+ /// 创建Prompt配置
+ ///
+ public async Task CreateAsync(AiBasePromptInput input)
+ {
+ logger.LogInformation("正在创建Prompt配置,PromptKey: {PromptKey}", input.PromptKey);
+
+ if (string.IsNullOrWhiteSpace(input.PromptKey))
+ {
+ throw new BusinessException("配置标识不能为空", 400);
+ }
+
+ if (string.IsNullOrWhiteSpace(input.PromptName))
+ {
+ throw new BusinessException("配置名称不能为空", 400);
+ }
+
+ if (string.IsNullOrWhiteSpace(input.PromptTemplate))
+ {
+ throw new BusinessException("Prompt模板内容不能为空", 400);
+ }
+
+ // 检查PromptKey是否已存在
+ var exists = await promptRepository.IsAnyAsync(p => p.PromptKey == input.PromptKey.Trim());
+ if (exists)
+ {
+ throw new BusinessException($"配置标识 '{input.PromptKey.Trim()}' 已存在", 400);
+ }
+
+ var entity = new AiBasePrompt
+ {
+ PromptKey = input.PromptKey.Trim(),
+ PromptName = input.PromptName.Trim(),
+ PromptTemplate = input.PromptTemplate,
+ Description = input.Description,
+ Priority = input.Priority,
+ IsDefault = input.IsDefault,
+ CreatedBy = "System",
+ UpdatedBy = "System",
+ CreatedAt = DateTime.Now,
+ UpdatedAt = DateTime.Now,
+ IsDeleted = false
+ };
+
+ var result = await promptRepository.InsertAsync(entity);
+ if (!result)
+ {
+ logger.LogError("Prompt配置创建失败,PromptKey: {PromptKey}", input.PromptKey);
+ throw new BusinessException("创建Prompt配置失败", 500);
+ }
+
+ logger.LogInformation("Prompt配置创建成功,PromptKey: {PromptKey}, ID: {Id}", input.PromptKey, entity.Id);
+
+ return new AiBasePromptOutput
+ {
+ Id = entity.Id,
+ PromptKey = entity.PromptKey,
+ PromptName = entity.PromptName,
+ PromptTemplate = entity.PromptTemplate,
+ Description = entity.Description,
+ Priority = entity.Priority,
+ IsDefault = entity.IsDefault,
+ CreatedBy = entity.CreatedBy,
+ CreatedAt = entity.CreatedAt,
+ UpdatedBy = entity.UpdatedBy,
+ UpdatedAt = entity.UpdatedAt
+ };
+ }
+
+ ///
+ /// 更新Prompt配置
+ ///
+ public async Task UpdateAsync(long id, AiBasePromptInput input)
+ {
+ logger.LogInformation("正在更新Prompt配置,ID: {Id}", id);
+
+ var entity = await promptRepository.GetByIdAsync(id);
+ if (entity == null)
+ {
+ logger.LogWarning("未找到要更新的Prompt配置,ID: {Id}", id);
+ throw new BusinessException("Prompt配置不存在", 404);
+ }
+
+ if (string.IsNullOrWhiteSpace(input.PromptKey))
+ {
+ throw new BusinessException("配置标识不能为空", 400);
+ }
+
+ if (string.IsNullOrWhiteSpace(input.PromptName))
+ {
+ throw new BusinessException("配置名称不能为空", 400);
+ }
+
+ if (string.IsNullOrWhiteSpace(input.PromptTemplate))
+ {
+ throw new BusinessException("Prompt模板内容不能为空", 400);
+ }
+
+ // 检查PromptKey是否被其他记录占用
+ var exists = await promptRepository.IsAnyAsync(p => p.PromptKey == input.PromptKey.Trim() && p.Id != id);
+ if (exists)
+ {
+ throw new BusinessException($"配置标识 '{input.PromptKey.Trim()}' 已被其他配置使用", 400);
+ }
+
+ entity.PromptKey = input.PromptKey.Trim();
+ entity.PromptName = input.PromptName.Trim();
+ entity.PromptTemplate = input.PromptTemplate;
+ entity.Description = input.Description;
+ entity.Priority = input.Priority;
+ entity.IsDefault = input.IsDefault;
+ entity.UpdatedBy = "System";
+ entity.UpdatedAt = DateTime.Now;
+
+ var result = await promptRepository.UpdateAsync(entity);
+ if (!result)
+ {
+ logger.LogError("Prompt配置更新失败,ID: {Id}", id);
+ throw new BusinessException("更新Prompt配置失败", 500);
+ }
+
+ logger.LogInformation("Prompt配置更新成功,ID: {Id}", id);
+
+ return new AiBasePromptOutput
+ {
+ Id = entity.Id,
+ PromptKey = entity.PromptKey,
+ PromptName = entity.PromptName,
+ PromptTemplate = entity.PromptTemplate,
+ Description = entity.Description,
+ Priority = entity.Priority,
+ IsDefault = entity.IsDefault,
+ CreatedBy = entity.CreatedBy,
+ CreatedAt = entity.CreatedAt,
+ UpdatedBy = entity.UpdatedBy,
+ UpdatedAt = entity.UpdatedAt
+ };
+ }
+
+ ///
+ /// 删除Prompt配置(软删除)
+ ///
+ public async Task DeleteAsync(long id)
+ {
+ logger.LogInformation("正在删除Prompt配置,ID: {Id}", id);
+
+ var entity = await promptRepository.GetByIdAsync(id);
+ if (entity == null)
+ {
+ logger.LogWarning("未找到要删除的Prompt配置,ID: {Id}", id);
+ throw new BusinessException("Prompt配置不存在", 404);
+ }
+
+ var result = await promptRepository.DeleteByIdAsync(id);
+ if (!result)
+ {
+ logger.LogError("Prompt配置删除失败,ID: {Id}", id);
+ throw new BusinessException("删除Prompt配置失败", 500);
+ }
+
+ logger.LogInformation("Prompt配置删除成功,ID: {Id}", id);
+ }
+
+ ///
+ /// 根据ID获取Prompt配置
+ ///
+ public async Task GetByIdAsync(long id)
+ {
+ logger.LogInformation("正在获取Prompt配置信息,ID: {Id}", id);
+
+ var entity = await promptRepository.GetByIdAsync(id);
+ if (entity == null)
+ {
+ logger.LogWarning("未找到Prompt配置,ID: {Id}", id);
+ throw new BusinessException("Prompt配置不存在", 404);
+ }
+
+ return new AiBasePromptOutput
+ {
+ Id = entity.Id,
+ PromptKey = entity.PromptKey,
+ PromptName = entity.PromptName,
+ PromptTemplate = entity.PromptTemplate,
+ Description = entity.Description,
+ Priority = entity.Priority,
+ IsDefault = entity.IsDefault,
+ CreatedBy = entity.CreatedBy,
+ CreatedAt = entity.CreatedAt,
+ UpdatedBy = entity.UpdatedBy,
+ UpdatedAt = entity.UpdatedAt
+ };
+ }
+
+ ///
+ /// 分页查询Prompt配置列表
+ ///
+ public async Task> GetListAsync(AiBasePromptQueryInput input)
+ {
+ logger.LogInformation("正在查询Prompt配置列表,页码: {PageIndex}, 每页条数: {PageSize}", input.PageIndex, input.PageSize);
+
+ if (input.PageIndex <= 0)
+ {
+ throw new BusinessException("页码必须大于0", 400);
+ }
+
+ if (input.PageSize <= 0 || input.PageSize > 100)
+ {
+ throw new BusinessException("每页条数必须在1-100之间", 400);
+ }
+
+ RefAsync totalNumber = 0;
+ var pageResult = await promptRepository.Queryable()
+ .WhereIF(!string.IsNullOrWhiteSpace(input.PromptKey), p => p.PromptKey == input.PromptKey)
+ .WhereIF(!string.IsNullOrWhiteSpace(input.PromptName), p => p.PromptName.Contains(input.PromptName))
+ .OrderBy(p => p.Priority)
+ .OrderByDescending(p => p.CreatedAt)
+ .ToPageListAsync(input.PageIndex, input.PageSize, totalNumber);
+
+ var result = pageResult.Select(p => new AiBasePromptOutput
+ {
+ Id = p.Id,
+ PromptKey = p.PromptKey,
+ PromptName = p.PromptName,
+ PromptTemplate = p.PromptTemplate,
+ Description = p.Description,
+ Priority = p.Priority,
+ IsDefault = p.IsDefault,
+ CreatedBy = p.CreatedBy,
+ CreatedAt = p.CreatedAt,
+ UpdatedBy = p.UpdatedBy,
+ UpdatedAt = p.UpdatedAt
+ }).ToList();
+
+ return new PageListModel(result, input.PageIndex, input.PageSize, totalNumber);
+ }
+}
diff --git a/QYZH.InteractiveMagazine.Service/JournalService.cs b/QYZH.InteractiveMagazine.Service/JournalService.cs
index 594e38b..fb91d4c 100644
--- a/QYZH.InteractiveMagazine.Service/JournalService.cs
+++ b/QYZH.InteractiveMagazine.Service/JournalService.cs
@@ -105,7 +105,6 @@ public class JournalService(BaseRepository JournalPageRepository,
Journal.Width = input.Width;
Journal.Height = input.Height;
Journal.Name = input.Name;
- Journal.Title = input.Title;
var res = await UseTranAsync(async () =>
{
diff --git a/QYZH.InteractiveMagazine.Service/UsersService.cs b/QYZH.InteractiveMagazine.Service/UsersService.cs
index 8059902..98e30c4 100644
--- a/QYZH.InteractiveMagazine.Service/UsersService.cs
+++ b/QYZH.InteractiveMagazine.Service/UsersService.cs
@@ -157,7 +157,7 @@ public class UsersService(
{
if (journalDict.TryGetValue(item.JournalId, out var journal))
{
- item.JournalTitle = journal.Title;
+ item.Name = journal.Name;
item.CoverImageUrl = journal.Cover;
}
}
diff --git a/QYZH.InteractiveMagazine.WebApi/Controllers/AiBasePromptController.cs b/QYZH.InteractiveMagazine.WebApi/Controllers/AiBasePromptController.cs
new file mode 100644
index 0000000..be30d59
--- /dev/null
+++ b/QYZH.InteractiveMagazine.WebApi/Controllers/AiBasePromptController.cs
@@ -0,0 +1,151 @@
+using Microsoft.AspNetCore.Mvc;
+using QYZH.InteractiveMagazine.IService;
+using QYZH.InteractiveMagazine.Models.Common;
+using QYZH.InteractiveMagazine.Models.Dto;
+using QYZH.InteractiveMagazine.Models.Enum;
+
+namespace QYZH.InteractiveMagazine.WebApi.Controllers;
+
+///
+/// AIPrompt配置管理控制器
+///
+[Route("api/[controller]")]
+[ApiController]
+[ApiExplorerSettings(GroupName = nameof(ApiVersionEnum.Platform))]
+public class AiBasePromptController : BaseController
+{
+ private readonly IAiBasePromptService _aiBasePromptService;
+ private readonly ILogger _logger;
+
+ public AiBasePromptController(IAiBasePromptService aiBasePromptService, ILogger logger)
+ {
+ _aiBasePromptService = aiBasePromptService;
+ _logger = logger;
+ }
+
+ ///
+ /// 创建Prompt配置
+ ///
+ /// Prompt配置信息
+ /// 创建的Prompt配置信息
+ [HttpPost]
+ public async Task> CreateAsync([FromBody] AiBasePromptInput input)
+ {
+ try
+ {
+ var result = await _aiBasePromptService.CreateAsync(input);
+ return Success(result, "创建Prompt配置成功");
+ }
+ catch (BusinessException ex)
+ {
+ _logger.LogWarning(ex, "创建Prompt配置业务异常: {Message}", ex.Message);
+ return BaseResponse.Fail(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "创建Prompt配置系统异常,参数:{Input}", input);
+ return BaseResponse.Fail("创建Prompt配置失败,请稍后重试");
+ }
+ }
+
+ ///
+ /// 更新Prompt配置
+ ///
+ /// Prompt配置ID
+ /// Prompt配置信息
+ /// 更新后的Prompt配置信息
+ [HttpPut("{id}")]
+ public async Task> UpdateAsync(long id, [FromBody] AiBasePromptInput input)
+ {
+ try
+ {
+ var result = await _aiBasePromptService.UpdateAsync(id, input);
+ return Success(result, "更新Prompt配置成功");
+ }
+ catch (BusinessException ex)
+ {
+ _logger.LogWarning(ex, "更新Prompt配置业务异常: {Message}", ex.Message);
+ return BaseResponse.Fail(ex.Message);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "更新Prompt配置系统异常,ID:{Id},参数:{Input}", id, input);
+ return BaseResponse.Fail("更新Prompt配置失败,请稍后重试");
+ }
+ }
+
+ ///
+ /// 删除Prompt配置
+ ///
+ /// Prompt配置ID
+ /// 操作结果
+ [HttpDelete("{id}")]
+ public async Task> DeleteAsync(long id)
+ {
+ try
+ {
+ await _aiBasePromptService.DeleteAsync(id);
+ return Success(new object(), "删除Prompt配置成功");
+ }
+ catch (BusinessException ex)
+ {
+ _logger.LogWarning(ex, "删除Prompt配置业务异常: {Message}", ex.Message);
+ return BaseResponse