Skip to content

Commit aa4440a

Browse files
authored
Merge pull request #1034 from iceljc/test/realtime-chat
Test/realtime chat
2 parents 2ca7cf2 + 9debbf7 commit aa4440a

File tree

89 files changed

+1232
-416
lines changed

Some content is hidden

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

89 files changed

+1232
-416
lines changed

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
2222
<PackageVersion Include="SharpHook" Version="5.3.9" />
2323
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.7" />
24+
<PackageVersion Include="System.ClientModel" Version="1.3.0" />
2425
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
2526
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.0.0" />
2627
<PackageVersion Include="System.Memory.Data" Version="8.0.0" />

src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public class Agent
8282
public PluginDef Plugin { get; set; }
8383

8484
[JsonIgnore]
85-
public bool Installed => Plugin.Enabled;
85+
public bool Installed => Plugin?.Enabled == true;
8686

8787
/// <summary>
8888
/// Default is True, user will enable this by installing appropriate plugin.
@@ -168,6 +168,7 @@ public static Agent Clone(Agent agent)
168168
Functions = agent.Functions,
169169
Responses = agent.Responses,
170170
Samples = agent.Samples,
171+
Templates = agent.Templates,
171172
Utilities = agent.Utilities,
172173
McpTools = agent.McpTools,
173174
Knowledges = agent.Knowledges,

src/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentTemplate.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ public class AgentTemplate
77

88
public AgentTemplate()
99
{
10-
1110
}
1211

1312
public AgentTemplate(string name, string content)

src/Infrastructure/BotSharp.Abstraction/Knowledges/IKnowledgeService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public interface IKnowledgeService
1010
Task<bool> CreateVectorCollection(string collectionName, string collectionType, int dimension, string provider, string model);
1111
Task<bool> DeleteVectorCollection(string collectionName);
1212
Task<IEnumerable<VectorCollectionConfig>> GetVectorCollections(string? type = null);
13+
Task<VectorCollectionDetails?> GetVectorCollectionDetails(string collectionName);
1314
Task<IEnumerable<VectorSearchResult>> SearchVectorKnowledge(string query, string collectionName, VectorSearchOptions options);
1415
Task<StringIdPagedItems<VectorSearchResult>> GetPagedVectorCollectionData(string collectionName, VectorFilter filter);
1516
Task<bool> DeleteVectorCollectionData(string collectionName, string id);

src/Infrastructure/BotSharp.Abstraction/Loggers/IContentGeneratingHook.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ public interface IContentGeneratingHook
4747
/// <param name="instruction"></param>
4848
/// <param name="functions"></param>
4949
/// <returns></returns>
50-
Task OnSessionUpdated(Agent agent, string instruction, FunctionDef[] functions) => Task.CompletedTask;
50+
Task OnSessionUpdated(Agent agent, string instruction, FunctionDef[] functions, bool isInit = false) => Task.CompletedTask;
5151
}

src/Infrastructure/BotSharp.Abstraction/MLTasks/IRealTimeCompletion.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ public interface IRealTimeCompletion
88
string Model { get; }
99
void SetModelName(string model);
1010

11-
Task Connect(RealtimeHubConnection conn,
11+
Task Connect(
12+
RealtimeHubConnection conn,
1213
Action onModelReady,
1314
Action<string, string> onModelAudioDeltaReceived,
1415
Action onModelAudioResponseDone,
@@ -23,7 +24,7 @@ Task Connect(RealtimeHubConnection conn,
2324
Task SendEventToModel(object message);
2425
Task Disconnect();
2526

26-
Task<string> UpdateSession(RealtimeHubConnection conn);
27+
Task<string> UpdateSession(RealtimeHubConnection conn, bool isInit = false);
2728
Task InsertConversationItem(RoleDialogModel message);
2829
Task RemoveConversationItem(string itemId);
2930
Task TriggerModelInference(string? instructions = null);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace BotSharp.Abstraction.Templating.Constants;
2+
3+
public static class TemplateRenderConstant
4+
{
5+
public const string RENDER_AGENT = "render_agent";
6+
}

src/Infrastructure/BotSharp.Abstraction/Templating/ITemplateRender.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ namespace BotSharp.Abstraction.Templating;
33
public interface ITemplateRender
44
{
55
string Render(string template, Dictionary<string, object> dict);
6-
void Register(Type type);
6+
void RegisterType(Type type);
77
}

src/Infrastructure/BotSharp.Abstraction/VectorStorage/IVectorDb.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Task<bool> DoesCollectionExist(string collectionName)
1010
=> throw new NotImplementedException();
1111
Task<IEnumerable<string>> GetCollections()
1212
=> throw new NotImplementedException();
13+
Task<VectorCollectionDetails?> GetCollectionDetails(string collectionName)
14+
=> throw new NotImplementedException();
1315
Task<StringIdPagedItems<VectorCollectionData>> GetPagedCollectionData(string collectionName, VectorFilter filter)
1416
=> throw new NotImplementedException();
1517
Task<IEnumerable<VectorCollectionData>> GetCollectionData(string collectionName, IEnumerable<Guid> ids,
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
namespace BotSharp.Abstraction.VectorStorage.Models;
2+
3+
public class VectorCollectionDetails
4+
{
5+
[JsonPropertyName("status")]
6+
public string Status { get; set; }
7+
8+
[JsonPropertyName("optimizer_status")]
9+
public string OptimizerStatus { get; set; }
10+
11+
[JsonPropertyName("segments_count")]
12+
public ulong SegmentsCount { get; set; }
13+
14+
[JsonPropertyName("vectors_count")]
15+
public ulong VectorsCount { get; set; }
16+
17+
[JsonPropertyName("indexed_vectors_count")]
18+
public ulong IndexedVectorsCount { get; set; }
19+
20+
[JsonPropertyName("points_count")]
21+
public ulong PointsCount { get; set; }
22+
23+
[JsonPropertyName("inner_config")]
24+
public VectorCollectionDetailConfig? InnerConfig { get; set; }
25+
26+
[JsonPropertyName("basic_info")]
27+
public VectorCollectionConfig? BasicInfo { get; set; }
28+
}
29+
30+
public class VectorCollectionDetailConfig
31+
{
32+
public VectorCollectionDetailConfigParam? Param { get; set; }
33+
}
34+
35+
public class VectorCollectionDetailConfigParam
36+
{
37+
[JsonPropertyName("shard_number")]
38+
public uint? ShardNumber { get; set; }
39+
40+
[JsonPropertyName("sharding_method")]
41+
public string? ShardingMethod { get; set; }
42+
43+
[JsonPropertyName("replication_factor")]
44+
public uint? ReplicationFactor { get; set; }
45+
46+
[JsonPropertyName("write_consistency_factor")]
47+
public uint? WriteConsistencyFactor { get; set; }
48+
49+
[JsonPropertyName("read_fan_out_factor")]
50+
public uint? ReadFanOutFactor { get; set; }
51+
}

0 commit comments

Comments
 (0)