Fix: Se refinan IA y Estructuras

This commit is contained in:
2025-12-09 10:28:18 -03:00
parent d38a88869c
commit 2a36093dfb
7 changed files with 422 additions and 248 deletions

View File

@@ -0,0 +1,58 @@
using System.Text.Json.Serialization;
namespace ChatbotApi.Data.Models
{
public class GenerationConfig
{
[JsonPropertyName("maxOutputTokens")]
public int MaxOutputTokens { get; set; }
[JsonPropertyName("temperature")]
public float Temperature { get; set; } = 0.7f;
}
public class SafetySetting
{
[JsonPropertyName("category")]
public string Category { get; set; } = string.Empty;
[JsonPropertyName("threshold")]
public string Threshold { get; set; } = string.Empty;
}
public class GeminiRequest
{
[JsonPropertyName("contents")]
public Content[] Contents { get; set; } = default!;
[JsonPropertyName("generationConfig")]
public GenerationConfig? GenerationConfig { get; set; }
[JsonPropertyName("safetySettings")]
public List<SafetySetting>? SafetySettings { get; set; }
}
public class Content { [JsonPropertyName("parts")] public Part[] Parts { get; set; } = default!; }
public class Part { [JsonPropertyName("text")] public string Text { get; set; } = default!; }
public class GeminiResponse { [JsonPropertyName("candidates")] public Candidate[] Candidates { get; set; } = default!; }
public class Candidate { [JsonPropertyName("content")] public Content Content { get; set; } = default!; }
public class GeminiStreamingResponse { [JsonPropertyName("candidates")] public StreamingCandidate[] Candidates { get; set; } = default!; }
public class StreamingCandidate { [JsonPropertyName("content")] public Content Content { get; set; } = default!; }
public class NewsArticleLink
{
public required string Title { get; set; }
public required string Url { get; set; }
}
public enum IntentType { Article, KnowledgeBase, Homepage }
public class ChatRequest
{
public string? Message { get; set; }
public string? ConversationSummary { get; set; }
public string? SystemPromptOverride { get; set; }
public string? ContextUrl { get; set; }
public List<string>? ShownArticles { get; set; }
}
}