Skip to content

Commit f73d734

Browse files
authored
Merge pull request #648 from hchen2020/master
Skip if agent if null
2 parents b51399c + a3856f6 commit f73d734

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

src/Infrastructure/BotSharp.Core/Plugins/PluginLoader.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,11 @@ public PluginDef UpdatePluginStatus(IServiceProvider services, string id, bool e
182182
foreach (var agentId in plugin.AgentIds)
183183
{
184184
var agent = agentService.LoadAgent(agentId).Result;
185-
agent.Disabled = true;
186-
agentService.UpdateAgent(agent, AgentField.Disabled);
185+
if (agent != null)
186+
{
187+
agent.Disabled = true;
188+
agentService.UpdateAgent(agent, AgentField.Disabled);
189+
}
187190
}
188191
}
189192
return plugin;

src/Plugins/BotSharp.Plugin.Planner/data/agents/282a7128-69a1-44b0-878c-a9159b88f3b9/instructions/instruction.liquid

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Use the TwoStagePlanner approach to plan the overall implementation steps, follow the below steps strictly.
22
1. call plan_primary_stage to generate the primary plan.
33
2. If need_additional_information is true, call plan_secondary_stage for the specific primary stage.
4-
3. You must call plan_summary as the last planning step to summarize the final query.
4+
3. You must call plan_summary for you final planned output.
55

66
*** IMPORTANT ***
77
Don't run the planning process repeatedly if you have already got the result of user's request.

src/Plugins/BotSharp.Plugin.Planner/data/agents/282a7128-69a1-44b0-878c-a9159b88f3b9/templates/database.summarize.mysql.liquid

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ VALUES ((SELECT MAX(Id) + 1 FROM data_Service), 'HVAC');
1414
If the table structure didn't mention auto incremental, the data field id needs to insert id manually and you need to use max(id) instead of LAST_INSERT_ID function.
1515
For example, you should use SET @id = select max(id) from table;
1616

17-
* the alias of the table name in the sql query should be identical.
17+
*** the alias of the table name in the sql query should be identical. ***
1818
*** the generated sql query MUST be basedd on the provided table structure. ***
19+
*** All queries return a maximum of 20 records. ***
20+
*** Only select user friendly columns. ***

src/Plugins/BotSharp.Plugin.Planner/data/agents/282a7128-69a1-44b0-878c-a9159b88f3b9/templates/database.summarize.sqlserver.liquid

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ The query must exactly based on the provided table structure. And carefully revi
77
Note: Output should be only the sql query with sql comments that can be directly run in SQL Server.
88

99
*** the alias of the table name in the sql query should be identical. ***
10-
*** The generated sql query MUST be basedd on the provided table structure. ***
10+
*** The generated sql query MUST be based on the provided table structure. ***
1111
*** All queries return a maximum of 10 records. ***
1212
*** Only select user friendly columns. ***

src/Plugins/BotSharp.Plugin.SqlDriver/Functions/ExecuteQueryFn.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public async Task<bool> Execute(RoleDialogModel message)
3636
private IEnumerable<dynamic> RunQueryInMySql(string[] sqlTexts)
3737
{
3838
var settings = _services.GetRequiredService<SqlDriverSetting>();
39-
using var connection = new MySqlConnection(settings.MySqlExecutionConnectionString);
39+
using var connection = new MySqlConnection(settings.MySqlExecutionConnectionString ?? settings.MySqlConnectionString);
4040
return connection.Query(string.Join(";\r\n", sqlTexts));
4141
}
4242

0 commit comments

Comments
 (0)