Merge pull request #1067 from yileicn/master
hotfix agent instruction cache question
This commit is contained in:
commit
82affd8bb9
|
|
@ -70,6 +70,11 @@ public partial class AgentService
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.Plugin = GetPlugin(profile.Id);
|
profile.Plugin = GetPlugin(profile.Id);
|
||||||
|
|
||||||
|
//add default instruction to ChannelInstructions
|
||||||
|
var defaultInstruction = new ChannelInstruction() { Channel = string.Empty, Instruction = profile?.Instruction };
|
||||||
|
profile.ChannelInstructions.Insert(0, defaultInstruction);
|
||||||
|
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,13 +72,9 @@ public partial class AgentService
|
||||||
var state = _services.GetRequiredService<IConversationStateService>();
|
var state = _services.GetRequiredService<IConversationStateService>();
|
||||||
var channel = state.GetState("channel");
|
var channel = state.GetState("channel");
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(channel))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var found = instructions.FirstOrDefault(x => x.Channel.IsEqualTo(channel));
|
var found = instructions.FirstOrDefault(x => x.Channel.IsEqualTo(channel));
|
||||||
agent.Instruction = !string.IsNullOrWhiteSpace(found?.Instruction) ? found.Instruction : agent.Instruction;
|
var defaultInstruction = instructions.FirstOrDefault(x => x.Channel == string.Empty);
|
||||||
|
agent.Instruction = !string.IsNullOrWhiteSpace(found?.Instruction) ? found.Instruction : defaultInstruction?.Instruction;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PopulateState(Dictionary<string, object> dict)
|
private void PopulateState(Dictionary<string, object> dict)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue