From 4ec4023f40842c4e6c4c01a10b4c18c8d144f83a Mon Sep 17 00:00:00 2001 From: ccnetcore Date: Mon, 11 Aug 2025 20:24:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0EmbeddingResponse?= =?UTF-8?q?=E7=9A=84object=E5=AD=97=E6=AE=B5=E5=B9=B6=E5=AE=8C=E5=96=84AiG?= =?UTF-8?q?ateWayManager=E7=9A=84Usage=E7=BB=9F=E8=AE=A1=EF=BC=8C=E6=9B=B4?= =?UTF-8?q?=E6=96=B0CORS=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/OpenAi/Embeddings/EmbeddingCreateResponse.cs | 2 ++ .../Yi.Framework.AiHub.Domain/Managers/AiGateWayManager.cs | 3 ++- Yi.Abp.Net8/src/Yi.Abp.Web/appsettings.json | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain.Shared/Dtos/OpenAi/Embeddings/EmbeddingCreateResponse.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain.Shared/Dtos/OpenAi/Embeddings/EmbeddingCreateResponse.cs index 583ce31e..5d072540 100644 --- a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain.Shared/Dtos/OpenAi/Embeddings/EmbeddingCreateResponse.cs +++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain.Shared/Dtos/OpenAi/Embeddings/EmbeddingCreateResponse.cs @@ -105,6 +105,8 @@ public record EmbeddingCreateResponse : ThorBaseResponse public record EmbeddingResponse { + [JsonPropertyName("object")] public string Object { get; set; } = "embedding"; + [JsonPropertyName("index")] public int? Index { get; set; } [JsonPropertyName("embedding")] public object Embedding { get; set; } diff --git a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/Managers/AiGateWayManager.cs b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/Managers/AiGateWayManager.cs index 82f6e188..3206ee64 100644 --- a/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/Managers/AiGateWayManager.cs +++ b/Yi.Abp.Net8/module/ai-hub/Yi.Framework.AiHub.Domain/Managers/AiGateWayManager.cs @@ -389,6 +389,7 @@ public class AiGateWayManager : DomainService var usage = new ThorUsageResponse() { + PromptTokens = stream.Usage?.PromptTokens??0, InputTokens = stream.Usage?.InputTokens ?? 0, CompletionTokens = 0, TotalTokens = stream.Usage?.InputTokens ?? 0 @@ -398,7 +399,7 @@ public class AiGateWayManager : DomainService input.Model, stream.Data, stream.Error, - stream.ObjectTypeName, + Object = stream.ObjectTypeName, Usage = usage }); diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/appsettings.json b/Yi.Abp.Net8/src/Yi.Abp.Web/appsettings.json index e62f5eab..0df0ce3b 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/appsettings.json +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/appsettings.json @@ -21,7 +21,7 @@ //应用启动 "App": { "SelfUrl": "http://*:19001", - "CorsOrigins": "http://localhost:19001;http://localhost:18000;vscode-file://vscode-app" + "CorsOrigins": "http://localhost:19001;http://localhost:18000;vscode-file://vscode-app;https://web.chatboxai.app" }, //配置 "Settings": {