fix: 修复输出为空问题

This commit is contained in:
chenchun
2025-08-11 16:53:33 +08:00
parent c17c9000a8
commit cfde73d13a
3 changed files with 11 additions and 11 deletions

View File

@@ -73,15 +73,15 @@ public class ThorChatMessage
{
if (value is JsonElement str)
{
if (str.ValueKind == JsonValueKind.Array)
if (str.ValueKind == JsonValueKind.String)
{
Content = value?.ToString();
}
else if (str.ValueKind == JsonValueKind.Array)
{
Contents = JsonSerializer.Deserialize<IList<ThorChatMessageContent>>(value?.ToString());
}
}
else if (value is string strInput)
{
Content = strInput;
}
else
{
Content = value?.ToString();

View File

@@ -360,7 +360,11 @@ public class AiGateWayManager : DomainService
//dto进行转换支持多种格式
if (input.Input is JsonElement str)
{
if (str.ValueKind == JsonValueKind.Array)
if (str.ValueKind == JsonValueKind.String)
{
embeddingCreateRequest.Input = str.ToString();
}
else if (str.ValueKind == JsonValueKind.Array)
{
var inputString = str.EnumerateArray().Select(x => x.ToString()).ToArray();
embeddingCreateRequest.InputAsList = inputString.ToList();
@@ -370,10 +374,6 @@ public class AiGateWayManager : DomainService
throw new Exception("Input输入格式错误非string或Array类型");
}
}
else if (input.Input is string strInput)
{
embeddingCreateRequest.Input = strInput;
}
else
{
throw new Exception("Input输入格式错误未找到类型");