feat: 完成支持functioncall功能
This commit is contained in:
@@ -13,9 +13,8 @@ public class ThorChatCompletionsRequest
|
||||
{
|
||||
Messages = new List<ThorChatMessage>();
|
||||
}
|
||||
|
||||
[JsonPropertyName("store")]
|
||||
public bool? Store { get; set; }
|
||||
|
||||
[JsonPropertyName("store")] public bool? Store { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表示对话中支持的模态类型数组。可以为 null。
|
||||
@@ -26,14 +25,15 @@ public class ThorChatCompletionsRequest
|
||||
/// <summary>
|
||||
/// 表示对话中的音频请求参数。可以为 null。
|
||||
/// </summary>
|
||||
[JsonPropertyName("audio")] public ThorChatAudioRequest? Audio { get; set; }
|
||||
[JsonPropertyName("audio")]
|
||||
public ThorChatAudioRequest? Audio { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 包含迄今为止对话的消息列表
|
||||
/// </summary>
|
||||
[JsonPropertyName("messages")]
|
||||
public List<ThorChatMessage> Messages { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 模型唯一编码值,如 gpt-4,gpt-3.5-turbo,moonshot-v1-8k,看底层具体平台定义
|
||||
/// </summary>
|
||||
@@ -229,18 +229,25 @@ public class ThorChatCompletionsRequest
|
||||
{
|
||||
if (value is JsonElement jsonElement)
|
||||
{
|
||||
if (jsonElement.ValueKind == JsonValueKind.String)
|
||||
{
|
||||
ToolChoice = new ThorToolChoice
|
||||
{
|
||||
Type = jsonElement.GetString()
|
||||
};
|
||||
}
|
||||
else if (jsonElement.ValueKind == JsonValueKind.Object)
|
||||
// if (jsonElement.ValueKind == JsonValueKind.String)
|
||||
// {
|
||||
// ToolChoice = new ThorToolChoice
|
||||
// {
|
||||
// Type = jsonElement.GetString()
|
||||
// };
|
||||
// }
|
||||
if (jsonElement.ValueKind == JsonValueKind.Object)
|
||||
{
|
||||
ToolChoice = jsonElement.Deserialize<ThorToolChoice>();
|
||||
}
|
||||
}
|
||||
else if (value is string text)
|
||||
{
|
||||
ToolChoice = new ThorToolChoice
|
||||
{
|
||||
Type = text
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
ToolChoice = (ThorToolChoice)value;
|
||||
|
||||
Reference in New Issue
Block a user