?this.TA("The document is not saved in UTF-8, so its special characters, such as umlauts, would be damaged. Please save it in UTF-8 first, e.g., with a text editor, and try again.")
:string.Format(this.TA("The document declares the encoding '{0}', but new text can only be written in UTF-8. Please save the document in UTF-8 and change its declared encoding first, e.g., the charset of a web page or the inputenc option in LaTeX."),e.DeclaredEncoding);
// The field of the document refuses such a file already, so it grew since the user chose it:
this.Logger.LogWarning("The assistant '{AssistantTitle}' refused the document '{DocumentPath}': {Reason}",this.Title,sourcePath,e.Message);
awaitthis.MessageBus.SendError(new(AppIcons.DOCUMENT,string.Format(this.TA("The text of the document takes {0} MB, more than the {1} MB which AI Studio can edit for this kind of document with the memory of this computer. Please split it into smaller files and try again."),DocumentMemoryBudget.MegabytesOf(e.TextSize),DocumentMemoryBudget.MegabytesOf(e.MaxTextSize))));
this.Logger.LogError(e,"The assistant '{AssistantTitle}' could not read the document '{DocumentPath}'.",this.Title,sourcePath);
awaitthis.MessageBus.SendError(new(AppIcons.DOCUMENT,this.TA("The document could not be read. Please check that it is a valid file and that it is not locked by another program.")));
this.Logger.LogInformation("The assistant '{AssistantTitle}' worked on {TransformedCount} sections of '{DocumentPath}' in {BatchCount} batches; {FilteredCount} were filtered, and {FailedCount} failed.",this.Title,results.CountOf(SegmentStatus.TRANSFORMED),sourcePath,batches.Count,results.CountOf(SegmentStatus.FILTERED),results.CountOf(SegmentStatus.FAILED));
this.Logger.LogWarning("The document '{DocumentPath}' changed since the assistant '{AssistantTitle}' worked on it, so the new document was not saved.",document.SourcePath,this.Title);
awaitthis.MessageBus.SendError(new(AppIcons.DOCUMENT,this.TA("The original document has changed in the meantime. Please start again.")));
return;
}
this.Logger.LogInformation("The assistant '{AssistantTitle}' saved '{TargetPath}' with {ExactCount} sections in full and {SimplifiedCount} simplified.",this.Title,targetPath,result.ExactCount,result.SimplifiedCount);
if(result.SimplifiedCount>0)
awaitthis.MessageBus.SendWarning(new(AppIcons.WARNING,string.Format(this.TB("In {0} sections, the AI model did not keep all of the formatting, such as a link or bold type. The new words of these sections are complete all the same."),result.SimplifiedCount)));
awaitfeedback.SucceededAsync(AppIcons.DOCUMENT,this.TB("The new document was saved."),targetPath,true);
}
catch(Exceptione)
{
this.Logger.LogError(e,"The assistant '{AssistantTitle}' could not save the new document '{TargetPath}'.",this.Title,targetPath);
awaitthis.MessageBus.SendError(new(AppIcons.SAVE_FAILED,this.TA("The new document could not be saved. Please check that the original document can be read and that the target file is not open in another program.")));