Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,7 +60,7 @@ public interface IMembaseApi
Task<PgtValidationResponse> ValidatePgtDefinitionAsync(string graphId, string definitionId, [Body] PgtValidationRequest request);

[Post("/graph/{graphId}/pgt-external/{correlationId}/complete")]
Task<PgtExternalCompleteResponse> CompletePgtExternalAsync(string graphId, string correlationId, [FromBody] object emptyBody);
Task<PgtExternalCompleteResponse> CompletePgtExternalAsync(string graphId, string correlationId, [FromBody] object body);
#endregion

#region Procedure
Expand Down
6 changes: 5 additions & 1 deletion src/Plugins/BotSharp.Plugin.Membase/MembasePlugin.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,11 @@ public void RegisterDI(IServiceCollection services, IConfiguration config)

services.AddHttpContextAccessor();
services.AddTransient<MembaseAuthHandler>();
services.AddRefitClient<IMembaseApi>(new RefitSettings
// Use plain Web options WITHOUT Refit's default ObjectToInferredTypesConverter:
// consumers (ObjectExtensions.TryGetValue<JsonElement>, GraphBuilder, GetNodePropertiesOrDefault)
// rely on Dictionary<string, object?> values deserializing as JsonElement.
services.AddRefitClient<IMembaseApi>(new RefitSettings(
new SystemTextJsonContentSerializer(new JsonSerializerOptions(JsonSerializerDefaults.Web)))
{
CollectionFormat = CollectionFormat.Multi
})
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,10 @@ public static OpenAIClient GetClient(string provider, string model, string? apiK
{
var settingsService = services.GetRequiredService<ILlmProviderService>();
var settings = settingsService.GetSetting(provider, model);
if (settings == null && string.IsNullOrEmpty(apiKey))
{
throw new InvalidOperationException($"No LLM model settings found for '{provider}.{model}'. Register the model under LlmProviders (appsettings/user secrets) or pass an api key.");
}
var options = !string.IsNullOrEmpty(settings?.Endpoint) ?
new OpenAIClientOptions { Endpoint = new Uri(settings.Endpoint) } : null;
return new OpenAIClient(new ApiKeyCredential(apiKey ?? settings!.ApiKey), options);
Expand Down