blob: c681e2cee60f882e0783004a0f48ba79a3f17642 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Tango.Portal.Chat.Web.Models
{
public sealed class ProposeKqlResult
{
[JsonPropertyName("kql")]
public string Kql { get; set; } = string.Empty;
[JsonPropertyName("parameterTypes")]
public Dictionary<string, string>? ParameterTypes { get; set; }
[JsonPropertyName("parameters")]
public Dictionary<string, string> Parameters { get; set; } = new();
// NEW: be flexible about shapes from the model
[JsonPropertyName("assumptions")]
[JsonConverter(typeof(FlexibleStringListConverter))]
public List<string>? Assumptions { get; set; }
[JsonPropertyName("why")]
public string? Why { get; set; }
[JsonPropertyName("assistant")]
public string Assistant { get; set; } = string.Empty;
[JsonPropertyName("conversation")]
public string ConversationAnswer { get; set; } = String.Empty;
}
public sealed class ChatMessage
{
// "user" | "assistant"
public string Role { get; set; } = "user";
public string Content { get; set; } = string.Empty;
public String UsedKql { get; set; } = String.Empty;
}
public sealed class ChatRequest
{
public List<ChatMessage>? History { get; set; }
public string? ThreadId { get; set; } // shared Assistants thread for the whole chat
public string Question { get; set; } = string.Empty;
public string? From { get; set; }
public string? To { get; set; }
}
public sealed class ChatResponse
{
public string? ThreadId { get; set; } // shared Assistants thread for the whole chat
public string Answer { get; set; } = string.Empty;
public string UsedKql { get; set; } = string.Empty;
public object? Preview { get; set; }
}
}
|