This commit is contained in:
owenchen committed 2026-06-04 08:16:37 +08:00
1 parent fd48c2eb7d
commit cb3fdca3e1
8 files changed
+339 -52

No files matched your search

+42 -7
View File
@@ -780,13 +780,12 @@ namespace CloudBuilder.AI.Gui
return;
}
AiChapterEntity chapter = dataGv.GetRowData<AiChapterEntity>(dataGv.SelectedCells[0].RowIndex);
AiChapterEntity[] chapters = dataGv.GetSelectedRowsData<AiChapterEntity>();
//aiBookRequest.ExtractNamesByChapterGuid(data.AiBook.BookId, chapter.ChapterId);
AiSentenceViewEntity[] aiSentences = aiSentenceRequest.FindByChapterId(chapter.ChapterId);
sentenceGv.SetDataSource(aiSentences);
if (chapters != null)
aiBookRequest.PackPersonName(chapters);
else
aiBookRequest.PackPersonNameByBookId(data.AiBook.BookId);
ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_SUCCEED_UPDATED_NULL));
@@ -819,7 +818,7 @@ namespace CloudBuilder.AI.Gui
AiSentenceViewEntity sentence = sentenceGv.GetRowData<AiSentenceViewEntity>(sentenceGv.SelectedCells[0].RowIndex);
using (Stream audioStream = ServiceHelper.GetService<IServiceRequest>()!.PostStreamAsync("/AiBook/GetTtsStream?text=" + sentence.Content, null, string.Empty).GetAwaiter().GetResult())
using (Stream audioStream = ServiceHelper.GetService<IServiceRequest>()!.PostStreamAsync("/AiBook/GetMp3Stream", null, sentence).GetAwaiter().GetResult())
{
PlayMp3Stream(audioStream);
}
@@ -915,5 +914,41 @@ namespace CloudBuilder.AI.Gui
UseShellExecute = true // 使用Windows Shell执行
});
}
private void generaterMp3But_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[] chapters = dataGv.GetSelectedRowsData<AiChapterEntity>();
if (chapters != null)
aiBookRequest.GenerateMp3(chapters);
else
aiBookRequest.GenerateMp3ByBookId(data.AiBook.BookId);
ShowMessageBox.ShowInfo(securityMessagePolicy.ComposeMessage(SecurityMessagePolicy.GUI_SUCCEED_UPDATED_NULL));
guidSearchTxt.Text = data.AiBook.BookId;
Search();
}
catch (ValidatedException ex)
{
ShowMessageBox.ShowInfo(ex.Message);
}
catch (ServiceErrorException ex)
{
ShowMessageBox.ShowError(ex.Message);
}
catch (Exception ex)
{
ShowMessageBox.ShowError(ex.Message);
}
}
}
}