dotnet run --project .\src\WebStarter

This commit is contained in:
Haiping Chen 2024-01-18 05:30:28 -06:00
parent 8c69c6f6da
commit 6224a04b96
12 changed files with 59 additions and 32 deletions

View file

@ -77,7 +77,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Plugin.TelegramBot
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Logger", "src\Infrastructure\BotSharp.Logger\BotSharp.Logger.csproj", "{5CA3335E-E6AD-46FD-B277-29BBC3A16500}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotSharp.Plugin.HttpHandler", "src\Plugins\BotSharp.Plugin.HttpHandler\BotSharp.Plugin.HttpHandler.csproj", "{32D9E720-6FE6-4F29-94B1-B10B05BFAD75}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Plugin.HttpHandler", "src\Plugins\BotSharp.Plugin.HttpHandler\BotSharp.Plugin.HttpHandler.csproj", "{32D9E720-6FE6-4F29-94B1-B10B05BFAD75}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Plugin.SqlDriver", "src\Plugins\BotSharp.Plugin.SqlDriver\BotSharp.Plugin.SqlDriver.csproj", "{D775DB67-A4B4-44E5-9144-522689590057}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -303,6 +305,14 @@ Global
{32D9E720-6FE6-4F29-94B1-B10B05BFAD75}.Release|Any CPU.Build.0 = Release|Any CPU
{32D9E720-6FE6-4F29-94B1-B10B05BFAD75}.Release|x64.ActiveCfg = Release|Any CPU
{32D9E720-6FE6-4F29-94B1-B10B05BFAD75}.Release|x64.Build.0 = Release|Any CPU
{D775DB67-A4B4-44E5-9144-522689590057}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D775DB67-A4B4-44E5-9144-522689590057}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D775DB67-A4B4-44E5-9144-522689590057}.Debug|x64.ActiveCfg = Debug|Any CPU
{D775DB67-A4B4-44E5-9144-522689590057}.Debug|x64.Build.0 = Debug|Any CPU
{D775DB67-A4B4-44E5-9144-522689590057}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D775DB67-A4B4-44E5-9144-522689590057}.Release|Any CPU.Build.0 = Release|Any CPU
{D775DB67-A4B4-44E5-9144-522689590057}.Release|x64.ActiveCfg = Release|Any CPU
{D775DB67-A4B4-44E5-9144-522689590057}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -342,6 +352,7 @@ Global
{DCA18996-4D3A-4E98-BCD0-1FB77C59253E} = {64264688-0F5C-4AB0-8F2B-B59B717CCE00}
{5CA3335E-E6AD-46FD-B277-29BBC3A16500} = {E29DC6C4-5E57-48C5-BCB0-6B8F84782749}
{32D9E720-6FE6-4F29-94B1-B10B05BFAD75} = {51AFE054-AE99-497D-A593-69BAEFB5106F}
{D775DB67-A4B4-44E5-9144-522689590057} = {51AFE054-AE99-497D-A593-69BAEFB5106F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A9969D89-C98B-40A5-A12B-FC87E55B3A19}

View file

