feat: 新增功能
- 移除 OpenApiService.GenerateContentAsync 的 isAsync 查询参数及其分支处理(不再在该接口直接创建并返回 ImageStore 任务 Id)。 - 保留 alt=sse 的代理处理逻辑。 - 在 ImageStoreTaskAggregateRoot 中新增字段: - Prompt:提示词(大文本) - ReferenceImageUrls:参考图 URL 列表(JSON 存储) - 兼容性提示:接口去掉了 isAsync 参数,调用方需相应调整异步任务创建流程。
This commit is contained in:
@@ -261,13 +261,11 @@ public class OpenApiService : ApplicationService
|
||||
/// 生成-Gemini (尊享服务专用)
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="isAsync"></param>
|
||||
/// <param name="modelId"></param>
|
||||
/// <param name="alt"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
[HttpPost("openApi/v1beta/models/{modelId}:{action:regex(^(generateContent|streamGenerateContent)$)}")]
|
||||
public async Task GenerateContentAsync([FromBody] JsonElement input,
|
||||
[FromQuery] bool isAsync,
|
||||
[FromRoute] string modelId,
|
||||
[FromQuery] string? alt, CancellationToken cancellationToken)
|
||||
{
|
||||
@@ -298,18 +296,7 @@ public class OpenApiService : ApplicationService
|
||||
throw new UserFriendlyException("尊享token包用量不足,请先购买尊享token包");
|
||||
}
|
||||
|
||||
//如果异步,直接走job处理进行存储
|
||||
if (isAsync)
|
||||
{
|
||||
var task = new ImageStoreTaskAggregateRoot();
|
||||
await _imageStoreRepository.InsertAsync(task);
|
||||
await _httpContextAccessor.HttpContext.Response.WriteAsJsonAsync(new
|
||||
{
|
||||
Id = task.Id
|
||||
}, cancellationToken);
|
||||
//todo 发送job,参数怎么办?需要先全存下来吗?全存下来,就要解析全部提示词 和 附件内容了
|
||||
|
||||
}
|
||||
|
||||
//ai网关代理httpcontext
|
||||
if (alt == "sse")
|
||||
{
|
||||
|
||||
@@ -7,6 +7,18 @@ namespace Yi.Framework.AiHub.Domain.Entities.Chat;
|
||||
[SugarTable("Ai_ImageStoreTask")]
|
||||
public class ImageStoreTaskAggregateRoot : FullAuditedAggregateRoot<Guid>
|
||||
{
|
||||
/// <summary>
|
||||
/// 提示词
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)]
|
||||
public string Prompt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参考图Url
|
||||
/// </summary>
|
||||
[SugarColumn(IsJson = true)]
|
||||
public List<string> ReferenceImageUrls { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图片绝对路径
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user