59 lines
2.1 KiB
C#
59 lines
2.1 KiB
C#
|
|
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; }
|
||
|
|
}
|
||
|
|
}
|