| | |
| | | using System.Net.Http; |
| | | using System.Text.Json; |
| | | using Moli.Desktop.Diagnostics; |
| | | using Moli.Desktop.Llm; |
| | |
| | | var projects = await _llmGateway.GetProjectsAsync(ReadRuntimeConfig(context), cancellationToken).ConfigureAwait(false); |
| | | return PluginBridgeResponse.Ok(request.Id ?? string.Empty, projects); |
| | | } |
| | | catch (AiChatClientException ex) |
| | | catch (Exception ex) when (ex is AiChatClientException or HttpRequestException) |
| | | { |
| | | return PluginBridgeResponse.Failure(request.Id, ex.Code, ex.Message); |
| | | return PluginBridgeResponse.Ok(request.Id ?? string.Empty, new AiChatProjectsResult |
| | | { |
| | | Status = AiChatProjectStatuses.NotConnected, |
| | | Message = ex.Message, |
| | | Projects = [] |
| | | }); |
| | | } |
| | | } |
| | | |