feat: 完成尊享服务
This commit is contained in:
@@ -560,29 +560,30 @@ public class AiGateWayManager : DomainService
|
||||
{
|
||||
_logger.LogError(e, $"Ai对话异常");
|
||||
var errorContent = $"对话Ai异常,异常信息:\n当前Ai模型:{request.Model}\n异常信息:{e.Message}\n异常堆栈:{e}";
|
||||
var model = new AnthropicStreamDto
|
||||
{
|
||||
Message = new AnthropicChatCompletionDto
|
||||
{
|
||||
content =
|
||||
[
|
||||
new AnthropicChatCompletionDtoContent
|
||||
{
|
||||
text = errorContent,
|
||||
}
|
||||
],
|
||||
},
|
||||
Error = new AnthropicStreamErrorDto
|
||||
{
|
||||
Type = null,
|
||||
Message = errorContent
|
||||
}
|
||||
};
|
||||
var message = JsonConvert.SerializeObject(model, new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver()
|
||||
});
|
||||
await response.WriteAsJsonAsync(message, ThorJsonSerializer.DefaultOptions);
|
||||
throw new UserFriendlyException(errorContent);
|
||||
// var model = new AnthropicStreamDto
|
||||
// {
|
||||
// Message = new AnthropicChatCompletionDto
|
||||
// {
|
||||
// content =
|
||||
// [
|
||||
// new AnthropicChatCompletionDtoContent
|
||||
// {
|
||||
// text = errorContent,
|
||||
// }
|
||||
// ],
|
||||
// },
|
||||
// Error = new AnthropicStreamErrorDto
|
||||
// {
|
||||
// Type = null,
|
||||
// Message = errorContent
|
||||
// }
|
||||
// };
|
||||
// var message = JsonConvert.SerializeObject(model, new JsonSerializerSettings
|
||||
// {
|
||||
// ContractResolver = new CamelCasePropertyNamesContractResolver()
|
||||
// });
|
||||
// await response.WriteAsJsonAsync(message, ThorJsonSerializer.DefaultOptions);
|
||||
}
|
||||
|
||||
await _aiMessageManager.CreateUserMessageAsync(userId, sessionId,
|
||||
|
||||
Reference in New Issue
Block a user