@ -6,10 +6,14 @@ In order to allow developers to experience the convenience of BotSharp as quickl
### Run in command line
```console
```shell
git clone https://github.com/SciSharp/BotSharp
cd BotSharp
# Run PizzzaBot showcase with package reference
dotnet run --project .\src\WebStarter\WebStarter.csproj -p SolutionName=PizzaBot
# Use BotSharp to include all dependent projects with latest source code
dotnet run --project .\src\WebStarter
```
Here you go, you will see this running screen.
@ -27,7 +31,7 @@ BotSharp has an official front-end project to be used in conjunction with the ba
```console
git clone https://github.com/SciSharp/BotSharp-UI
cd BotSharp-UI
npm install --force
npm install
npm run dev
```

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>$(LangVersion)</LangVersion>

View file

@ -1,21 +1,21 @@
using BotSharp.Abstraction.Conversations.Models;
using BotSharp.Abstraction.Functions;
using BotSharp.Plugin.SqlHero.Models;
using BotSharp.Plugin.SqlDriver.Models;
using BotSharp.Plugin.SqlHero.Settings;
using Dapper;
using MySqlConnector;
using System.Text.Json;
using System.Threading.Tasks;
namespace BotSharp.Plugin.SqlHero.Actions;
namespace BotSharp.Plugin.SqlDriver.Actions;
public class ExecuteQueryAction : IFunctionCallback
{
public string Name => "execute_sql";
private readonly SqlHeroSetting _setting;
private readonly SqlDriverSetting _setting;
public ExecuteQueryAction(SqlHeroSetting setting)
public ExecuteQueryAction(SqlDriverSetting setting)
{
_setting = setting;
}

View file

@ -3,7 +3,10 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<RootNamespace>$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<LangVersion>$(LangVersion)</LangVersion>
<VersionPrefix>$(BotSharpVersion)</VersionPrefix>
<GeneratePackageOnBuild>$(GeneratePackageOnBuild)</GeneratePackageOnBuild>
<GenerateDocumentationFile>$(GenerateDocumentationFile)</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>

View file

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace BotSharp.Plugin.SqlHero.Models;
namespace BotSharp.Plugin.SqlDriver.Models;
public class LlmInputArgs
{

View file

@ -1,6 +1,6 @@
namespace BotSharp.Plugin.SqlHero.Settings;
public class SqlHeroSetting
public class SqlDriverSetting
{
public string MySqlConnectionString { get; set; }
}

View file

@ -6,17 +6,18 @@ using System;
using System.Drawing;
using System.Text.RegularExpressions;
namespace BotSharp.Plugin.SqlHero;
namespace BotSharp.Plugin.SqlDriver;
public class SqlHeroPlugin : IBotSharpPlugin
public class SqlDriverPlugin : IBotSharpPlugin
{
public string Name => "SQL Hero";
public string Id => "da7b6f7a-b1f0-455a-9939-ad2d493e929e";
public string Name => "SQL Driver";
public string Description => "Convert the requirements into corresponding SQL statements and execute if needed";
public void RegisterDI(IServiceCollection services, IConfiguration config)
{
var settings = new SqlHeroSetting();
config.Bind("SqlHero", settings);
var settings = new SqlDriverSetting();
config.Bind("SqlDriver", settings);
services.AddSingleton(x =>
{
Console.WriteLine($"Loaded SqlHero settings:: {Regex.Replace(settings.MySqlConnectionString, "password=.*?;", "password=******;")}", Color.Yellow);

View file

@ -1,9 +1,9 @@
{
"id": "beda4c12-e1ec-4b4b-b328-3df4a6687c4f",
"name": "SQL Expert",
"name": "SQL Driver",
"description": "Convert the requirements into corresponding SQL statements according to the table structure and execute them if needed.",
"createdDateTime": "2023-11-15T13:49:00Z",
"updatedDateTime": "2023-11-15T13:49:00Z",
"isPublic": false,
"allowRouting": false
"allowRouting": true
}

View file

@ -1,4 +1,4 @@
You are a SQL Expert who knows how to convert business requirements to SQL expressions.
You are a SQL Driver who knows how to convert business requirements to SQL expressions.
Follow these steps:
1: Look at the table DDL defintions especially for the CONSTRAINT and FOREIGN KEY REFERENCES.

View file

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -23,13 +23,6 @@
<PackageReference Include="BotSharp.Plugin.WeChat" Version="$(BotSharpVersion)" />
</ItemGroup>
<ItemGroup>
<Compile Remove="logs\**" />
<Content Remove="logs\**" />
<EmbeddedResource Remove="logs\**" />
<None Remove="logs\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Serilog.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
@ -37,14 +30,17 @@
<ItemGroup>
<ProjectReference Include="..\..\tests\BotSharp.Plugin.PizzaBot\BotSharp.Plugin.PizzaBot.csproj" />
<ProjectReference Include="..\Infrastructure\BotSharp.Logger\BotSharp.Logger.csproj" />
<ProjectReference Include="..\Infrastructure\BotSharp.OpenAPI\BotSharp.OpenAPI.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.ChatHub\BotSharp.Plugin.ChatHub.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.HttpHandler\BotSharp.Plugin.HttpHandler.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.LLamaSharp\BotSharp.Plugin.LLamaSharp.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.SqlDriver\BotSharp.Plugin.SqlDriver.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.WebDriver\BotSharp.Plugin.WebDriver.csproj" />
</ItemGroup>
<ItemGroup Condition="$(SolutionName)==BotSharp">
<ProjectReference Include="..\Infrastructure\BotSharp.Core\BotSharp.Core.csproj" />
<ProjectReference Include="..\Infrastructure\BotSharp.Logger\BotSharp.Logger.csproj" />
<ProjectReference Include="..\Infrastructure\BotSharp.OpenAPI\BotSharp.OpenAPI.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.GoogleAI\BotSharp.Plugin.GoogleAI.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.MongoStorage\BotSharp.Plugin.MongoStorage.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.AzureOpenAI\BotSharp.Plugin.AzureOpenAI.csproj" />
@ -58,7 +54,6 @@
<ProjectReference Include="..\Plugins\BotSharp.Plugin.WeChat\BotSharp.Plugin.WeChat.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.SemanticKernel\BotSharp.Plugin.SemanticKernel.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.Twilio\BotSharp.Plugin.Twilio.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.ChatHub\BotSharp.Plugin.ChatHub.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.TelegramBots\BotSharp.Plugin.TelegramBots.csproj" />
</ItemGroup>

View file

@ -43,6 +43,19 @@
"Type": "chat"
}
]
},
{
"Provider": "huggingface",
"Models": [
{
"Name": "mistralai/Mistral-7B-v0.1",
"Type": "text"
},
{
"Name": "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
"Type": "text"
}
]
}
],
@ -60,7 +73,7 @@
"Agent": {
"DataDir": "agents",
"TemplateFormat": "liquid",
"MaxRecursiveDepth": 3,
"HostAgentId": "01e2fc5c-2c89-4ec7-8470-7688608b496c",
"LlmConfig": {
"Provider": "azure-openai",
"Model": "gpt-35-turbo"