Merge branch 'master' into master
This commit is contained in:
commit
3237f39fd8
|
|
@ -21,13 +21,13 @@ public class PlotChartFn : IFunctionCallback
|
|||
|
||||
public async Task<bool> Execute(RoleDialogModel message)
|
||||
{
|
||||
var db = _services.GetRequiredService<IBotSharpRepository>();
|
||||
var agentService = _services.GetRequiredService<IAgentService>();
|
||||
var convService = _services.GetRequiredService<IConversationService>();
|
||||
|
||||
var args = JsonSerializer.Deserialize<LlmContextIn>(message.FunctionArgs);
|
||||
|
||||
var agent = await agentService.GetAgent(message.CurrentAgentId);
|
||||
var inst = db.GetAgentTemplate(BuiltInAgentId.UtilityAssistant, "util-chart-plot_instruction");
|
||||
var inst = GetChartPlotInstruction(message.CurrentAgentId);
|
||||
var innerAgent = new Agent
|
||||
{
|
||||
Id = agent.Id,
|
||||
|
|
@ -84,6 +84,27 @@ public class PlotChartFn : IFunctionCallback
|
|||
}
|
||||
}
|
||||
|
||||
private string GetChartPlotInstruction(string agentId)
|
||||
{
|
||||
var db = _services.GetRequiredService<IBotSharpRepository>();
|
||||
var state = _services.GetRequiredService<IConversationStateService>();
|
||||
|
||||
var templateContent = string.Empty;
|
||||
var templateName = state.GetState("chart_plot_template");
|
||||
|
||||
if (!string.IsNullOrEmpty(templateName))
|
||||
{
|
||||
templateContent = db.GetAgentTemplate(agentId, templateName);
|
||||
}
|
||||
else
|
||||
{
|
||||
templateName = "util-chart-plot_instruction";
|
||||
templateContent = db.GetAgentTemplate(BuiltInAgentId.UtilityAssistant, templateName);
|
||||
}
|
||||
|
||||
return templateContent;
|
||||
}
|
||||
|
||||
private (string, string) GetLlmProviderModel()
|
||||
{
|
||||
var provider = "openai";
|
||||
|
|
|
|||
|
|
@ -98,10 +98,9 @@ public class ReadImageFn : IFunctionCallback
|
|||
{
|
||||
try
|
||||
{
|
||||
var llmProviderService = _services.GetRequiredService<ILlmProviderService>();
|
||||
var provider = llmProviderService.GetProviders().FirstOrDefault(x => x == "openai");
|
||||
var model = llmProviderService.GetProviderModel(provider: provider, id: "gpt-4o", multiModal: true);
|
||||
var completion = CompletionProvider.GetChatCompletion(_services, provider: provider, model: model.Name);
|
||||
var provider = "openai";
|
||||
var model = "gpt-5-mini";
|
||||
var completion = CompletionProvider.GetChatCompletion(_services, provider: provider, model: model);
|
||||
var response = await completion.GetChatCompletions(agent, dialogs);
|
||||
return response.Content;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,10 +89,9 @@ public class ReadPdfFn : IFunctionCallback
|
|||
{
|
||||
try
|
||||
{
|
||||
var llmProviderService = _services.GetRequiredService<ILlmProviderService>();
|
||||
var provider = llmProviderService.GetProviders().FirstOrDefault(x => x == "openai");
|
||||
var model = llmProviderService.GetProviderModel(provider: provider, id: "gpt-4o", multiModal: true);
|
||||
var completion = CompletionProvider.GetChatCompletion(_services, provider: provider, model: model.Name);
|
||||
var provider = "openai";
|
||||
var model = "gpt-5-mini";
|
||||
var completion = CompletionProvider.GetChatCompletion(_services, provider: provider, model: model);
|
||||
var response = await completion.GetChatCompletions(agent, dialogs);
|
||||
return response.Content;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,8 +230,13 @@ public class QdrantDb : IVectorDb
|
|||
{
|
||||
foreach (var item in payload)
|
||||
{
|
||||
if (item.Value == null || item.Key.IsEqualTo(KnowledgePayloadName.Text))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var value = item.Value.DataValue?.ConvertToString();
|
||||
if (value == null || item.Key.IsEqualTo(KnowledgePayloadName.Text))
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue