| | | 1 | | namespace UIBlazor.Models; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Базовый токен ввода |
| | | 5 | | /// </summary> |
| | | 6 | | public abstract class InputToken |
| | | 7 | | { |
| | | 8 | | public abstract string GetDisplayText(); |
| | | 9 | | public abstract string GetLlmText(); |
| | | 10 | | } |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Текстовый токен |
| | | 14 | | /// </summary> |
| | | 15 | | public class TextToken : InputToken |
| | | 16 | | { |
| | 0 | 17 | | public string Text { get; set; } = string.Empty; |
| | | 18 | | |
| | 0 | 19 | | public override string GetDisplayText() => Text; |
| | 0 | 20 | | public override string GetLlmText() => Text; |
| | | 21 | | } |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Токен файла |
| | | 25 | | /// </summary> |
| | | 26 | | public class FileToken : InputToken |
| | | 27 | | { |
| | | 28 | | public string FilePath { get; set; } = string.Empty; |
| | | 29 | | public string FileName { get; set; } = string.Empty; |
| | | 30 | | public string? FileContent { get; set; } |
| | | 31 | | |
| | | 32 | | public override string GetDisplayText() => $"@{FileName}"; |
| | | 33 | | |
| | | 34 | | public override string GetLlmText() |
| | | 35 | | { |
| | | 36 | | if (string.IsNullOrEmpty(FileContent)) |
| | | 37 | | return $"File: {FilePath}"; |
| | | 38 | | |
| | | 39 | | return $"File: {FilePath}\n```\n{FileContent}\n```"; |
| | | 40 | | } |
| | | 41 | | } |