instruct/agentId interface add logId response

This commit is contained in:
nick.yi 2025-10-15 17:10:06 +08:00
parent e1dc28beef
commit 5783d28100
5 changed files with 8 additions and 0 deletions

View file

@ -9,4 +9,5 @@ public class InstructResponseModel
public string UserMessage { get; set; } = default!;
public string? SystemInstruction { get; set; }
public string CompletionText { get; set; } = default!;
public string LogId { get; set; } = default!;
}

View file

@ -10,4 +10,7 @@ public class InstructResult : ITrackableMessage
[JsonPropertyName("template")]
public string? Template { get; set; }
public Dictionary<string, string>? States { get; set; } = new();
[JsonPropertyName("log_id")]
public string LogId { get; set; } = default!;
}

View file

@ -128,12 +128,14 @@ public partial class InstructService
response.Text = result;
}
response.LogId = Guid.NewGuid().ToString();
// After completion hooks
foreach (var hook in hooks)
{
await hook.AfterCompletion(agent, response);
await hook.OnResponseGenerated(new InstructResponseModel
{
LogId = response.LogId,
AgentId = agentId,
Provider = provider,
Model = model,

View file

@ -48,6 +48,7 @@ public class InstructionLogHook : InstructHookBase
{
new InstructionLogModel
{
Id = response.LogId,
AgentId = response.AgentId,
Provider = response.Provider,
Model = response.Model,

View file

@ -19,6 +19,7 @@ public class InstructionLogDocument : MongoBase
{
return new InstructionLogDocument
{
Id = log.Id,
AgentId = log.AgentId,
Provider = log.Provider,
Model = log.Model,