feat: 支持非流式传输

This commit is contained in:
ccnetcore
2025-07-09 21:52:00 +08:00
parent 716c344780
commit c5a9b9a15f
9 changed files with 365 additions and 48 deletions

View File

@@ -0,0 +1,115 @@
using Newtonsoft.Json;
namespace Yi.Framework.AiHub.Application.Contracts.Dtos.OpenAi;
public class ChatCompletionsOutput
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("object")]
public string Object { get; set; }
[JsonProperty("created_at")]
public long CreatedAt { get; set; }
[JsonProperty("status")]
public string Status { get; set; }
[JsonProperty("error")]
public object Error { get; set; }
[JsonProperty("incomplete_details")]
public object IncompleteDetails { get; set; }
[JsonProperty("instructions")]
public object Instructions { get; set; }
[JsonProperty("max_output_tokens")]
public object MaxOutputTokens { get; set; }
[JsonProperty("model")]
public string Model { get; set; }
[JsonProperty("output")]
public List<Output> Output { get; set; }
[JsonProperty("parallel_tool_calls")]
public bool ParallelToolCalls { get; set; }
[JsonProperty("previous_response_id")]
public object PreviousResponseId { get; set; }
[JsonProperty("reasoning")]
public Reasoning Reasoning { get; set; }
[JsonProperty("store")]
public bool Store { get; set; }
[JsonProperty("temperature")]
public double Temperature { get; set; }
[JsonProperty("text")]
public Text Text { get; set; }
[JsonProperty("tool_choice")]
public string ToolChoice { get; set; }
[JsonProperty("tools")]
public List<object> Tools { get; set; }
[JsonProperty("top_p")]
public double TopP { get; set; }
[JsonProperty("truncation")]
public string Truncation { get; set; }
[JsonProperty("usage")]
public Usage Usage { get; set; }
[JsonProperty("user")]
public object User { get; set; }
[JsonProperty("metadata")]
public Dictionary<string, object> Metadata { get; set; }
}
public class Output
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("status")]
public string Status { get; set; }
[JsonProperty("role")]
public string Role { get; set; }
[JsonProperty("content")]
public List<Content> Content { get; set; }
}
public class Content
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("text")]
public string Text { get; set; }
[JsonProperty("annotations")]
public List<object> Annotations { get; set; }
}
public class Reasoning
{
[JsonProperty("effort")]
public object Effort { get; set; }
[JsonProperty("summary")]
public object Summary { get; set; }
}
public class Text
{
[JsonProperty("format")]
public Format Format { get; set; }
}
public class Format
{
[JsonProperty("type")]
public string Type { get; set; }
}
public class Usage
{
[JsonProperty("input_tokens")]
public int InputTokens { get; set; }
[JsonProperty("input_tokens_details")]
public InputTokensDetails InputTokensDetails { get; set; }
[JsonProperty("output_tokens")]
public int OutputTokens { get; set; }
[JsonProperty("output_tokens_details")]
public OutputTokensDetails OutputTokensDetails { get; set; }
[JsonProperty("total_tokens")]
public int TotalTokens { get; set; }
}
public class InputTokensDetails
{
[JsonProperty("cached_tokens")]
public int CachedTokens { get; set; }
}
public class OutputTokensDetails
{
[JsonProperty("reasoning_tokens")]
public int ReasoningTokens { get; set; }
}

View File

@@ -1,6 +1,6 @@
namespace Yi.Framework.AiHub.Application.Contracts.Dtos;
public class SendMessageOutputDto
public class SendMessageStreamOutputDto
{
/// <summary>
/// 唯一标识符