diff --git a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore.Abstractions/DbConnOptions.cs b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore.Abstractions/DbConnOptions.cs
index 6f48f14d..647ca0e8 100644
--- a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore.Abstractions/DbConnOptions.cs
+++ b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore.Abstractions/DbConnOptions.cs
@@ -58,5 +58,10 @@ namespace Yi.Framework.SqlSugarCore.Abstractions
/// 是否启用SaaS多租户
///
public bool EnabledSaasMultiTenancy { get; set; } = false;
+
+ ///
+ /// 并发乐观锁异常,否则不处理
+ ///
+ public bool EnabledConcurrencyException { get; set; } = true;
}
}
\ No newline at end of file
diff --git a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/Repositories/SqlSugarRepository.cs b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/Repositories/SqlSugarRepository.cs
index 12239daf..1cc1ea61 100644
--- a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/Repositories/SqlSugarRepository.cs
+++ b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/Repositories/SqlSugarRepository.cs
@@ -2,11 +2,13 @@
using System.Linq.Expressions;
using System.Text;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
using Nito.AsyncEx;
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Auditing;
using Volo.Abp.Data;
+using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Linq;
@@ -24,6 +26,9 @@ namespace Yi.Framework.SqlSugarCore.Repositories
private readonly ISugarDbContextProvider _dbContextProvider;
+ public IAbpLazyServiceProvider LazyServiceProvider { get; set; }
+ protected DbConnOptions? Options => LazyServiceProvider?.LazyGetService>().Value;
+
///
/// 异步查询执行器
///
@@ -407,17 +412,26 @@ namespace Yi.Framework.SqlSugarCore.Repositories
{
if (typeof(TEntity).IsAssignableTo()) //带版本号乐观锁更新
{
- try
+ if (Options is not null && Options.EnabledConcurrencyException)
+ {
+ try
+ {
+ int num = await (await GetDbSimpleClientAsync())
+ .Context.Updateable(updateObj).ExecuteCommandWithOptLockAsync(true);
+ return num > 0;
+ }
+ catch (VersionExceptions ex)
+ {
+ throw new AbpDbConcurrencyException(
+ $"{ex.Message}[更新失败:ConcurrencyStamp不是最新版本],entityInfo:{updateObj}", ex);
+ }
+ }
+ else
{
int num = await (await GetDbSimpleClientAsync())
- .Context.Updateable(updateObj).ExecuteCommandWithOptLockAsync(true);
+ .Context.Updateable(updateObj).ExecuteCommandAsync();
return num > 0;
}
- catch (VersionExceptions ex)
- {
- throw new AbpDbConcurrencyException(
- $"{ex.Message}[更新失败:ConcurrencyStamp不是最新版本],entityInfo:{updateObj}", ex);
- }
}
return await (await GetDbSimpleClientAsync()).UpdateAsync(updateObj);
@@ -441,8 +455,8 @@ namespace Yi.Framework.SqlSugarCore.Repositories
public class SqlSugarRepository : SqlSugarRepository, ISqlSugarRepository,
IRepository where TEntity : class, IEntity, new()
{
- public SqlSugarRepository(ISugarDbContextProvider sugarDbContextProvider) : base(
- sugarDbContextProvider)
+ public SqlSugarRepository(ISugarDbContextProvider dbContextProvider) : base(
+ dbContextProvider)
{
}
diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/Dtos/OpenAi/ChatCompletionsOutput.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/Dtos/OpenAi/ChatCompletionsOutput.cs
new file mode 100644
index 00000000..808bbc91
--- /dev/null
+++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Application.Contracts/Dtos/OpenAi/ChatCompletionsOutput.cs
@@ -0,0 +1,115 @@
+using Newtonsoft.Json;
+
+namespace Yi.Framework.AiHub.Application.Contracts.Dtos.OpenAi;
+
+public class ChatCompletionsOutput
+{
+ [JsonProperty("id")]
+ public string Id { get; set; }
+ [JsonProperty("object")]
+ public string Object { get; set; }
+ [JsonProperty("created_at")]
+ public long CreatedAt { get; set; }
+ [JsonProperty("status")]
+ public string Status { get; set; }
+ [JsonProperty("error")]
+ public object Error { get; set; }
+ [JsonProperty("incomplete_details")]
+ public object IncompleteDetails { get; set; }
+ [JsonProperty("instructions")]
+ public object Instructions { get; set; }
+ [JsonProperty("max_output_tokens")]
+ public object MaxOutputTokens { get; set; }
+ [JsonProperty("model")]
+ public string Model { get; set; }
+ [JsonProperty("output")]
+ public List