Skip to content

Commit bd1d35e

Browse files
authored
Merge pull request #1017 from hchen2020/master
ResponseDoneStatusDetail
2 parents 485e170 + 7b5c889 commit bd1d35e

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

src/Infrastructure/BotSharp.Core/Routing/Handlers/RouteToAgentRoutingHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ await hook.OnNewTaskDetected(message, inst.NextActionReason)
7171

7272
// Update next action agent's name
7373
var agentService = _services.GetRequiredService<IAgentService>();
74-
var agent = await agentService.LoadAgent(agentId);
74+
var agent = await agentService.GetAgent(agentId);
7575
inst.AgentName = agent.Name;
7676

7777
if (inst.ExecutingDirectly)

src/Infrastructure/BotSharp.Logger/Hooks/VerboseLogHook.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public async Task AfterGenerated(RoleDialogModel message, TokenStatsModel tokenS
3838
if (!_convSettings.ShowVerboseLog || string.IsNullOrEmpty(tokenStats.Prompt)) return;
3939

4040
var agentService = _services.GetRequiredService<IAgentService>();
41-
var agent = await agentService.LoadAgent(message.CurrentAgentId);
41+
var agent = await agentService.GetAgent(message.CurrentAgentId);
4242

4343
var log = message.Role == AgentRole.Function ?
4444
$"[{agent?.Name}]: {message.Indication} {message.FunctionName}({message.FunctionArgs})" :

src/Plugins/BotSharp.Plugin.OpenAI/Models/Realtime/ResponseDone.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,32 @@ public class ResponseDoneStatusDetail
8989
public string Type { get; set; } = null!;
9090

9191
[JsonPropertyName("reason")]
92-
public string Reason { get; set; } = null!;
92+
public string? Reason { get; set; } = null!;
93+
94+
[JsonPropertyName("error")]
95+
public ResponseDoneErrorStatus? Error { get; set; } = null!;
96+
97+
public override string ToString()
98+
{
99+
return $"{Type}: {Reason} ({Error})";
100+
}
101+
}
102+
103+
public class ResponseDoneErrorStatus
104+
{
105+
[JsonPropertyName("type")]
106+
public string Type { get; set; } = null!;
107+
108+
[JsonPropertyName("message")]
109+
public string? Message { get; set; } = null!;
110+
111+
[JsonPropertyName("code")]
112+
public string? Code { get; set; } = null!;
113+
114+
public override string ToString()
115+
{
116+
return $"{Type}: {Message} ({Code})";
117+
}
93118
}
94119

95120
public class ResponseDoneOutputContent

src/Plugins/BotSharp.Plugin.OpenAI/Providers/Realtime/RealTimeCompletionProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ public async Task<List<RoleDialogModel>> OnResponsedDone(RealtimeHubConnection c
560560
var data = JsonSerializer.Deserialize<ResponseDone>(response).Body;
561561
if (data.Status != "completed")
562562
{
563+
_logger.LogError(data.StatusDetails.ToString());
563564
return [];
564565
}
565566

0 commit comments

Comments
 (0)