From 0c79fb3519b5d3deacccbe1dae1bc9c70dfdf480 Mon Sep 17 00:00:00 2001 From: owenchen Date: Fri, 22 May 2026 11:45:04 +0800 Subject: [PATCH] ow --- .../AiBookOperationPage.Designer.cs | 141 ++++++++++++++---- CloudBuilder.AI.Gui/AiBookOperationPage.cs | 45 +++++- CloudBuilder.AI.Service/AiBookService.auto.cs | 52 +++++++ .../CloudBuilder.AI.Service.csproj | 3 + .../Entity/AiChapterPersonEntity.auto.cs | 17 ++- .../Entity/CloudBuilderAIRegistEntity.auto.cs | 1 + .../Service/IAiBookService.auto.cs | 4 + CloudBuilder.Request/AI/AiBookRequest.auto.cs | 14 ++ .../CloudBuilder.Web.Entry.csproj | 3 + .../Controllers/Ai/AiBookController.auto.cs | 47 ++++++ CloudBuilder.Web.Entry/appsettings.json | 9 +- 11 files changed, 296 insertions(+), 40 deletions(-) diff --git a/CloudBuilder.AI.Gui/AiBookOperationPage.Designer.cs b/CloudBuilder.AI.Gui/AiBookOperationPage.Designer.cs index dd64d4b..9b7c419 100644 --- a/CloudBuilder.AI.Gui/AiBookOperationPage.Designer.cs +++ b/CloudBuilder.AI.Gui/AiBookOperationPage.Designer.cs @@ -63,8 +63,6 @@ namespace CloudBuilder.AI.Gui tabPage2 = new TabPage(); tableLayoutPanel2 = new TableLayoutPanel(); statusCombo = new Krypton.Toolkit.KryptonComboBox(); - processBut = new Krypton.Toolkit.KryptonButton(); - uploadBut = new Krypton.Toolkit.KryptonButton(); guidLabel = new Krypton.Toolkit.KryptonLabel(); bookTypeLabel = new Krypton.Toolkit.KryptonLabel(); guidTxt = new Krypton.Toolkit.KryptonTextBox(); @@ -78,6 +76,10 @@ namespace CloudBuilder.AI.Gui filePathTxt = new Krypton.Toolkit.KryptonTextBox(); statusLabel = new Krypton.Toolkit.KryptonLabel(); bookTypeTxt = new Krypton.Toolkit.KryptonTextBox(); + processPanel = new TableLayoutPanel(); + processBut = new Krypton.Toolkit.KryptonButton(); + extractNamesBut = new Krypton.Toolkit.KryptonButton(); + uploadBut = new Krypton.Toolkit.KryptonButton(); kryptonPanel2 = new Krypton.Toolkit.KryptonPanel(); mainPanel = new TableLayoutPanel(); topPanel = new TableLayoutPanel(); @@ -96,6 +98,9 @@ namespace CloudBuilder.AI.Gui operationPanel = new TableLayoutPanel(); deleteBut = new Krypton.Toolkit.KryptonButton(); amendBut = new Krypton.Toolkit.KryptonButton(); + tableLayoutPanel7 = new TableLayoutPanel(); + kryptonDataGridView1 = new Krypton.Toolkit.KryptonDataGridView(); + kryptonDataGridView2 = new Krypton.Toolkit.KryptonDataGridView(); contentPanel.SuspendLayout(); tableLayoutPanel3.SuspendLayout(); tableLayoutPanel4.SuspendLayout(); @@ -106,8 +111,10 @@ namespace CloudBuilder.AI.Gui tableLayoutPanel6.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)sentenceGv).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGv).BeginInit(); + tabPage2.SuspendLayout(); tableLayoutPanel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)statusCombo).BeginInit(); + processPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)kryptonPanel2).BeginInit(); mainPanel.SuspendLayout(); topPanel.SuspendLayout(); @@ -116,6 +123,9 @@ namespace CloudBuilder.AI.Gui bottomPanel.SuspendLayout(); savePanel.SuspendLayout(); operationPanel.SuspendLayout(); + tableLayoutPanel7.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)kryptonDataGridView1).BeginInit(); + ((System.ComponentModel.ISupportInitialize)kryptonDataGridView2).BeginInit(); SuspendLayout(); // // contentPanel @@ -400,12 +410,13 @@ namespace CloudBuilder.AI.Gui // // tabPage2 // + tabPage2.Controls.Add(tableLayoutPanel7); tabPage2.Location = new Point(4, 24); tabPage2.Name = "tabPage2"; tabPage2.Padding = new Padding(3); tabPage2.Size = new Size(1004, 398); tabPage2.TabIndex = 1; - tabPage2.Text = "段落"; + tabPage2.Text = "人物角色表"; tabPage2.UseVisualStyleBackColor = true; // // tableLayoutPanel2 @@ -419,8 +430,6 @@ namespace CloudBuilder.AI.Gui tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle()); tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F)); tableLayoutPanel2.Controls.Add(statusCombo, 3, 0); - tableLayoutPanel2.Controls.Add(processBut, 3, 3); - tableLayoutPanel2.Controls.Add(uploadBut, 2, 3); tableLayoutPanel2.Controls.Add(guidLabel, 0, 0); tableLayoutPanel2.Controls.Add(bookTypeLabel, 0, 4); tableLayoutPanel2.Controls.Add(guidTxt, 1, 0); @@ -434,6 +443,7 @@ namespace CloudBuilder.AI.Gui tableLayoutPanel2.Controls.Add(filePathTxt, 1, 3); tableLayoutPanel2.Controls.Add(statusLabel, 2, 0); tableLayoutPanel2.Controls.Add(bookTypeTxt, 1, 4); + tableLayoutPanel2.Controls.Add(processPanel, 2, 3); tableLayoutPanel2.Dock = DockStyle.Fill; tableLayoutPanel2.Location = new Point(3, 3); tableLayoutPanel2.Name = "tableLayoutPanel2"; @@ -443,6 +453,7 @@ namespace CloudBuilder.AI.Gui tableLayoutPanel2.RowStyles.Add(new RowStyle()); tableLayoutPanel2.RowStyles.Add(new RowStyle()); tableLayoutPanel2.RowStyles.Add(new RowStyle()); + tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F)); tableLayoutPanel2.Size = new Size(1018, 187); tableLayoutPanel2.TabIndex = 0; // @@ -452,32 +463,12 @@ namespace CloudBuilder.AI.Gui statusCombo.DropDownStyle = ComboBoxStyle.DropDownList; statusCombo.DropDownWidth = 300; statusCombo.IntegralHeight = false; - statusCombo.Location = new Point(472, 3); + statusCombo.Location = new Point(446, 3); statusCombo.Name = "statusCombo"; - statusCombo.Size = new Size(300, 22); + statusCombo.Size = new Size(326, 22); statusCombo.StateCommon.ComboBox.Content.TextH = Krypton.Toolkit.PaletteRelativeAlign.Near; statusCombo.TabIndex = 5; // - // processBut - // - processBut.Location = new Point(472, 130); - processBut.Name = "processBut"; - processBut.Size = new Size(86, 25); - processBut.TabIndex = 2; - processBut.Values.Image = Properties.Resources.MoveNext; - processBut.Values.Text = "拆分章节"; - processBut.Click += processBut_Click; - // - // uploadBut - // - uploadBut.Location = new Point(380, 130); - uploadBut.Name = "uploadBut"; - uploadBut.Size = new Size(86, 25); - uploadBut.TabIndex = 2; - uploadBut.Values.Image = Properties.Resources.page_white_get; - uploadBut.Values.Text = "上传"; - uploadBut.Click += uploadBut_Click; - // // guidLabel // guidLabel.Location = new Point(3, 3); @@ -559,10 +550,10 @@ namespace CloudBuilder.AI.Gui // authorTxt // authorTxt.Dock = DockStyle.Fill; - authorTxt.Location = new Point(472, 32); + authorTxt.Location = new Point(446, 32); authorTxt.MaxLength = 500; authorTxt.Name = "authorTxt"; - authorTxt.Size = new Size(300, 23); + authorTxt.Size = new Size(326, 23); authorTxt.TabIndex = 3; // // filePathTxt @@ -590,6 +581,57 @@ namespace CloudBuilder.AI.Gui bookTypeTxt.Size = new Size(300, 23); bookTypeTxt.TabIndex = 3; // + // processPanel + // + processPanel.AutoSize = true; + processPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink; + processPanel.ColumnCount = 4; + tableLayoutPanel2.SetColumnSpan(processPanel, 2); + processPanel.ColumnStyles.Add(new ColumnStyle()); + processPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); + processPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); + processPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 80F)); + processPanel.Controls.Add(processBut, 1, 0); + processPanel.Controls.Add(extractNamesBut, 2, 0); + processPanel.Controls.Add(uploadBut, 0, 0); + processPanel.Location = new Point(377, 127); + processPanel.Margin = new Padding(0); + processPanel.Name = "processPanel"; + processPanel.RowCount = 1; + processPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); + processPanel.Size = new Size(356, 31); + processPanel.TabIndex = 6; + // + // processBut + // + processBut.Location = new Point(95, 3); + processBut.Name = "processBut"; + processBut.Size = new Size(86, 25); + processBut.TabIndex = 2; + processBut.Values.Image = Properties.Resources.MoveNext; + processBut.Values.Text = "拆分章节"; + processBut.Click += processBut_Click; + // + // extractNamesBut + // + extractNamesBut.Location = new Point(187, 3); + extractNamesBut.Name = "extractNamesBut"; + extractNamesBut.Size = new Size(86, 25); + extractNamesBut.TabIndex = 2; + extractNamesBut.Values.Image = Properties.Resources.MoveNext; + extractNamesBut.Values.Text = "识别人名"; + extractNamesBut.Click += extractNamesBut_Click; + // + // uploadBut + // + uploadBut.Location = new Point(3, 3); + uploadBut.Name = "uploadBut"; + uploadBut.Size = new Size(86, 25); + uploadBut.TabIndex = 2; + uploadBut.Values.Image = Properties.Resources.page_white_get; + uploadBut.Values.Text = "上传"; + uploadBut.Click += uploadBut_Click; + // // kryptonPanel2 // kryptonPanel2.Dock = DockStyle.Fill; @@ -805,6 +847,37 @@ namespace CloudBuilder.AI.Gui amendBut.Values.Text = "修改(&M)"; amendBut.Click += amendBut_Click; // + // tableLayoutPanel7 + // + tableLayoutPanel7.ColumnCount = 2; + tableLayoutPanel7.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); + tableLayoutPanel7.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); + tableLayoutPanel7.Controls.Add(kryptonDataGridView1, 0, 0); + tableLayoutPanel7.Controls.Add(kryptonDataGridView2, 1, 0); + tableLayoutPanel7.Location = new Point(76, 31); + tableLayoutPanel7.Name = "tableLayoutPanel7"; + tableLayoutPanel7.RowCount = 2; + tableLayoutPanel7.RowStyles.Add(new RowStyle(SizeType.Percent, 69.93671F)); + tableLayoutPanel7.RowStyles.Add(new RowStyle(SizeType.Percent, 30.0632915F)); + tableLayoutPanel7.Size = new Size(622, 316); + tableLayoutPanel7.TabIndex = 0; + // + // kryptonDataGridView1 + // + kryptonDataGridView1.BorderStyle = BorderStyle.None; + kryptonDataGridView1.Location = new Point(3, 3); + kryptonDataGridView1.Name = "kryptonDataGridView1"; + kryptonDataGridView1.Size = new Size(209, 173); + kryptonDataGridView1.TabIndex = 0; + // + // kryptonDataGridView2 + // + kryptonDataGridView2.BorderStyle = BorderStyle.None; + kryptonDataGridView2.Location = new Point(314, 3); + kryptonDataGridView2.Name = "kryptonDataGridView2"; + kryptonDataGridView2.Size = new Size(209, 173); + kryptonDataGridView2.TabIndex = 0; + // // AiBookOperationPage // AutoScaleDimensions = new SizeF(7F, 15F); @@ -824,9 +897,11 @@ namespace CloudBuilder.AI.Gui tableLayoutPanel6.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)sentenceGv).EndInit(); ((System.ComponentModel.ISupportInitialize)dataGv).EndInit(); + tabPage2.ResumeLayout(false); tableLayoutPanel2.ResumeLayout(false); tableLayoutPanel2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)statusCombo).EndInit(); + processPanel.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)kryptonPanel2).EndInit(); mainPanel.ResumeLayout(false); mainPanel.PerformLayout(); @@ -838,6 +913,9 @@ namespace CloudBuilder.AI.Gui bottomPanel.PerformLayout(); savePanel.ResumeLayout(false); operationPanel.ResumeLayout(false); + tableLayoutPanel7.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)kryptonDataGridView1).EndInit(); + ((System.ComponentModel.ISupportInitialize)kryptonDataGridView2).EndInit(); ResumeLayout(false); } @@ -904,5 +982,10 @@ namespace CloudBuilder.AI.Gui private Krypton.Toolkit.KryptonDataGridViewTextBoxColumn genderCol; private Krypton.Toolkit.KryptonDataGridViewTextBoxColumn sentimentCol; private Krypton.Toolkit.KryptonDataGridViewComboBoxColumn sentenceStatusCol; + private TableLayoutPanel processPanel; + private Krypton.Toolkit.KryptonButton extractNamesBut; + private TableLayoutPanel tableLayoutPanel7; + private Krypton.Toolkit.KryptonDataGridView kryptonDataGridView1; + private Krypton.Toolkit.KryptonDataGridView kryptonDataGridView2; } } diff --git a/CloudBuilder.AI.Gui/AiBookOperationPage.cs b/CloudBuilder.AI.Gui/AiBookOperationPage.cs index 9e0585d..1d58baf 100644 --- a/CloudBuilder.AI.Gui/AiBookOperationPage.cs +++ b/CloudBuilder.AI.Gui/AiBookOperationPage.cs @@ -260,21 +260,21 @@ namespace CloudBuilder.AI.Gui guiOperateHelper.EnableControls(false, contentPanel); //查詢有記錄時,修改等控件有效 if (aiBookEntity != null) - guiOperateHelper.EnableControls(true, bottomPanel, uploadBut, processBut, gridViewPagination); + guiOperateHelper.EnableControls(true, bottomPanel, processPanel,gridViewPagination); else - guiOperateHelper.EnableControls(false, bottomPanel, uploadBut, processBut, gridViewPagination); + guiOperateHelper.EnableControls(false, bottomPanel, processPanel, gridViewPagination); } else if (this.DisplayMode == GuiDisplayMode.Amend || this.DisplayMode == GuiDisplayMode.Create) { savePanel.Visible = true; operationPanel.Visible = false; - guiOperateHelper.EnableControls(false, topPanel, uploadBut, processBut, gridViewPagination); + guiOperateHelper.EnableControls(false, topPanel, processPanel, gridViewPagination); guiOperateHelper.EnableControls(true, bottomPanel, contentPanel); if (this.DisplayMode == GuiDisplayMode.Amend) guiOperateHelper.EnableControls(false, guidTxt); } - + } private void PackUIToEntity() @@ -347,6 +347,7 @@ namespace CloudBuilder.AI.Gui filter.Value = data.AiBook.Guid; filters.Add(filter); + searchCriteria.Filter = filters.ToArray(); return searchCriteria; } @@ -413,7 +414,7 @@ namespace CloudBuilder.AI.Gui filePathTxt.Text = data.FileName; - SearchChapter(); + SearchChapter(); } private void Reset() @@ -743,7 +744,39 @@ namespace CloudBuilder.AI.Gui AiChapterEntity chapter = dataGv.GetRowData(dataGv.SelectedCells[0].RowIndex); - AiSentenceViewEntity[] aiSentences= aiSentenceRequest.FindByChapterGuid(chapter.Guid); + AiSentenceViewEntity[] aiSentences = aiSentenceRequest.FindByChapterGuid(chapter.Guid); + + sentenceGv.SetDataSource(aiSentences); + } + catch (ValidatedException ex) + { + ShowMessageBox.ShowInfo(ex.Message); + } + catch (ServiceErrorException ex) + { + ShowMessageBox.ShowError(ex.Message); + } + catch (Exception ex) + { + ShowMessageBox.ShowError(ex.Message); + } + } + + private void extractNamesBut_Click(object sender, EventArgs e) + { + try + { + if (dataGv.RowCount <= 0 || dataGv.SelectedCells.Count <= 0) + { + ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_WS_RECORD_NOT_FOUND)); + return; + } + + AiChapterEntity chapter = dataGv.GetRowData(dataGv.SelectedCells[0].RowIndex); + + aiBookRequest.ExtractNamesByChapterGuid(data.AiBook.Guid, chapter.Guid); + + AiSentenceViewEntity[] aiSentences = aiSentenceRequest.FindByChapterGuid(chapter.Guid); sentenceGv.SetDataSource(aiSentences); } diff --git a/CloudBuilder.AI.Service/AiBookService.auto.cs b/CloudBuilder.AI.Service/AiBookService.auto.cs index 5ade041..d235334 100644 --- a/CloudBuilder.AI.Service/AiBookService.auto.cs +++ b/CloudBuilder.AI.Service/AiBookService.auto.cs @@ -12,6 +12,7 @@ using CloudBuilder.Security.Policy; using CloudBuilder.Security.Service; using CloudBuilder.Security.Utility; using DocumentFormat.OpenXml.ExtendedProperties; +using DocumentFormat.OpenXml.Presentation; using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.DependencyInjection; using System.Diagnostics.Contracts; @@ -24,6 +25,8 @@ namespace CloudBuilder.AI.Service private readonly IApplicationService service; private IRepository repository; + + private ChineseNameExtractor chineseNameExtractor; public AiBookService(IApplicationService service) { this.service = service; @@ -252,5 +255,54 @@ namespace CloudBuilder.AI.Service return FindByKey(key); } + + [PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Update)] + [UnitOfWork] + public void ExtractNames(string bookGuid) + { + ExtractNamesByChapterGuid(bookGuid, null); + } + + [PermissionOperate(name: AIPermissionPolicy.AiBook, operate: Operate.Update)] + [UnitOfWork] + public void ExtractNamesByChapterGuid(string bookGuid, string chapterGuid) + { + if (chineseNameExtractor == null) chineseNameExtractor = new ChineseNameExtractor(service); + + IRepository repositoryAiChapterPersonEntity = repository.GetRepository>(); + + IRepository repositoryAiParagraphEntity = repository.GetRepository>(); + + AiParagraphViewEntity[] paragraphs = repositoryAiParagraphEntity.DetachedEntities.Where(x => x.BookGuid == bookGuid && (string.IsNullOrEmpty(chapterGuid) || x.ChapterGuid == chapterGuid)).ToArray(); + + if (paragraphs == null || paragraphs.Length == 0) return; + + List names = new List(); + List aiChapterPersonEntities = new List(); + AiChapterPersonEntity entity; + int orderIndex = 0; + foreach (var paragraph in paragraphs) + { + names = chineseNameExtractor.ExtractNames(paragraph.Content); + + if (names == null || names.Count() == 0) continue; + + orderIndex = 1; + foreach (var name in names) + { + entity = new AiChapterPersonEntity(); + entity.Guid= Guid.NewGuid().ToString(); + entity.ChapterGuid = paragraph.ChapterGuid; + entity.ParagraphGuid = paragraph.Guid; + entity.ParagraphIndex = paragraph.ParagraphIndex; + entity.OrderIndex = orderIndex++; + entity.PersonName = name; + aiChapterPersonEntities.Add(entity); + } + } + + if (aiChapterPersonEntities != null && aiChapterPersonEntities.Count() > 0) + repositoryAiChapterPersonEntity.InsertNow(aiChapterPersonEntities); + } } } diff --git a/CloudBuilder.AI.Service/CloudBuilder.AI.Service.csproj b/CloudBuilder.AI.Service/CloudBuilder.AI.Service.csproj index aaa3eb9..27bbe56 100644 --- a/CloudBuilder.AI.Service/CloudBuilder.AI.Service.csproj +++ b/CloudBuilder.AI.Service/CloudBuilder.AI.Service.csproj @@ -21,6 +21,9 @@ + + + diff --git a/CloudBuilder.AI/Entity/AiChapterPersonEntity.auto.cs b/CloudBuilder.AI/Entity/AiChapterPersonEntity.auto.cs index 28567df..4742eb9 100644 --- a/CloudBuilder.AI/Entity/AiChapterPersonEntity.auto.cs +++ b/CloudBuilder.AI/Entity/AiChapterPersonEntity.auto.cs @@ -26,6 +26,12 @@ namespace CloudBuilder.AI.Entity public string Guid { get; set; } [Column("chapter_guid")] public string ChapterGuid { get; set; } + [Column("paragraph_guid")] + public string ParagraphGuid { get; set; } + [Column("paragraph_index")] + public int ParagraphIndex { get; set; } + [Column("order_index")] + public int OrderIndex { get; set; } [Column("person_name")] public string PersonName { get; set; } [Column("person_mapping")] @@ -37,11 +43,14 @@ namespace CloudBuilder.AI.Entity public const string UPDATED_BY = "UpdatedBy"; public const string GUID = "Guid"; public const string CHAPTER_GUID = "ChapterGuid"; + public const string PARAGRAPH_GUID = "ParagraphGuid"; + public const string PARAGRAPH_INDEX = "ParagraphIndex"; + public const string ORDER_INDEX = "OrderIndex"; public const string PERSON_NAME = "PersonName"; public const string PERSON_MAPPING = "PersonMapping"; public const string DB_NAME_AI_CHAPTER_PERSON = "ai_chapter_person"; - public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,guid,chapter_guid,person_name,person_mapping"; + public const string DB_NAME_FIELDS="created_datetime,created_by,updated_datetime,updated_by,guid,chapter_guid,paragraph_guid,paragraph_index,order_index,person_name,person_mapping"; public const string DB_CREATED_DATETIME = "created_datetime"; public const string DB_CREATED_BY = "created_by"; @@ -49,6 +58,9 @@ namespace CloudBuilder.AI.Entity public const string DB_UPDATED_BY = "updated_by"; public const string DB_GUID = "guid"; public const string DB_CHAPTER_GUID = "chapter_guid"; + public const string DB_PARAGRAPH_GUID = "paragraph_guid"; + public const string DB_PARAGRAPH_INDEX = "paragraph_index"; + public const string DB_ORDER_INDEX = "order_index"; public const string DB_PERSON_NAME = "person_name"; public const string DB_PERSON_MAPPING = "person_mapping"; @@ -76,6 +88,9 @@ namespace CloudBuilder.AI.Entity this.UpdatedBy = source.UpdatedBy; this.Guid = source.Guid; this.ChapterGuid = source.ChapterGuid; + this.ParagraphGuid = source.ParagraphGuid; + this.ParagraphIndex = source.ParagraphIndex; + this.OrderIndex = source.OrderIndex; this.PersonName = source.PersonName; this.PersonMapping = source.PersonMapping; diff --git a/CloudBuilder.AI/Entity/CloudBuilderAIRegistEntity.auto.cs b/CloudBuilder.AI/Entity/CloudBuilderAIRegistEntity.auto.cs index babddff..a7c8068 100644 --- a/CloudBuilder.AI/Entity/CloudBuilderAIRegistEntity.auto.cs +++ b/CloudBuilder.AI/Entity/CloudBuilderAIRegistEntity.auto.cs @@ -40,6 +40,7 @@ namespace CloudBuilder.AI.Entity builder.Entity(eb => { eb.HasNoKey(); }); builder.Entity(eb => { eb.HasNoKey(); }); builder.Entity(eb => { eb.HasNoKey(); }); + builder.Entity(eb => { eb.HasNoKey(); }); //***END*** } } diff --git a/CloudBuilder.AI/Service/IAiBookService.auto.cs b/CloudBuilder.AI/Service/IAiBookService.auto.cs index 351f037..37191a3 100644 --- a/CloudBuilder.AI/Service/IAiBookService.auto.cs +++ b/CloudBuilder.AI/Service/IAiBookService.auto.cs @@ -19,5 +19,9 @@ namespace CloudBuilder.AI.Service AiBookData Update(AiBookData data); AiBookData ProcessBook(string key, string encoding, string pattern); + + void ExtractNames(string bookGuid); + + void ExtractNamesByChapterGuid(string bookGuid, string chapterGuid); } } diff --git a/CloudBuilder.Request/AI/AiBookRequest.auto.cs b/CloudBuilder.Request/AI/AiBookRequest.auto.cs index 8de047e..00c54b0 100644 --- a/CloudBuilder.Request/AI/AiBookRequest.auto.cs +++ b/CloudBuilder.Request/AI/AiBookRequest.auto.cs @@ -61,6 +61,20 @@ return Task.Run(() => serviceRequest.PostAsJsonAsync("/ { var compositionData = new ProcessBookCompositionData3{ key = key, encoding = encoding, pattern = pattern }; return Task.Run(() => serviceRequest.PostAsJsonAsync("/AiBook/ProcessBook", compositionData)).GetAwaiter().GetResult(); } + public void ExtractNames(string bookGuid) + { + Task.Run(() => serviceRequest.PostAsync("/AiBook/ExtractNames?bookGuid=" + bookGuid.ToString())).GetAwaiter().GetResult(); } + + + public class ExtractNamesByChapterGuidCompositionData2 { + public string bookGuid { get; set; } + public string chapterGuid { get; set; } + + } + public void ExtractNamesByChapterGuid(string bookGuid, string chapterGuid) + { +var compositionData = new ExtractNamesByChapterGuidCompositionData2{ bookGuid = bookGuid, chapterGuid = chapterGuid }; Task.Run(() => serviceRequest.PostAsJsonAsync("/AiBook/ExtractNamesByChapterGuid", compositionData)).GetAwaiter().GetResult(); } + } } \ No newline at end of file diff --git a/CloudBuilder.Web.Entry/CloudBuilder.Web.Entry.csproj b/CloudBuilder.Web.Entry/CloudBuilder.Web.Entry.csproj index 38561e2..3682b51 100644 --- a/CloudBuilder.Web.Entry/CloudBuilder.Web.Entry.csproj +++ b/CloudBuilder.Web.Entry/CloudBuilder.Web.Entry.csproj @@ -25,6 +25,9 @@ + + + diff --git a/CloudBuilder.Web.Entry/Controllers/Ai/AiBookController.auto.cs b/CloudBuilder.Web.Entry/Controllers/Ai/AiBookController.auto.cs index d6e8223..c78b99f 100644 --- a/CloudBuilder.Web.Entry/Controllers/Ai/AiBookController.auto.cs +++ b/CloudBuilder.Web.Entry/Controllers/Ai/AiBookController.auto.cs @@ -199,6 +199,53 @@ this.aiBookService= aiBookService; } } + [PermissionOperate(name: "AiBook", operate: "Update")] + [HttpPost] + [UnitOfWork] + public dynamic ExtractNames(string bookGuid){ + try + { + aiBookService.ExtractNames(bookGuid); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + + + public class ExtractNamesByChapterGuidCompositionData + { + public string bookGuid { get; set; } + public string chapterGuid { get; set; } + + } + [PermissionOperate(name: "AiBook", operate: "Update")] + [HttpPost] + [UnitOfWork] + public dynamic ExtractNamesByChapterGuid(ExtractNamesByChapterGuidCompositionData compositionData){ + try + { + aiBookService.ExtractNamesByChapterGuid(compositionData.bookGuid,compositionData.chapterGuid); + + return string.Empty; + } + catch (ValidatedException vex) + { + return vex; + } + catch (Exception ex) + { + return new ServiceErrorException(ex); + } + } + } } \ No newline at end of file diff --git a/CloudBuilder.Web.Entry/appsettings.json b/CloudBuilder.Web.Entry/appsettings.json index fd42aa6..6907d20 100644 --- a/CloudBuilder.Web.Entry/appsettings.json +++ b/CloudBuilder.Web.Entry/appsettings.json @@ -50,10 +50,11 @@ "FileServiceSettings": { "PhysicalFileDirectory": "D:\\Net8\\FileServer", "RequestPath": "/FileServer", //如果是IIS反向代理来的,那么要在本地给这个文件添加IUSR,IIS_IUSRS权限 - "UploadDmsFileDirectory": "D:\\Net8\\FileServer\\Upload\\DmsFile",//上传文件目录,有可能是分片文件,仅当临时文件使用 - "BackupDmsFileDirectory": "D:\\Net8\\FileServer\\Backup\\DmsFile",//这个是备份目录,也是完整文件目录,原文件目录 - "ScaleDmsFileDirectory": "D:\\Net8\\FileServer\\Scale\\DmsFile",//这个是压缩图片或者视频目录 - "ExcelOutputDirectory": "D:\\Net8\\FileServer\\Output" + "UploadDmsFileDirectory": "D:\\Net8\\FileServer\\Upload\\DmsFile", //上传文件目录,有可能是分片文件,仅当临时文件使用 + "BackupDmsFileDirectory": "D:\\Net8\\FileServer\\Backup\\DmsFile", //这个是备份目录,也是完整文件目录,原文件目录 + "ScaleDmsFileDirectory": "D:\\Net8\\FileServer\\Scale\\DmsFile", //这个是压缩图片或者视频目录 + "ExcelOutputDirectory": "D:\\Net8\\FileServer\\Output", + "OnnxDirectory": "D:\\Net8\\FileServer\\model" //预测模型存放目录 }, "Ffmpeg": { "Path": "D:\\NET8\\Exe\\ffmpeg\\bin\\ffmpeg.exe", //视频转码