Merge branch 'SciSharp:master' into master

This commit is contained in:
hchen2020 2024-09-05 13:49:16 -05:00 committed by GitHub
commit fc146d2225
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 6 deletions

View file

@ -9,7 +9,11 @@ public static class VectorStorageExtension
{
if (data?.Data == null) return string.Empty;
return $"Question: {data.Data[KnowledgePayloadName.Text]}\r\nAnswer: {data.Data[KnowledgePayloadName.Answer]}";
if (data.Data.TryGetValue(KnowledgePayloadName.Text, out var question)) { }
if (data.Data.TryGetValue(KnowledgePayloadName.Answer, out var answer)) { }
return $"Question: {question}\r\nAnswer: {answer}";
}
public static string ToPayloadPair(this VectorSearchResult data, IList<string> payloads)

View file

@ -41,7 +41,7 @@ public partial class AgentService : IAgentService
public string GetAgentDataDir(string agentId)
{
var dbSettings = _services.GetRequiredService<BotSharpDatabaseSettings>();
var dir = Path.Combine(dbSettings.FileRepository, _agentSettings.DataDir, agentId);
var dir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dbSettings.FileRepository, _agentSettings.DataDir, agentId);
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);

View file

@ -64,7 +64,7 @@ public class RouteToAgentRoutingHandler : RoutingHandlerBase, IRoutingHandler
if (message.FunctionName != null)
{
var msg = RoleDialogModel.From(message, role: AgentRole.Function);
var ret = await routing.InvokeFunction(message.FunctionName, msg);
await routing.InvokeFunction(message.FunctionName, msg);
}
var agentId = routing.Context.GetCurrentAgentId();
@ -83,9 +83,7 @@ public class RouteToAgentRoutingHandler : RoutingHandlerBase, IRoutingHandler
{
var content = $"This agent ({agent.Name}) is disabled, please install the corresponding plugin ({agent.Plugin.Name}) to activate this agent.";
message = RoleDialogModel.From(message,
role: AgentRole.Assistant,
content: content);
message = RoleDialogModel.From(message, role: AgentRole.Assistant, content: content);
_dialogs.Add(message);
}
else

View file

@ -8,4 +8,5 @@ Global Knowledge:
{% for k in global_knowledges %}
{{ k }}
{% endfor %}
=====
{%- endif %}