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 UserMessage { get; set; } = default!;
public string? SystemInstruction { get; set; } public string? SystemInstruction { get; set; }
public string CompletionText { get; set; } = default!; public string CompletionText { get; set; } = default!;
public string LogId { get; set; } = default!;
} }

View file

@ -10,4 +10,7 @@ public class InstructResult : ITrackableMessage
[JsonPropertyName("template")] [JsonPropertyName("template")]
public string? Template { get; set; } public string? Template { get; set; }
public Dictionary<string, string>? States { get; set; } = new(); 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.Text = result;
} }
response.LogId = Guid.NewGuid().ToString();
// After completion hooks // After completion hooks
foreach (var hook in hooks) foreach (var hook in hooks)
{ {
await hook.AfterCompletion(agent, response); await hook.AfterCompletion(agent, response);
await hook.OnResponseGenerated(new InstructResponseModel await hook.OnResponseGenerated(new InstructResponseModel
{ {
LogId = response.LogId,
AgentId = agentId, AgentId = agentId,
Provider = provider, Provider = provider,
Model = model, Model = model,

View file

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

View file

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