diff --git a/src/Infrastructure/BotSharp.Abstraction/Conversations/Dtos/ChatResponseDto.cs b/src/Infrastructure/BotSharp.Abstraction/Conversations/Dtos/ChatResponseDto.cs
new file mode 100644
index 00000000..b391bc7b
--- /dev/null
+++ b/src/Infrastructure/BotSharp.Abstraction/Conversations/Dtos/ChatResponseDto.cs
@@ -0,0 +1,40 @@
+using BotSharp.Abstraction.Functions.Models;
+using BotSharp.Abstraction.Instructs.Models;
+using BotSharp.Abstraction.Messaging;
+using BotSharp.Abstraction.Messaging.Models.RichContent;
+using BotSharp.Abstraction.Users.Dtos;
+
+namespace BotSharp.Abstraction.Conversations.Dtos;
+
+public class ChatResponseDto : InstructResult
+{
+ [JsonPropertyName("conversation_id")]
+ public string ConversationId { get; set; } = string.Empty;
+
+ public UserDto Sender { get; set; } = new UserDto();
+
+ public string? Function { get; set; }
+
+ ///
+ /// Planner instruction
+ ///
+ [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+ public FunctionCallFromLlm? Instruction { get; set; }
+
+ ///
+ /// Rich message for UI rendering
+ ///
+ [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+ [JsonPropertyName("rich_content")]
+ public RichContent? RichContent { get; set; }
+
+ [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
+ [JsonPropertyName("payload")]
+ public string? Payload { get; set; }
+
+ [JsonPropertyName("has_message_files")]
+ public bool HasMessageFiles { get; set; }
+
+ [JsonPropertyName("created_at")]
+ public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
+}
diff --git a/src/Infrastructure/BotSharp.Abstraction/Conversations/Dtos/ConversationDto.cs b/src/Infrastructure/BotSharp.Abstraction/Conversations/Dtos/ConversationDto.cs
new file mode 100644
index 00000000..d30b4309
--- /dev/null
+++ b/src/Infrastructure/BotSharp.Abstraction/Conversations/Dtos/ConversationDto.cs
@@ -0,0 +1,64 @@
+using BotSharp.Abstraction.Conversations.Enums;
+using BotSharp.Abstraction.Users.Dtos;
+
+namespace BotSharp.Abstraction.Conversations.Dtos;
+
+public class ConversationDto
+{
+ public string Id { get; set; }
+
+ [JsonPropertyName("agent_id")]
+ public string AgentId { get; set; }
+
+ [JsonPropertyName("agent_name")]
+ public string AgentName { get; set; }
+
+ [JsonPropertyName("title")]
+ public string Title { get; set; } = string.Empty;
+
+ [JsonPropertyName("title_alias")]
+ public string TitleAlias { get; set; } = string.Empty;
+
+ public UserDto User { get; set; } = new UserDto();
+
+ public string Channel { get; set; } = ConversationChannel.OpenAPI;
+
+ ///
+ /// Agent task id
+ ///
+ [JsonPropertyName("task_id")]
+ public string? TaskId { get; set; }
+
+ public string Status { get; set; }
+ public Dictionary States { get; set; } = [];
+
+ public List Tags { get; set; } = new();
+
+ [JsonPropertyName("updated_time")]
+ public DateTime UpdatedTime { get; set; } = DateTime.UtcNow;
+
+ [JsonPropertyName("created_time")]
+ public DateTime CreatedTime { get; set; } = DateTime.UtcNow;
+
+ public static ConversationDto FromSession(Conversation sess)
+ {
+ return new ConversationDto
+ {
+ Id = sess.Id,
+ User = new UserDto
+ {
+ Id = sess.UserId
+ },
+ AgentId = sess.AgentId,
+ Title = sess.Title,
+ TitleAlias = sess.TitleAlias,
+ Channel = sess.Channel,
+ Status = sess.Status,
+ TaskId = sess.TaskId,
+ Tags = sess.Tags ?? [],
+ States = sess.States ?? [],
+ CreatedTime = sess.CreatedTime,
+ UpdatedTime = sess.UpdatedTime
+ };
+ }
+}
diff --git a/src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabHook.cs b/src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabHook.cs
similarity index 88%
rename from src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabHook.cs
rename to src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabHook.cs
index 68d0e032..6ad7e06a 100644
--- a/src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabHook.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabHook.cs
@@ -1,4 +1,4 @@
-namespace BotSharp.Core.Crontab.Abstraction;
+namespace BotSharp.Abstraction.Crontab;
public interface ICrontabHook
{
diff --git a/src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabService.cs b/src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabService.cs
similarity index 74%
rename from src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabService.cs
rename to src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabService.cs
index 39c13779..97ef728f 100644
--- a/src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabService.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabService.cs
@@ -1,4 +1,4 @@
-namespace BotSharp.Core.Crontab.Abstraction;
+namespace BotSharp.Abstraction.Crontab;
public interface ICrontabService
{
diff --git a/src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabSource.cs b/src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabSource.cs
similarity index 86%
rename from src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabSource.cs
rename to src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabSource.cs
index 2d34b2bb..d294a233 100644
--- a/src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabSource.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/Crontab/ICrontabSource.cs
@@ -1,4 +1,4 @@
-namespace BotSharp.Core.Crontab.Abstraction;
+namespace BotSharp.Abstraction.Crontab;
///
/// Provide a cron source for the crontab service.
diff --git a/src/Infrastructure/BotSharp.Core.Realtime/Models/Options/ChatSessionOptions.cs b/src/Infrastructure/BotSharp.Abstraction/Realtime/Models/Session/ChatSessionOptions.cs
similarity index 63%
rename from src/Infrastructure/BotSharp.Core.Realtime/Models/Options/ChatSessionOptions.cs
rename to src/Infrastructure/BotSharp.Abstraction/Realtime/Models/Session/ChatSessionOptions.cs
index aeec0b6d..3bcba8ba 100644
--- a/src/Infrastructure/BotSharp.Core.Realtime/Models/Options/ChatSessionOptions.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/Realtime/Models/Session/ChatSessionOptions.cs
@@ -1,4 +1,6 @@
-namespace BotSharp.Core.Realtime.Models.Options;
+using System.Text.Json;
+
+namespace BotSharp.Abstraction.Realtime.Models.Session;
public class ChatSessionOptions
{
diff --git a/src/Infrastructure/BotSharp.Core.Realtime/Models/Chat/ChatSessionUpdate.cs b/src/Infrastructure/BotSharp.Abstraction/Realtime/Models/Session/ChatSessionUpdate.cs
similarity index 70%
rename from src/Infrastructure/BotSharp.Core.Realtime/Models/Chat/ChatSessionUpdate.cs
rename to src/Infrastructure/BotSharp.Abstraction/Realtime/Models/Session/ChatSessionUpdate.cs
index 9fd17256..7de2d0fd 100644
--- a/src/Infrastructure/BotSharp.Core.Realtime/Models/Chat/ChatSessionUpdate.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/Realtime/Models/Session/ChatSessionUpdate.cs
@@ -1,4 +1,4 @@
-namespace BotSharp.Core.Realtime.Models.Chat;
+namespace BotSharp.Abstraction.Realtime.Models.Session;
public class ChatSessionUpdate
{
diff --git a/src/Infrastructure/BotSharp.Abstraction/Users/Dtos/UserDto.cs b/src/Infrastructure/BotSharp.Abstraction/Users/Dtos/UserDto.cs
new file mode 100644
index 00000000..6f40cdfd
--- /dev/null
+++ b/src/Infrastructure/BotSharp.Abstraction/Users/Dtos/UserDto.cs
@@ -0,0 +1,73 @@
+using BotSharp.Abstraction.Users.Enums;
+using BotSharp.Abstraction.Users.Models;
+
+namespace BotSharp.Abstraction.Users.Dtos;
+
+public class UserDto
+{
+ public string Id { get; set; } = string.Empty;
+
+ [JsonPropertyName("user_name")]
+ public string UserName { get; set; } = string.Empty;
+
+ [JsonPropertyName("first_name")]
+ public string FirstName { get; set; } = string.Empty;
+
+ [JsonPropertyName("last_name")]
+ public string? LastName { get; set; }
+ public string? Email { get; set; }
+ public string? Phone { get; set; }
+ public string Type { get; set; } = UserType.Client;
+ public string Role { get; set; } = UserRole.User;
+
+ [JsonPropertyName("full_name")]
+ public string FullName => $"{FirstName} {LastName}".Trim();
+ public string? Source { get; set; }
+
+ [JsonPropertyName("external_id")]
+ public string? ExternalId { get; set; }
+ public string Avatar { get; set; } = "/user/avatar";
+
+ public IEnumerable Permissions { get; set; } = [];
+
+ [JsonPropertyName("create_date")]
+ public DateTime CreateDate { get; set; }
+
+ [JsonPropertyName("update_date")]
+ public DateTime UpdateDate { get; set; }
+
+ public string RegionCode { get; set; } = "CN";
+
+ public static UserDto FromUser(User user)
+ {
+ if (user == null)
+ {
+ return new UserDto
+ {
+ FirstName = "Unknown",
+ LastName = "Anonymous",
+ Type = UserType.Client,
+ Role = AgentRole.User
+ };
+ }
+
+ return new UserDto
+ {
+ Id = user.Id,
+ UserName = user.UserName,
+ FirstName = user.FirstName,
+ LastName = user.LastName,
+ Email = user.Email,
+ Phone = !string.IsNullOrWhiteSpace(user.Phone) ? user.Phone.Replace("+86", string.Empty) : user.Phone,
+ Type = user.Type,
+ Role = user.Role,
+ Source = user.Source,
+ ExternalId = user.ExternalId,
+ Permissions = user.Permissions,
+ CreateDate = user.CreatedTime,
+ UpdateDate = user.UpdatedTime,
+ Avatar = "/user/avatar",
+ RegionCode = string.IsNullOrWhiteSpace(user.RegionCode) ? "CN" : user.RegionCode
+ };
+ }
+}
diff --git a/src/Infrastructure/BotSharp.Core.Crontab/BotSharp.Core.Crontab.csproj b/src/Infrastructure/BotSharp.Core.Crontab/BotSharp.Core.Crontab.csproj
index f406ac97..00f4856d 100644
--- a/src/Infrastructure/BotSharp.Core.Crontab/BotSharp.Core.Crontab.csproj
+++ b/src/Infrastructure/BotSharp.Core.Crontab/BotSharp.Core.Crontab.csproj
@@ -1,4 +1,4 @@
-
+
$(TargetFramework)
@@ -10,6 +10,12 @@
enable
+
+
+
+
+
+
@@ -35,8 +41,4 @@
-
-
-
-
diff --git a/src/Infrastructure/BotSharp.Core.Crontab/Functions/TaskWaitFn.cs b/src/Infrastructure/BotSharp.Core.Crontab/Functions/TaskWaitFn.cs
index 0fb68dc9..08295c48 100644
--- a/src/Infrastructure/BotSharp.Core.Crontab/Functions/TaskWaitFn.cs
+++ b/src/Infrastructure/BotSharp.Core.Crontab/Functions/TaskWaitFn.cs
@@ -1,11 +1,5 @@
using BotSharp.Core.Crontab.Hooks;
using Microsoft.Extensions.Logging;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Text.Json.Serialization;
-using System.Threading.Tasks;
namespace BotSharp.Core.Crontab.Functions;
diff --git a/src/Infrastructure/BotSharp.Core.Crontab/Using.cs b/src/Infrastructure/BotSharp.Core.Crontab/Using.cs
index 0420faf7..f1b7a838 100644
--- a/src/Infrastructure/BotSharp.Core.Crontab/Using.cs
+++ b/src/Infrastructure/BotSharp.Core.Crontab/Using.cs
@@ -4,10 +4,10 @@ global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using BotSharp.Abstraction.Agents.Enums;
+global using BotSharp.Abstraction.Crontab;
global using BotSharp.Abstraction.Crontab.Models;
global using BotSharp.Abstraction.Agents;
global using BotSharp.Abstraction.Plugins;
global using BotSharp.Abstraction.Conversations.Models;
global using BotSharp.Abstraction.Functions;
-global using BotSharp.Core.Crontab.Services;
-global using BotSharp.Core.Crontab.Abstraction;
\ No newline at end of file
+global using BotSharp.Core.Crontab.Services;
\ No newline at end of file
diff --git a/src/Infrastructure/BotSharp.Core.MCP/Hooks/MCPToolAgentHook.cs b/src/Infrastructure/BotSharp.Core.MCP/Hooks/MCPToolAgentHook.cs
index c0ccaaab..46eef141 100644
--- a/src/Infrastructure/BotSharp.Core.MCP/Hooks/MCPToolAgentHook.cs
+++ b/src/Infrastructure/BotSharp.Core.MCP/Hooks/MCPToolAgentHook.cs
@@ -28,13 +28,7 @@ public class McpToolAgentHook : AgentHookBase
agent.SecondaryFunctions ??= [];
var functions = GetMcpContent(agent).Result;
- foreach (var fn in functions)
- {
- if (!agent.SecondaryFunctions.Any(x => x.Name.Equals(fn.Name, StringComparison.OrdinalIgnoreCase)))
- {
- agent.SecondaryFunctions.Add(fn);
- }
- }
+ agent.SecondaryFunctions = agent.SecondaryFunctions.Concat(functions).DistinctBy(x => x.Name).ToList();
}
private async Task> GetMcpContent(Agent agent)
diff --git a/src/Infrastructure/BotSharp.Core.Realtime/BotSharp.Core.Realtime.csproj b/src/Infrastructure/BotSharp.Core.Realtime/BotSharp.Core.Realtime.csproj
index a0500769..e1a45883 100644
--- a/src/Infrastructure/BotSharp.Core.Realtime/BotSharp.Core.Realtime.csproj
+++ b/src/Infrastructure/BotSharp.Core.Realtime/BotSharp.Core.Realtime.csproj
@@ -12,11 +12,9 @@
-
-
diff --git a/src/Infrastructure/BotSharp.Core.Realtime/Using.cs b/src/Infrastructure/BotSharp.Core.Realtime/Using.cs
index 6dce4532..41243fd0 100644
--- a/src/Infrastructure/BotSharp.Core.Realtime/Using.cs
+++ b/src/Infrastructure/BotSharp.Core.Realtime/Using.cs
@@ -1,7 +1,6 @@
global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.DependencyInjection;
-global using System.Net.WebSockets;
global using System.Text;
global using System.Text.Json;
@@ -15,7 +14,3 @@ global using BotSharp.Abstraction.Agents;
global using BotSharp.Abstraction.Routing;
global using BotSharp.Abstraction.Agents.Enums;
global using BotSharp.Abstraction.Conversations.Models;
-
-global using BotSharp.Core.Realtime.Models.Chat;
-global using BotSharp.Core.Realtime.Models.Options;
-global using BotSharp.Core.Realtime.Websocket.Chat;
diff --git a/src/Infrastructure/BotSharp.Core/Agents/Hooks/BasicAgentHook.cs b/src/Infrastructure/BotSharp.Core/Agents/Hooks/BasicAgentHook.cs
index 5ab0ea03..359b6e4e 100644
--- a/src/Infrastructure/BotSharp.Core/Agents/Hooks/BasicAgentHook.cs
+++ b/src/Infrastructure/BotSharp.Core/Agents/Hooks/BasicAgentHook.cs
@@ -25,18 +25,8 @@ public class BasicAgentHook : AgentHookBase
var (functions, templates) = GetUtilityContent(agent);
- foreach (var fn in functions)
- {
- if (!agent.SecondaryFunctions.Any(x => x.Name.Equals(fn.Name, StringComparison.OrdinalIgnoreCase)))
- {
- agent.SecondaryFunctions.Add(fn);
- }
- }
-
- foreach (var prompt in templates)
- {
- agent.SecondaryInstructions.Add(prompt);
- }
+ agent.SecondaryFunctions = agent.SecondaryFunctions.Concat(functions).DistinctBy(x => x.Name).ToList();
+ agent.SecondaryInstructions = agent.SecondaryInstructions.Concat(templates).Distinct().ToList();
}
diff --git a/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj b/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj
index 5c27be38..89619484 100644
--- a/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj
+++ b/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj
@@ -221,6 +221,7 @@
+
diff --git a/src/Infrastructure/BotSharp.Core.Realtime/Websocket/Common/AsyncWebsocketDataCollectionResult.cs b/src/Infrastructure/BotSharp.Core/Infrastructures/Websocket/AsyncWebsocketDataCollectionResult.cs
similarity index 90%
rename from src/Infrastructure/BotSharp.Core.Realtime/Websocket/Common/AsyncWebsocketDataCollectionResult.cs
rename to src/Infrastructure/BotSharp.Core/Infrastructures/Websocket/AsyncWebsocketDataCollectionResult.cs
index 6fbcdb75..4f16397e 100644
--- a/src/Infrastructure/BotSharp.Core.Realtime/Websocket/Common/AsyncWebsocketDataCollectionResult.cs
+++ b/src/Infrastructure/BotSharp.Core/Infrastructures/Websocket/AsyncWebsocketDataCollectionResult.cs
@@ -1,7 +1,8 @@
-using BotSharp.Core.Realtime.Models.Options;
+using BotSharp.Abstraction.Realtime.Models.Session;
using System.ClientModel;
+using System.Net.WebSockets;
-namespace BotSharp.Core.Realtime.Websocket.Common;
+namespace BotSharp.Core.Infrastructures.Websocket;
internal class AsyncWebsocketDataCollectionResult : AsyncCollectionResult
{
diff --git a/src/Infrastructure/BotSharp.Core.Realtime/Websocket/Common/AsyncWebsocketDataResultEnumerator.cs b/src/Infrastructure/BotSharp.Core/Infrastructures/Websocket/AsyncWebsocketDataResultEnumerator.cs
similarity index 93%
rename from src/Infrastructure/BotSharp.Core.Realtime/Websocket/Common/AsyncWebsocketDataResultEnumerator.cs
rename to src/Infrastructure/BotSharp.Core/Infrastructures/Websocket/AsyncWebsocketDataResultEnumerator.cs
index f7871428..692e7220 100644
--- a/src/Infrastructure/BotSharp.Core.Realtime/Websocket/Common/AsyncWebsocketDataResultEnumerator.cs
+++ b/src/Infrastructure/BotSharp.Core/Infrastructures/Websocket/AsyncWebsocketDataResultEnumerator.cs
@@ -1,8 +1,9 @@
-using BotSharp.Core.Realtime.Models.Options;
+using BotSharp.Abstraction.Realtime.Models.Session;
using System.Buffers;
using System.ClientModel;
+using System.Net.WebSockets;
-namespace BotSharp.Core.Realtime.Websocket.Common;
+namespace BotSharp.Core.Infrastructures.Websocket;
internal class AsyncWebsocketDataResultEnumerator : IAsyncEnumerator
{
diff --git a/src/Infrastructure/BotSharp.Core.Realtime/Websocket/Common/WebsocketPipelineResponse.cs b/src/Infrastructure/BotSharp.Core/Infrastructures/Websocket/WebsocketPipelineResponse.cs
similarity index 97%
rename from src/Infrastructure/BotSharp.Core.Realtime/Websocket/Common/WebsocketPipelineResponse.cs
rename to src/Infrastructure/BotSharp.Core/Infrastructures/Websocket/WebsocketPipelineResponse.cs
index fbbf9ff2..2ca98cc9 100644
--- a/src/Infrastructure/BotSharp.Core.Realtime/Websocket/Common/WebsocketPipelineResponse.cs
+++ b/src/Infrastructure/BotSharp.Core/Infrastructures/Websocket/WebsocketPipelineResponse.cs
@@ -1,7 +1,9 @@
using System.ClientModel.Primitives;
+using System.IO;
using System.Net;
+using System.Net.WebSockets;
-namespace BotSharp.Core.Realtime.Websocket.Common;
+namespace BotSharp.Core.Infrastructures.Websocket;
internal class WebsocketPipelineResponse : PipelineResponse
{
diff --git a/src/Infrastructure/BotSharp.Core.Realtime/Websocket/Chat/BotSharpRealtimeSession.cs b/src/Infrastructure/BotSharp.Core/Session/BotSharpRealtimeSession.cs
similarity index 96%
rename from src/Infrastructure/BotSharp.Core.Realtime/Websocket/Chat/BotSharpRealtimeSession.cs
rename to src/Infrastructure/BotSharp.Core/Session/BotSharpRealtimeSession.cs
index 5798a8ca..0c863b7b 100644
--- a/src/Infrastructure/BotSharp.Core.Realtime/Websocket/Chat/BotSharpRealtimeSession.cs
+++ b/src/Infrastructure/BotSharp.Core/Session/BotSharpRealtimeSession.cs
@@ -1,8 +1,8 @@
-using BotSharp.Core.Realtime.Websocket.Common;
using System.ClientModel;
+using System.Net.WebSockets;
using System.Runtime.CompilerServices;
-namespace BotSharp.Core.Realtime.Websocket.Chat;
+namespace BotSharp.Core.Session;
public class BotSharpRealtimeSession : IDisposable
{
diff --git a/src/Infrastructure/BotSharp.Core.Realtime/Websocket/Llm/LlmRealtimeSession.cs b/src/Infrastructure/BotSharp.Core/Session/LlmRealtimeSession.cs
similarity index 94%
rename from src/Infrastructure/BotSharp.Core.Realtime/Websocket/Llm/LlmRealtimeSession.cs
rename to src/Infrastructure/BotSharp.Core/Session/LlmRealtimeSession.cs
index 4d956df0..70b8ba09 100644
--- a/src/Infrastructure/BotSharp.Core.Realtime/Websocket/Llm/LlmRealtimeSession.cs
+++ b/src/Infrastructure/BotSharp.Core/Session/LlmRealtimeSession.cs
@@ -1,10 +1,8 @@
using System.ClientModel;
+using System.Net.WebSockets;
using System.Runtime.CompilerServices;
-using BotSharp.Core.Realtime.Models.Chat;
-using BotSharp.Core.Realtime.Models.Options;
-using BotSharp.Core.Realtime.Websocket.Common;
-namespace BotSharp.Core.Realtime.Websocket.Llm;
+namespace BotSharp.Core.Session;
public class LlmRealtimeSession : IDisposable
{
diff --git a/src/Infrastructure/BotSharp.Core/Using.cs b/src/Infrastructure/BotSharp.Core/Using.cs
index 91c12038..8b63f96c 100644
--- a/src/Infrastructure/BotSharp.Core/Using.cs
+++ b/src/Infrastructure/BotSharp.Core/Using.cs
@@ -42,11 +42,13 @@ global using BotSharp.Abstraction.Statistics.Services;
global using BotSharp.Abstraction.Loggers.Services;
global using BotSharp.Abstraction.Infrastructures.Events;
global using BotSharp.Abstraction.Templating.Constants;
+global using BotSharp.Abstraction.Realtime.Models.Session;
global using BotSharp.Core.Repository;
global using BotSharp.Core.Routing;
global using BotSharp.Core.Agents.Services;
global using BotSharp.Core.Conversations.Services;
global using BotSharp.Core.Infrastructures;
+global using BotSharp.Core.Infrastructures.Websocket;
global using BotSharp.Core.Users.Services;
global using BotSharp.Core.Statistics.Services;
global using BotSharp.Core.Loggers.Services;
\ No newline at end of file
diff --git a/src/Infrastructure/BotSharp.OpenAPI/Controllers/ConversationController.cs b/src/Infrastructure/BotSharp.OpenAPI/Controllers/ConversationController.cs
index ebbda722..5e180f22 100644
--- a/src/Infrastructure/BotSharp.OpenAPI/Controllers/ConversationController.cs
+++ b/src/Infrastructure/BotSharp.OpenAPI/Controllers/ConversationController.cs
@@ -3,6 +3,7 @@ using BotSharp.Abstraction.Files.Enums;
using BotSharp.Abstraction.Files.Utilities;
using BotSharp.Abstraction.Options;
using BotSharp.Abstraction.Routing;
+using BotSharp.Abstraction.Users.Dtos;
using BotSharp.Core.Infrastructures;
namespace BotSharp.OpenAPI.Controllers;
@@ -108,7 +109,7 @@ public class ConversationController : ControllerBase
CreatedAt = message.CreatedAt,
Text = !string.IsNullOrEmpty(message.SecondaryContent) ? message.SecondaryContent : message.Content,
Data = message.Data,
- Sender = UserViewModel.FromUser(user),
+ Sender = UserDto.FromUser(user),
Payload = message.Payload,
HasMessageFiles = fileMessages.Any(x => x.MessageId.IsEqualTo(message.MessageId) && x.FileSource == FileSourceType.User)
});
@@ -124,7 +125,7 @@ public class ConversationController : ControllerBase
Text = !string.IsNullOrEmpty(message.SecondaryContent) ? message.SecondaryContent : message.Content,
Function = message.FunctionName,
Data = message.Data,
- Sender = new UserViewModel
+ Sender = new()
{
FirstName = agent?.Name ?? "Unkown",
Role = message.Role,
diff --git a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Request/UpdateMessageModel.cs b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Request/UpdateMessageModel.cs
index 8ae28dfd..7653fb19 100644
--- a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Request/UpdateMessageModel.cs
+++ b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Request/UpdateMessageModel.cs
@@ -1,3 +1,4 @@
+using BotSharp.Abstraction.Conversations.Dtos;
using System.Text.Json.Serialization;
namespace BotSharp.OpenAPI.ViewModels.Conversations;
@@ -5,7 +6,7 @@ namespace BotSharp.OpenAPI.ViewModels.Conversations;
public class UpdateMessageModel
{
[JsonPropertyName("message")]
- public ChatResponseModel Message { get; set; } = null!;
+ public ChatResponseDto Message { get; set; } = null!;
[JsonPropertyName("inner_index")]
public int InnerIndex { get; set; }
diff --git a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Response/ChatResponseModel.cs b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Response/ChatResponseModel.cs
index d2d7041f..4d149200 100644
--- a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Response/ChatResponseModel.cs
+++ b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/Response/ChatResponseModel.cs
@@ -1,40 +1,7 @@
-using BotSharp.Abstraction.Functions.Models;
-using BotSharp.Abstraction.Instructs.Models;
-using BotSharp.Abstraction.Messaging;
-using BotSharp.Abstraction.Messaging.Models.RichContent;
-using System.Text.Json.Serialization;
+using BotSharp.Abstraction.Conversations.Dtos;
namespace BotSharp.OpenAPI.ViewModels.Conversations;
-public class ChatResponseModel : InstructResult
+public class ChatResponseModel : ChatResponseDto
{
- [JsonPropertyName("conversation_id")]
- public string ConversationId { get; set; } = string.Empty;
-
- public UserViewModel Sender { get; set; } = new UserViewModel();
-
- public string? Function { get; set; }
-
- ///
- /// Planner instruction
- ///
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- public FunctionCallFromLlm? Instruction { get; set; }
-
- ///
- /// Rich message for UI rendering
- ///
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- [JsonPropertyName("rich_content")]
- public RichContent? RichContent { get; set; }
-
- [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
- [JsonPropertyName("payload")]
- public string? Payload { get; set; }
-
- [JsonPropertyName("has_message_files")]
- public bool HasMessageFiles { get; set; }
-
- [JsonPropertyName("created_at")]
- public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
diff --git a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/View/ConversationViewModel.cs b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/View/ConversationViewModel.cs
index 686974b9..6300f661 100644
--- a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/View/ConversationViewModel.cs
+++ b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Conversations/View/ConversationViewModel.cs
@@ -1,51 +1,15 @@
-using System.Text.Json.Serialization;
+using BotSharp.Abstraction.Conversations.Dtos;
namespace BotSharp.OpenAPI.ViewModels.Conversations;
-public class ConversationViewModel
+public class ConversationViewModel : ConversationDto
{
- public string Id { get; set; }
-
- [JsonPropertyName("agent_id")]
- public string AgentId { get; set; }
-
- [JsonPropertyName("agent_name")]
- public string AgentName { get; set; }
-
- [JsonPropertyName("title")]
- public string Title { get; set; } = string.Empty;
-
- [JsonPropertyName("title_alias")]
- public string TitleAlias { get; set; } = string.Empty;
-
- public UserViewModel User { get; set; } = new UserViewModel();
-
- public string Event { get; set; }
-
- public string Channel { get; set; } = ConversationChannel.OpenAPI;
-
- ///
- /// Agent task id
- ///
- [JsonPropertyName("task_id")]
- public string? TaskId { get; set; }
-
- public string Status { get; set; }
- public Dictionary States { get; set; } = [];
-
- public List Tags { get; set; } = new();
-
- [JsonPropertyName("updated_time")]
- public DateTime UpdatedTime { get; set; } = DateTime.UtcNow;
- [JsonPropertyName("created_time")]
- public DateTime CreatedTime { get; set; } = DateTime.UtcNow;
-
public static ConversationViewModel FromSession(Conversation sess)
{
return new ConversationViewModel
{
Id = sess.Id,
- User = new UserViewModel
+ User = new()
{
Id = sess.UserId
},
diff --git a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Users/View/UserViewModel.cs b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Users/View/UserViewModel.cs
index b3183bc9..38596795 100644
--- a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Users/View/UserViewModel.cs
+++ b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Users/View/UserViewModel.cs
@@ -1,43 +1,14 @@
+using BotSharp.Abstraction.Users.Dtos;
using BotSharp.Abstraction.Users.Enums;
using System.Text.Json.Serialization;
namespace BotSharp.OpenAPI.ViewModels.Users;
-public class UserViewModel
+public class UserViewModel : UserDto
{
- public string Id { get; set; } = string.Empty;
- [JsonPropertyName("user_name")]
- public string UserName { get; set; } = string.Empty;
- [JsonPropertyName("first_name")]
- public string FirstName { get; set; } = string.Empty;
- [JsonPropertyName("last_name")]
- public string? LastName { get; set; }
- public string? Email { get; set; }
- public string? Phone { get; set; }
- public string Type { get; set; } = UserType.Client;
- public string Role { get; set; } = UserRole.User;
-
- [JsonPropertyName("full_name")]
- public string FullName => $"{FirstName} {LastName}".Trim();
- public string? Source { get; set; }
-
- [JsonPropertyName("external_id")]
- public string? ExternalId { get; set; }
- public string Avatar { get; set; } = "/user/avatar";
-
- public IEnumerable Permissions { get; set; } = [];
-
[JsonPropertyName("agent_actions")]
public IEnumerable AgentActions { get; set; } = [];
- [JsonPropertyName("create_date")]
- public DateTime CreateDate { get; set; }
-
- [JsonPropertyName("update_date")]
- public DateTime UpdateDate { get; set; }
-
- public string RegionCode { get; set; } = "CN";
-
public static UserViewModel FromUser(User user)
{
if (user == null)
@@ -57,8 +28,6 @@ public class UserViewModel
UserName = user.UserName,
FirstName = user.FirstName,
LastName = user.LastName,
- //Email = Utilities.HideMiddleDigits(user.Email, true),
- //Phone = Utilities.HideMiddleDigits((!string.IsNullOrWhiteSpace(user.Phone) ? user.Phone.Replace("+86", String.Empty) : user.Phone)),
Email = user.Email,
Phone = !string.IsNullOrWhiteSpace(user.Phone) ? user.Phone.Replace("+86", String.Empty) : user.Phone,
Type = user.Type,
diff --git a/src/Plugins/BotSharp.Plugin.ChatHub/BotSharp.Plugin.ChatHub.csproj b/src/Plugins/BotSharp.Plugin.ChatHub/BotSharp.Plugin.ChatHub.csproj
index 1d3e6633..fd23c670 100644
--- a/src/Plugins/BotSharp.Plugin.ChatHub/BotSharp.Plugin.ChatHub.csproj
+++ b/src/Plugins/BotSharp.Plugin.ChatHub/BotSharp.Plugin.ChatHub.csproj
@@ -19,8 +19,6 @@
-
-
-
+
diff --git a/src/Plugins/BotSharp.Plugin.ChatHub/ChatHubPlugin.cs b/src/Plugins/BotSharp.Plugin.ChatHub/ChatHubPlugin.cs
index 41d1851b..7275a273 100644
--- a/src/Plugins/BotSharp.Plugin.ChatHub/ChatHubPlugin.cs
+++ b/src/Plugins/BotSharp.Plugin.ChatHub/ChatHubPlugin.cs
@@ -1,5 +1,4 @@
-using BotSharp.Abstraction.Interpreters.Settings;
-using BotSharp.Core.Crontab.Abstraction;
+using BotSharp.Abstraction.Crontab;
using BotSharp.Plugin.ChatHub.Hooks;
using Microsoft.Extensions.Configuration;
diff --git a/src/Plugins/BotSharp.Plugin.ChatHub/ChatStreamMiddleware.cs b/src/Plugins/BotSharp.Plugin.ChatHub/ChatStreamMiddleware.cs
index 990edcdf..b7d1b21a 100644
--- a/src/Plugins/BotSharp.Plugin.ChatHub/ChatStreamMiddleware.cs
+++ b/src/Plugins/BotSharp.Plugin.ChatHub/ChatStreamMiddleware.cs
@@ -1,3 +1,5 @@
+using BotSharp.Abstraction.Realtime.Models.Session;
+using BotSharp.Core.Session;
using Microsoft.AspNetCore.Http;
using System.Net.WebSockets;
diff --git a/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/ChatHubConversationHook.cs b/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/ChatHubConversationHook.cs
index c29f43db..a41abe87 100644
--- a/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/ChatHubConversationHook.cs
+++ b/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/ChatHubConversationHook.cs
@@ -1,4 +1,6 @@
+using BotSharp.Abstraction.Conversations.Dtos;
using BotSharp.Abstraction.SideCar;
+using BotSharp.Abstraction.Users.Dtos;
using Microsoft.AspNetCore.SignalR;
namespace BotSharp.Plugin.ChatHub.Hooks;
@@ -43,10 +45,10 @@ public class ChatHubConversationHook : ConversationHookBase
if (!AllowSendingMessage()) return;
var userService = _services.GetRequiredService();
- var conv = ConversationViewModel.FromSession(conversation);
+ var conv = ConversationDto.FromSession(conversation);
var user = await userService.GetUser(conv.User.Id);
- conv.User = UserViewModel.FromUser(user);
+ conv.User = UserDto.FromUser(user);
await InitClientConversation(conv.Id, conv);
await base.OnConversationInitialized(conversation);
@@ -61,13 +63,13 @@ public class ChatHubConversationHook : ConversationHookBase
var sender = await userService.GetMyProfile();
// Update console conversation UI for CSR
- var model = new ChatResponseModel()
+ var model = new ChatResponseDto()
{
ConversationId = conv.ConversationId,
MessageId = message.MessageId,
Payload = message.Payload,
Text = !string.IsNullOrEmpty(message.SecondaryContent) ? message.SecondaryContent : message.Content,
- Sender = UserViewModel.FromUser(sender)
+ Sender = UserDto.FromUser(sender)
};
await ReceiveClientMessage(conv.ConversationId, model);
@@ -107,7 +109,7 @@ public class ChatHubConversationHook : ConversationHookBase
var conv = _services.GetRequiredService();
var state = _services.GetRequiredService();
- var json = JsonSerializer.Serialize(new ChatResponseModel()
+ var json = JsonSerializer.Serialize(new ChatResponseDto()
{
ConversationId = conv.ConversationId,
MessageId = message.MessageId,
@@ -116,7 +118,7 @@ public class ChatHubConversationHook : ConversationHookBase
RichContent = message.SecondaryRichContent ?? message.RichContent,
Data = message.Data,
States = state.GetStates(),
- Sender = new UserViewModel()
+ Sender = new()
{
FirstName = "AI",
LastName = "Assistant",
@@ -140,7 +142,7 @@ public class ChatHubConversationHook : ConversationHookBase
public override async Task OnNotificationGenerated(RoleDialogModel message)
{
var conv = _services.GetRequiredService();
- var json = JsonSerializer.Serialize(new ChatResponseModel()
+ var json = JsonSerializer.Serialize(new ChatResponseDto()
{
ConversationId = conv.ConversationId,
MessageId = message.MessageId,
@@ -148,7 +150,7 @@ public class ChatHubConversationHook : ConversationHookBase
Function = message.FunctionName,
RichContent = message.SecondaryRichContent ?? message.RichContent,
Data = message.Data,
- Sender = new UserViewModel()
+ Sender = new()
{
FirstName = "AI",
LastName = "Assistant",
@@ -163,7 +165,7 @@ public class ChatHubConversationHook : ConversationHookBase
public override async Task OnMessageDeleted(string conversationId, string messageId)
{
- var model = new ChatResponseModel
+ var model = new ChatResponseDto
{
ConversationId = conversationId,
MessageId = messageId
@@ -180,7 +182,7 @@ public class ChatHubConversationHook : ConversationHookBase
return sidecar == null || !sidecar.IsEnabled();
}
- private async Task InitClientConversation(string conversationId, ConversationViewModel conversation)
+ private async Task InitClientConversation(string conversationId, ConversationDto conversation)
{
try
{
@@ -199,7 +201,7 @@ public class ChatHubConversationHook : ConversationHookBase
}
}
- private async Task ReceiveClientMessage(string conversationId, ChatResponseModel model)
+ private async Task ReceiveClientMessage(string conversationId, ChatResponseDto model)
{
try
{
@@ -257,7 +259,7 @@ public class ChatHubConversationHook : ConversationHookBase
}
}
- private async Task DeleteMessage(string conversationId, ChatResponseModel model)
+ private async Task DeleteMessage(string conversationId, ChatResponseDto model)
{
try
{
diff --git a/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/ChatHubCrontabHook.cs b/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/ChatHubCrontabHook.cs
index cad0189d..ef956670 100644
--- a/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/ChatHubCrontabHook.cs
+++ b/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/ChatHubCrontabHook.cs
@@ -1,5 +1,6 @@
+using BotSharp.Abstraction.Conversations.Dtos;
+using BotSharp.Abstraction.Crontab;
using BotSharp.Abstraction.Crontab.Models;
-using BotSharp.Core.Crontab.Abstraction;
using Microsoft.AspNetCore.SignalR;
namespace BotSharp.Plugin.ChatHub.Hooks;
@@ -34,13 +35,13 @@ public class ChatHubCrontabHook : ICrontabHook
public async Task OnCronTriggered(CrontabItem item)
{
- var json = JsonSerializer.Serialize(new ChatResponseModel()
+ var json = JsonSerializer.Serialize(new ChatResponseDto()
{
ConversationId = item.ConversationId,
MessageId = Guid.NewGuid().ToString(),
Text = item.ExecutionResult,
Function = "",
- Sender = new UserViewModel()
+ Sender = new()
{
FirstName = "Crontab",
LastName = "AI",
diff --git a/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/WelcomeHook.cs b/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/WelcomeHook.cs
index d664b99d..3ae8b313 100644
--- a/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/WelcomeHook.cs
+++ b/src/Plugins/BotSharp.Plugin.ChatHub/Hooks/WelcomeHook.cs
@@ -1,3 +1,4 @@
+using BotSharp.Abstraction.Conversations.Dtos;
using Microsoft.AspNetCore.SignalR;
namespace BotSharp.Plugin.ChatHub.Hooks;
@@ -63,13 +64,13 @@ public class WelcomeHook : ConversationHookBase
RichContent = richContent
};
- var json = JsonSerializer.Serialize(new ChatResponseModel()
+ var json = JsonSerializer.Serialize(new ChatResponseDto()
{
ConversationId = conversation.Id,
MessageId = dialog.MessageId,
Text = message.Text,
RichContent = richContent,
- Sender = new UserViewModel()
+ Sender = new()
{
FirstName = agent.Name,
LastName = "",
diff --git a/src/Plugins/BotSharp.Plugin.ChatHub/Using.cs b/src/Plugins/BotSharp.Plugin.ChatHub/Using.cs
index 8de5816b..4710509c 100644
--- a/src/Plugins/BotSharp.Plugin.ChatHub/Using.cs
+++ b/src/Plugins/BotSharp.Plugin.ChatHub/Using.cs
@@ -32,12 +32,6 @@ global using BotSharp.Abstraction.Messaging.Models.RichContent;
global using BotSharp.Abstraction.Templating;
global using BotSharp.Abstraction.Realtime;
global using BotSharp.Abstraction.Realtime.Models;
-global using BotSharp.OpenAPI.ViewModels.Conversations;
-global using BotSharp.OpenAPI.ViewModels.Users;
global using BotSharp.Plugin.ChatHub.Settings;
global using BotSharp.Plugin.ChatHub.Enums;
-global using BotSharp.Plugin.ChatHub.Models.Stream;
-
-global using BotSharp.Core.Realtime.Models.Chat;
-global using BotSharp.Core.Realtime.Models.Options;
-global using BotSharp.Core.Realtime.Websocket.Chat;
\ No newline at end of file
+global using BotSharp.Plugin.ChatHub.Models.Stream;
\ No newline at end of file
diff --git a/src/Plugins/BotSharp.Plugin.ChatbotUI/BotSharp.Plugin.ChatbotUI.csproj b/src/Plugins/BotSharp.Plugin.ChatbotUI/BotSharp.Plugin.ChatbotUI.csproj
index 63adc0b8..aa70f42e 100644
--- a/src/Plugins/BotSharp.Plugin.ChatbotUI/BotSharp.Plugin.ChatbotUI.csproj
+++ b/src/Plugins/BotSharp.Plugin.ChatbotUI/BotSharp.Plugin.ChatbotUI.csproj
@@ -13,7 +13,6 @@
-
diff --git a/src/Plugins/BotSharp.Plugin.GoogleAI/BotSharp.Plugin.GoogleAI.csproj b/src/Plugins/BotSharp.Plugin.GoogleAI/BotSharp.Plugin.GoogleAI.csproj
index efaec3a6..c4c28822 100644
--- a/src/Plugins/BotSharp.Plugin.GoogleAI/BotSharp.Plugin.GoogleAI.csproj
+++ b/src/Plugins/BotSharp.Plugin.GoogleAI/BotSharp.Plugin.GoogleAI.csproj
@@ -11,7 +11,6 @@
-
diff --git a/src/Plugins/BotSharp.Plugin.KnowledgeBase/BotSharp.Plugin.KnowledgeBase.csproj b/src/Plugins/BotSharp.Plugin.KnowledgeBase/BotSharp.Plugin.KnowledgeBase.csproj
index aad7d494..e15529d2 100644
--- a/src/Plugins/BotSharp.Plugin.KnowledgeBase/BotSharp.Plugin.KnowledgeBase.csproj
+++ b/src/Plugins/BotSharp.Plugin.KnowledgeBase/BotSharp.Plugin.KnowledgeBase.csproj
@@ -58,7 +58,6 @@
-
diff --git a/src/Plugins/BotSharp.Plugin.OpenAI/BotSharp.Plugin.OpenAI.csproj b/src/Plugins/BotSharp.Plugin.OpenAI/BotSharp.Plugin.OpenAI.csproj
index c1c3dfb5..2455e7b5 100644
--- a/src/Plugins/BotSharp.Plugin.OpenAI/BotSharp.Plugin.OpenAI.csproj
+++ b/src/Plugins/BotSharp.Plugin.OpenAI/BotSharp.Plugin.OpenAI.csproj
@@ -15,7 +15,7 @@
-
+
\ No newline at end of file
diff --git a/src/Plugins/BotSharp.Plugin.OpenAI/Providers/Realtime/RealTimeCompletionProvider.cs b/src/Plugins/BotSharp.Plugin.OpenAI/Providers/Realtime/RealTimeCompletionProvider.cs
index e183fd1b..b32c0e1c 100644
--- a/src/Plugins/BotSharp.Plugin.OpenAI/Providers/Realtime/RealTimeCompletionProvider.cs
+++ b/src/Plugins/BotSharp.Plugin.OpenAI/Providers/Realtime/RealTimeCompletionProvider.cs
@@ -11,7 +11,6 @@ public class RealTimeCompletionProvider : IRealTimeCompletion
public string Provider => "openai";
public string Model => _model;
- private readonly RealtimeModelSettings _settings;
private readonly IServiceProvider _services;
private readonly ILogger _logger;
private readonly BotSharpOptions _botsharpOptions;
@@ -20,12 +19,10 @@ public class RealTimeCompletionProvider : IRealTimeCompletion
private LlmRealtimeSession _session;
public RealTimeCompletionProvider(
- RealtimeModelSettings settings,
- ILogger logger,
IServiceProvider services,
+ ILogger logger,
BotSharpOptions botsharpOptions)
{
- _settings = settings;
_logger = logger;
_services = services;
_botsharpOptions = botsharpOptions;
@@ -290,26 +287,27 @@ public class RealTimeCompletionProvider : IRealTimeCompletion
return fn;
}).ToArray();
+ var realtimeModelSettings = _services.GetRequiredService();
var sessionUpdate = new
{
type = "session.update",
session = new RealtimeSessionUpdateRequest
{
- InputAudioFormat = _settings.InputAudioFormat,
- OutputAudioFormat = _settings.OutputAudioFormat,
- Voice = _settings.Voice,
+ InputAudioFormat = realtimeModelSettings.InputAudioFormat,
+ OutputAudioFormat = realtimeModelSettings.OutputAudioFormat,
+ Voice = realtimeModelSettings.Voice,
Instructions = instruction,
ToolChoice = "auto",
Tools = functions,
- Modalities = _settings.Modalities,
- Temperature = Math.Max(options.Temperature ?? _settings.Temperature, 0.6f),
- MaxResponseOutputTokens = _settings.MaxResponseOutputTokens,
+ Modalities = realtimeModelSettings.Modalities,
+ Temperature = Math.Max(options.Temperature ?? realtimeModelSettings.Temperature, 0.6f),
+ MaxResponseOutputTokens = realtimeModelSettings.MaxResponseOutputTokens,
TurnDetection = new RealtimeSessionTurnDetection
{
- InterruptResponse = _settings.InterruptResponse/*,
- Threshold = _settings.TurnDetection.Threshold,
- PrefixPadding = _settings.TurnDetection.PrefixPadding,
- SilenceDuration = _settings.TurnDetection.SilenceDuration*/
+ InterruptResponse = realtimeModelSettings.InterruptResponse/*,
+ Threshold = realtimeModelSettings.TurnDetection.Threshold,
+ PrefixPadding = realtimeModelSettings.TurnDetection.PrefixPadding,
+ SilenceDuration = realtimeModelSettings.TurnDetection.SilenceDuration*/
},
InputAudioNoiseReduction = new InputAudioNoiseReduction
{
@@ -318,15 +316,15 @@ public class RealTimeCompletionProvider : IRealTimeCompletion
}
};
- if (_settings.InputAudioTranscribe)
+ if (realtimeModelSettings.InputAudioTranscribe)
{
var words = new List();
HookEmitter.Emit(_services, hook => words.AddRange(hook.OnModelTranscriptPrompt(agent)));
sessionUpdate.session.InputAudioTranscription = new InputAudioTranscription
{
- Model = _settings.InputAudioTranscription.Model,
- Language = _settings.InputAudioTranscription.Language,
+ Model = realtimeModelSettings.InputAudioTranscription.Model,
+ Language = realtimeModelSettings.InputAudioTranscription.Language,
Prompt = string.Join(", ", words.Select(x => x.ToLower().Trim()).Distinct()).SubstringMax(1024)
};
}
diff --git a/src/Plugins/BotSharp.Plugin.OpenAI/Using.cs b/src/Plugins/BotSharp.Plugin.OpenAI/Using.cs
index 11aa2608..b8c75d29 100644
--- a/src/Plugins/BotSharp.Plugin.OpenAI/Using.cs
+++ b/src/Plugins/BotSharp.Plugin.OpenAI/Using.cs
@@ -29,10 +29,8 @@ global using BotSharp.Abstraction.MLTasks.Settings;
global using BotSharp.Abstraction.Options;
global using BotSharp.Abstraction.Realtime;
global using BotSharp.Abstraction.Realtime.Models;
+global using BotSharp.Abstraction.Realtime.Models.Session;
global using BotSharp.Core.Infrastructures;
+global using BotSharp.Core.Session;
global using BotSharp.Plugin.OpenAI.Models;
-global using BotSharp.Plugin.OpenAI.Settings;
-
-global using BotSharp.Core.Realtime.Models.Chat;
-global using BotSharp.Core.Realtime.Models.Options;
-global using BotSharp.Core.Realtime.Websocket.Llm;
\ No newline at end of file
+global using BotSharp.Plugin.OpenAI.Settings;
\ No newline at end of file
diff --git a/src/Plugins/BotSharp.Plugin.SqlDriver/BotSharp.Plugin.SqlDriver.csproj b/src/Plugins/BotSharp.Plugin.SqlDriver/BotSharp.Plugin.SqlDriver.csproj
index d7626c47..4af2df49 100644
--- a/src/Plugins/BotSharp.Plugin.SqlDriver/BotSharp.Plugin.SqlDriver.csproj
+++ b/src/Plugins/BotSharp.Plugin.SqlDriver/BotSharp.Plugin.SqlDriver.csproj
@@ -105,8 +105,6 @@
-
-
diff --git a/src/Plugins/BotSharp.Plugin.SqlDriver/Hooks/SqlDriverCrontabHook.cs b/src/Plugins/BotSharp.Plugin.SqlDriver/Hooks/SqlDriverCrontabHook.cs
index c813faae..d76d8610 100644
--- a/src/Plugins/BotSharp.Plugin.SqlDriver/Hooks/SqlDriverCrontabHook.cs
+++ b/src/Plugins/BotSharp.Plugin.SqlDriver/Hooks/SqlDriverCrontabHook.cs
@@ -1,7 +1,7 @@
+using BotSharp.Abstraction.Crontab;
using BotSharp.Abstraction.Crontab.Models;
using BotSharp.Abstraction.Models;
using BotSharp.Abstraction.SideCar;
-using BotSharp.Core.Crontab.Abstraction;
namespace BotSharp.Plugin.SqlDriver.Hooks;
diff --git a/src/Plugins/BotSharp.Plugin.SqlDriver/SqlDriverPlugin.cs b/src/Plugins/BotSharp.Plugin.SqlDriver/SqlDriverPlugin.cs
index d6fe125b..95a6e280 100644
--- a/src/Plugins/BotSharp.Plugin.SqlDriver/SqlDriverPlugin.cs
+++ b/src/Plugins/BotSharp.Plugin.SqlDriver/SqlDriverPlugin.cs
@@ -1,5 +1,5 @@
+using BotSharp.Abstraction.Crontab;
using BotSharp.Abstraction.Planning;
-using BotSharp.Core.Crontab.Abstraction;
namespace BotSharp.Plugin.SqlDriver;
diff --git a/src/Plugins/BotSharp.Plugin.SqlDriver/Using.cs b/src/Plugins/BotSharp.Plugin.SqlDriver/Using.cs
index 865022e5..79cae016 100644
--- a/src/Plugins/BotSharp.Plugin.SqlDriver/Using.cs
+++ b/src/Plugins/BotSharp.Plugin.SqlDriver/Using.cs
@@ -6,27 +6,29 @@ global using System.Text.RegularExpressions;
global using System.Threading.Tasks;
global using System.Linq;
global using System.Text.Json;
+global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.Logging;
+
global using BotSharp.Abstraction.Conversations;
global using BotSharp.Abstraction.Plugins;
global using BotSharp.Abstraction.Conversations.Models;
-global using BotSharp.Plugin.SqlDriver.Models;
global using BotSharp.Abstraction.Functions;
global using BotSharp.Abstraction.Agents.Models;
global using BotSharp.Abstraction.Templating;
-global using Microsoft.Extensions.DependencyInjection;
global using BotSharp.Abstraction.Agents;
global using BotSharp.Abstraction.Utilities;
global using BotSharp.Abstraction.Knowledges;
global using BotSharp.Abstraction.Knowledges.Models;
global using BotSharp.Abstraction.Settings;
-global using BotSharp.Plugin.SqlDriver.Hooks;
-global using BotSharp.Plugin.SqlDriver.Services;
global using BotSharp.Abstraction.Agents.Enums;
global using BotSharp.Abstraction.Instructs;
global using BotSharp.Abstraction.Instructs.Models;
global using BotSharp.Abstraction.Routing;
+
+global using BotSharp.Plugin.SqlDriver.Models;
+global using BotSharp.Plugin.SqlDriver.Hooks;
+global using BotSharp.Plugin.SqlDriver.Services;
global using BotSharp.Plugin.SqlDriver.Interfaces;
global using BotSharp.Plugin.SqlDriver.Helpers;
global using BotSharp.Plugin.SqlDriver.Settings;
diff --git a/src/Plugins/BotSharp.Plugin.Twilio/BotSharp.Plugin.Twilio.csproj b/src/Plugins/BotSharp.Plugin.Twilio/BotSharp.Plugin.Twilio.csproj
index 775a9384..e4c72b0c 100644
--- a/src/Plugins/BotSharp.Plugin.Twilio/BotSharp.Plugin.Twilio.csproj
+++ b/src/Plugins/BotSharp.Plugin.Twilio/BotSharp.Plugin.Twilio.csproj
@@ -42,7 +42,6 @@
-
diff --git a/src/WebStarter/WebStarter.csproj b/src/WebStarter/WebStarter.csproj
index 6020f043..d27a693b 100644
--- a/src/WebStarter/WebStarter.csproj
+++ b/src/WebStarter/WebStarter.csproj
@@ -44,7 +44,6 @@
-
diff --git a/tests/BotSharp.LLM.Tests/BotSharp.LLM.Tests.csproj b/tests/BotSharp.LLM.Tests/BotSharp.LLM.Tests.csproj
index b295b733..e4784483 100644
--- a/tests/BotSharp.LLM.Tests/BotSharp.LLM.Tests.csproj
+++ b/tests/BotSharp.LLM.Tests/BotSharp.LLM.Tests.csproj
@@ -13,15 +13,14 @@
-
+
-
+
-