Skip to content

Commit f342498

Browse files
authored
Merge pull request #305 from SciSharp/mergecode
merge code
2 parents 14f2570 + c67dad4 commit f342498

File tree

77 files changed

+1148
-290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1148
-290
lines changed

docs/quick-start/installation.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Building solution using dotnet CLI (preferred).
1010

1111
### Clone the source code and build
1212
```powershell
13-
PS D:\> git clone https://github.com/Oceania2018/BotSharp
13+
PS D:\> git clone https://github.com/SciSharp/BotSharp
1414
PS D:\> cd BotSharp
1515
PS D:\> dotnet build
1616
```
@@ -62,28 +62,28 @@ So far, you have set up the Bot's running and development environment, but you c
6262

6363
**Ignore below section if you're going to just use REST API to interact with your bot.**
6464

65-
### Launch a chatbot UI (Optional)
66-
You can use a third-party open source UI for debugging and development, or you can directly use the REST API to integrate with your system.
67-
If you want to use the [Chatbot UI](https://github.com/mckaywrigley/chatbot-ui) as a front end.
65+
### Launch a BotSharp UI (Optional)
66+
BotSharp has an official front-end project to be used in conjunction with the backend. The main function of this project is to allow developers to visualize various configurations of the backend.
6867
```powershell
69-
PS D:\> git clone https://github.com/mckaywrigley/chatbot-ui
70-
PS D:\> cd chatbot-ui
71-
PS D:\> cd npm i
72-
PS D:\> cd npm run dev
68+
PS D:\> git clone https://github.com/SciSharp/BotSharp-UI
69+
PS D:\> cd BotSharp-UI
70+
PS D:\> npm install
71+
PS D:\> npm run dev
7372
```
7473

75-
Update API url in `.env.local` to your localhost BotSharp backend service.
74+
Update API url in `.env` to your localhost BotSharp backend service.
7675
```config
77-
OPENAI_API_HOST=http://localhost:5500
76+
PUBLIC_SERVICE_URL=http://localhost:5500
77+
PUBLIC_LIVECHAT_HOST=http://localhost:5015
7878
```
7979

80-
Point your web browser at http://localhost:3000 and enjoy Chatbot with BotSharp.
80+
Point your web browser at http://localhost:5015 and enjoy Chatbot with BotSharp.
8181

82-
![alt text](assets/ChatbotUIHome.png "Title")
82+
![BotSharp UI Router](assets/BotSharp-UI-Router.png)
8383

8484
## Install in NuGet
8585
If you don't want to use the source code to experience this framework, you can also directly install the [NuGet packages](https://www.nuget.org/packages?q=BotSharp) released by BotSharp, and install different function packages according to the needs of your project. Before installing, please read the documentation carefully to understand the functions that different modules can provide.
8686

8787
```powershell
8888
PS D:\> Install-Package BotSharp.Core
89-
```
89+
```

src/Infrastructure/BotSharp.Abstraction/Conversations/IConversationService.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using BotSharp.Abstraction.Loggers.Models;
12
using BotSharp.Abstraction.Repositories.Filters;
23

34
namespace BotSharp.Abstraction.Conversations;
@@ -14,6 +15,8 @@ public interface IConversationService
1415
Task<List<Conversation>> GetLastConversations();
1516
Task<bool> DeleteConversation(string id);
1617
Task<bool> TruncateConversation(string conversationId, string messageId);
18+
Task<List<ConversationContentLogModel>> GetConversationContentLogs(string conversationId);
19+
Task<List<ConversationStateLogModel>> GetConversationStateLogs(string conversationId);
1720

1821
/// <summary>
1922
/// Send message to LLM

src/Infrastructure/BotSharp.Abstraction/Conversations/Models/Conversation.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ public class Conversation
77
public string Id { get; set; } = string.Empty;
88
public string AgentId { get; set; } = string.Empty;
99
public string UserId { get; set; } = string.Empty;
10+
11+
/// <summary>
12+
/// Agent task id
13+
/// </summary>
14+
public string? TaskId { get; set; }
1015
public string Title { get; set; } = string.Empty;
1116

1217
[JsonIgnore]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using BotSharp.Abstraction.Messaging.Enums;
2+
3+
namespace BotSharp.Abstraction.Conversations.Models;
4+
5+
public class ConversationSenderActionModel
6+
{
7+
[JsonPropertyName("conversation_id")]
8+
public string ConversationId { get; set; }
9+
[JsonPropertyName("sender_action")]
10+
public SenderActionEnum SenderAction { get; set; }
11+
}

src/Infrastructure/BotSharp.Abstraction/Conversations/Models/ConversationStateLogModel.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Infrastructure/BotSharp.Abstraction/Conversations/Settings/ConversationSetting.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ public class ConversationSetting
99
public int MaxRecursiveDepth { get; set; } = 3;
1010
public bool EnableLlmCompletionLog { get; set; }
1111
public bool EnableExecutionLog { get; set; }
12+
public bool EnableContentLog { get; set; }
13+
public bool EnableStateLog { get; set; }
1214
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
namespace BotSharp.Abstraction.Loggers.Models;
22

3-
public class StreamingLogModel
3+
public class ConversationContentLogModel
44
{
55
[JsonPropertyName("conversation_id")]
66
public string ConversationId { get; set; }
7+
[JsonPropertyName("message_id")]
8+
public string MessageId { get; set; }
79
[JsonPropertyName("name")]
810
public string? Name { get; set; }
11+
[JsonPropertyName("role")]
12+
public string Role { get; set; }
913

1014
[JsonPropertyName("content")]
1115
public string Content { get; set; }
1216

1317
[JsonPropertyName("created_at")]
14-
public DateTime CreateTime { get; set; }
18+
public DateTime CreateTime { get; set; } = DateTime.UtcNow;
1519
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace BotSharp.Abstraction.Loggers.Models;
2+
3+
public class ConversationStateLogModel
4+
{
5+
[JsonPropertyName("conversation_id")]
6+
public string ConversationId { get; set; }
7+
[JsonPropertyName("message_id")]
8+
public string MessageId { get; set; }
9+
[JsonPropertyName("states")]
10+
public Dictionary<string, string> States { get; set; }
11+
[JsonPropertyName("created_at")]
12+
public DateTime CreateTime { get; set; } = DateTime.UtcNow;
13+
}

src/Infrastructure/BotSharp.Abstraction/Conversations/Models/LlmCompletionLog.cs renamed to src/Infrastructure/BotSharp.Abstraction/Loggers/Models/LlmCompletionLog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace BotSharp.Abstraction.Conversations.Models;
1+
namespace BotSharp.Abstraction.Loggers.Models;
22

33
public class LlmCompletionLog
44
{

src/Plugins/BotSharp.Plugin.MetaMessenger/MessagingModels/SenderActionEnum.cs renamed to src/Infrastructure/BotSharp.Abstraction/Messaging/Enums/SenderActionEnum.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
namespace BotSharp.Plugin.MetaMessenger.MessagingModels;
1+
using System.Runtime.Serialization;
2+
3+
namespace BotSharp.Abstraction.Messaging.Enums;
24

35
public enum SenderActionEnum
46
{
57
[EnumMember(Value = "typing_on")]
6-
TypingOn,
8+
TypingOn = 1,
79
[EnumMember(Value = "typing_off")]
810
TypingOff,
911
[EnumMember(Value = "mark_seen")]

0 commit comments

Comments
 (0)