feat: 增加EmbeddingResponse的object字段并完善AiGateWayManager的Usage统计,更新CORS配置
This commit is contained in:
@@ -105,6 +105,8 @@ public record EmbeddingCreateResponse : ThorBaseResponse
|
|||||||
|
|
||||||
public record EmbeddingResponse
|
public record EmbeddingResponse
|
||||||
{
|
{
|
||||||
|
[JsonPropertyName("object")] public string Object { get; set; } = "embedding";
|
||||||
|
|
||||||
[JsonPropertyName("index")] public int? Index { get; set; }
|
[JsonPropertyName("index")] public int? Index { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("embedding")] public object Embedding { get; set; }
|
[JsonPropertyName("embedding")] public object Embedding { get; set; }
|
||||||
|
|||||||
@@ -389,6 +389,7 @@ public class AiGateWayManager : DomainService
|
|||||||
|
|
||||||
var usage = new ThorUsageResponse()
|
var usage = new ThorUsageResponse()
|
||||||
{
|
{
|
||||||
|
PromptTokens = stream.Usage?.PromptTokens??0,
|
||||||
InputTokens = stream.Usage?.InputTokens ?? 0,
|
InputTokens = stream.Usage?.InputTokens ?? 0,
|
||||||
CompletionTokens = 0,
|
CompletionTokens = 0,
|
||||||
TotalTokens = stream.Usage?.InputTokens ?? 0
|
TotalTokens = stream.Usage?.InputTokens ?? 0
|
||||||
@@ -398,7 +399,7 @@ public class AiGateWayManager : DomainService
|
|||||||
input.Model,
|
input.Model,
|
||||||
stream.Data,
|
stream.Data,
|
||||||
stream.Error,
|
stream.Error,
|
||||||
stream.ObjectTypeName,
|
Object = stream.ObjectTypeName,
|
||||||
Usage = usage
|
Usage = usage
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
//应用启动
|
//应用启动
|
||||||
"App": {
|
"App": {
|
||||||
"SelfUrl": "http://*:19001",
|
"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": {
|
"Settings": {
|
||||||
|
|||||||
Reference in New Issue
Block a user