get template name from state

This commit is contained in:
Jicheng Lu 2025-03-11 10:18:54 -05:00
parent 72a49a0a1a
commit db3ed51875

View file

@ -32,6 +32,8 @@ public class InstructionLogHook : InstructHookBase
var state = _services.GetRequiredService<IConversationStateService>();
var user = db.GetUserById(_user.Id);
var templateName = response.TemplateName ?? state.GetState("instruct_template_name") ?? null;
db.SaveInstructionLogs(new List<InstructionLogModel>
{
new InstructionLogModel
@ -39,7 +41,7 @@ public class InstructionLogHook : InstructHookBase
AgentId = response.AgentId,
Provider = response.Provider,
Model = response.Model,
TemplateName = response.TemplateName,
TemplateName = !string.IsNullOrWhiteSpace(templateName) ? templateName : null,
UserMessage = response.UserMessage,
SystemInstruction = response.SystemInstruction,
CompletionText = response.CompletionText,