| | | 1 | | namespace UIBlazor.Models; |
| | | 2 | | |
| | | 3 | | public class ConnectionProfile : BaseOptions |
| | | 4 | | { |
| | 186 | 5 | | public string Id { get; init => SetIfChanged(ref field, value); } = Guid.NewGuid().ToString(); |
| | | 6 | | |
| | 168 | 7 | | public string Name { get; set => SetIfChanged(ref field, value); } = "New Profile"; |
| | | 8 | | |
| | 47 | 9 | | public string Provider { get; set => SetIfChanged(ref field, value); } = "OpenAI Compatible"; |
| | | 10 | | |
| | 68 | 11 | | public string Endpoint { get; set => SetIfChanged(ref field, PrepareEndpoint(value)); } = string.Empty; |
| | | 12 | | |
| | 69 | 13 | | public string ApiKey { get; set => SetIfChanged(ref field, value); } = string.Empty; |
| | | 14 | | |
| | 61 | 15 | | public string ApiKeyHeader { get; set => SetIfChanged(ref field, value); } = "Authorization"; |
| | | 16 | | |
| | 63 | 17 | | public string Model { get; set => SetIfChanged(ref field, value); } = "---"; |
| | | 18 | | |
| | 47 | 19 | | public List<string> AvailableModels { get; set => SetIfChanged(ref field, value); } = []; |
| | | 20 | | |
| | 64 | 21 | | public double Temperature { get; set => SetIfChanged(ref field, value); } = 0.7; |
| | | 22 | | |
| | 52 | 23 | | public List<HeaderModel> ExtraHeaders { get; set => SetIfChanged(ref field, value); } = []; |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// Максимальное количество токенов для следующего ответа модели |
| | | 27 | | /// </summary> |
| | 68 | 28 | | public int MaxTokens { get; set => SetIfChanged(ref field, value); } = 10_000; |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Максимальное количество токенов для запуска компрессии |
| | | 32 | | /// </summary> |
| | 26 | 33 | | public int TokensToCompress { get; set => SetIfChanged(ref field, value); } = 0; |
| | | 34 | | |
| | | 35 | | /// <summary> |
| | | 36 | | /// Контекстное окно = все промпты + <see cref="MaxTokens"/> |
| | | 37 | | /// </summary> |
| | 64 | 38 | | public int ContextWindow { get; set => SetIfChanged(ref field, value); } = 128_000; |
| | | 39 | | |
| | 96 | 40 | | public bool Stream { get; set => SetIfChanged(ref field, value); } = true; |
| | | 41 | | |
| | 14 | 42 | | public bool SkipSSL { get; set => SetIfChanged(ref field, value); } = false; |
| | | 43 | | |
| | 78 | 44 | | public string SystemPrompt { get; set => SetIfChanged(ref field, value); } = string.Empty; |
| | | 45 | | |
| | | 46 | | private static string PrepareEndpoint(string endpoint) |
| | | 47 | | { |
| | 13 | 48 | | endpoint = endpoint.TrimEnd('/', '\\'); |
| | 13 | 49 | | var suffix = "/v1"; |
| | 13 | 50 | | if (endpoint.EndsWith(suffix)) |
| | | 51 | | { |
| | 0 | 52 | | return endpoint[..^suffix.Length]; |
| | | 53 | | } |
| | 13 | 54 | | return endpoint; |
| | | 55 | | } |
| | | 56 | | } |