add error msg
This commit is contained in:
parent
453779a83f
commit
aecff925b1
|
|
@ -44,7 +44,7 @@ public partial class BotSharpFileService
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError($"Error when analyzing pdf in file service: {ex.Message}");
|
||||
_logger.LogError($"Error when analyzing pdf in file service: {ex.Message}\r\n{ex.InnerException}");
|
||||
return content;
|
||||
}
|
||||
finally
|
||||
|
|
@ -105,7 +105,7 @@ public partial class BotSharpFileService
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning($"Error when saving pdf file: {ex.Message}");
|
||||
_logger.LogWarning($"Error when saving pdf file: {ex.Message}\r\n{ex.InnerException}");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ public partial class BotSharpFileService
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning($"Error when converting pdf file to images ({file}): {ex.Message}");
|
||||
_logger.LogWarning($"Error when converting pdf file to images ({file}): {ex.Message}\r\n{ex.InnerException}");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public partial class BotSharpFileService
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning($"Error when saving user avatar: {ex.Message}");
|
||||
_logger.LogWarning($"Error when saving user avatar: {ex.Message}\r\n{ex.InnerException}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,8 +115,7 @@ public class InstructModeController : ControllerBase
|
|||
|
||||
try
|
||||
{
|
||||
var completion = CompletionProvider.GetImageGeneration(_services, provider: input.Provider ?? "openai",
|
||||
model: input.Model ?? "dall-e-3", imageGenerate: true);
|
||||
var completion = CompletionProvider.GetImageGeneration(_services, provider: input.Provider ?? "openai", model: input.Model ?? "dall-e-3");
|
||||
var message = await completion.GetImageGeneration(new Agent()
|
||||
{
|
||||
Id = Guid.Empty.ToString(),
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class GenerateImageFn : IFunctionCallback
|
|||
{
|
||||
try
|
||||
{
|
||||
var completion = CompletionProvider.GetImageGeneration(_services, provider: "openai", model: "dall-e-3", imageGenerate: true);
|
||||
var completion = CompletionProvider.GetImageGeneration(_services, provider: "openai", model: "dall-e-3");
|
||||
var text = !string.IsNullOrWhiteSpace(description) ? description : message.Content;
|
||||
var dialog = RoleDialogModel.From(message, AgentRole.User, text);
|
||||
var result = await completion.GetImageGeneration(agent, new List<RoleDialogModel> { dialog });
|
||||
|
|
@ -69,7 +69,7 @@ public class GenerateImageFn : IFunctionCallback
|
|||
catch (Exception ex)
|
||||
{
|
||||
var error = $"Error when generating image.";
|
||||
_logger.LogWarning($"{error} {ex.Message}");
|
||||
_logger.LogWarning($"{error} {ex.Message}\r\n{ex.InnerException}");
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ public class GenerateImageFn : IFunctionCallback
|
|||
var files = images.Where(x => !string.IsNullOrEmpty(x?.ImageData)).Select(x => new BotSharpFile
|
||||
{
|
||||
FileName = $"{Guid.NewGuid()}.png",
|
||||
FileData = $"data:image/png;base64,{x.ImageData}"
|
||||
FileData = $"data:{MediaTypeNames.Image.Png};base64,{x.ImageData}"
|
||||
}).ToList();
|
||||
|
||||
var fileService = _services.GetRequiredService<IBotSharpFileService>();
|
||||
|
|
|
|||
Loading…
Reference in a new issue