Skip to content

Commit 63fb864

Browse files
authored
Merge pull request #663 from Qtoss-AI/master
return not found if no records.
2 parents 8e0eb63 + 89205bd commit 63fb864

File tree

31 files changed

+244
-66
lines changed

31 files changed

+244
-66
lines changed

src/Infrastructure/BotSharp.Abstraction/Browsing/Models/BrowserActionResult.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace BotSharp.Abstraction.Browsing.Models;
22

33
public class BrowserActionResult
44
{
5+
public int ResponseStatusCode { get; set; }
56
public bool IsSuccess { get; set; }
67
public string? Message { get; set; }
78
public string? StackTrace { get; set; }

src/Infrastructure/BotSharp.Abstraction/Infrastructures/ICacheService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ public interface ICacheService
55
Task<T?> GetAsync<T>(string key);
66
Task<object> GetAsync(string key, Type type);
77
Task SetAsync<T>(string key, T value, TimeSpan? expiry);
8+
Task RemoveAsync(string key);
89
}

src/Infrastructure/BotSharp.Abstraction/Infrastructures/SharpCacheAttribute.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ public override void OnEntry(MethodContext context)
3131
var value = cache.GetAsync(key, context.TaskReturnType).Result;
3232
if (value != null)
3333
{
34-
context.ReplaceReturnValue(this, value);
34+
// check if the cache is out of date
35+
var isOutOfDate = IsOutOfDate(context, value).Result;
36+
37+
if (!isOutOfDate)
38+
{
39+
context.ReplaceReturnValue(this, value);
40+
}
3541
}
3642
}
3743

@@ -58,6 +64,11 @@ public override void OnSuccess(MethodContext context)
5864
}
5965
}
6066

67+
public virtual Task<bool> IsOutOfDate(MethodContext context, object value)
68+
{
69+
return Task.FromResult(false);
70+
}
71+
6172
private string GetCacheKey(SharpCacheSettings settings, MethodContext context)
6273
{
6374
var key = settings.Prefix + "-" + context.Method.Name;

src/Infrastructure/BotSharp.Abstraction/Repositories/IBotSharpRepository.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,26 @@ public interface IBotSharpRepository
1414
void Add<TTableInterface>(object entity);
1515

1616
#region Plugin
17-
PluginConfig GetPluginConfig();
17+
PluginConfig GetPluginConfig();
1818
void SavePluginConfig(PluginConfig config);
1919
#endregion
2020

2121
#region User
2222
User? GetUserByEmail(string email) => throw new NotImplementedException();
2323
User? GetUserByPhone(string phone) => throw new NotImplementedException();
2424
User? GetAffiliateUserByPhone(string phone) => throw new NotImplementedException();
25-
User? GetUserById(string id) => throw new NotImplementedException();
25+
User? GetUserById(string id) => throw new NotImplementedException();
2626
List<User> GetUserByIds(List<string> ids) => throw new NotImplementedException();
2727
User? GetUserByAffiliateId(string affiliateId) => throw new NotImplementedException();
2828
User? GetUserByUserName(string userName) => throw new NotImplementedException();
2929
void CreateUser(User user) => throw new NotImplementedException();
3030
void UpdateUserVerified(string userId) => throw new NotImplementedException();
3131
void UpdateUserVerificationCode(string userId, string verficationCode) => throw new NotImplementedException();
3232
void UpdateUserPassword(string userId, string password) => throw new NotImplementedException();
33-
void UpdateUserEmail(string userId, string email)=> throw new NotImplementedException();
33+
void UpdateUserEmail(string userId, string email) => throw new NotImplementedException();
3434
void UpdateUserPhone(string userId, string Iphone) => throw new NotImplementedException();
3535
void UpdateUserIsDisable(string userId, bool isDisable) => throw new NotImplementedException();
36+
void UpdateUsersIsDisable(List<string> userIds, bool isDisable) => throw new NotImplementedException();
3637
#endregion
3738

3839
#region Agent
@@ -76,7 +77,7 @@ public interface IBotSharpRepository
7677
List<string> GetIdleConversations(int batchSize, int messageLimit, int bufferHours, IEnumerable<string> excludeAgentIds);
7778
IEnumerable<string> TruncateConversation(string conversationId, string messageId, bool cleanLog = false);
7879
#endregion
79-
80+
8081
#region Execution Log
8182
void AddExecutionLogs(string conversationId, List<string> logs);
8283
List<string> GetExecutionLogs(string conversationId);

src/Infrastructure/BotSharp.Abstraction/Users/IAuthenticationHook.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ public interface IAuthenticationHook
1010
void BeforeSending(Token token);
1111
Task UserCreated(User user);
1212
Task VerificationCodeResetPassword(User user);
13+
Task DelUsers(List<string> userIds);
1314
}

src/Infrastructure/BotSharp.Abstraction/Users/IUserIdentity.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ public interface IUserIdentity
1010
string FullName { get; }
1111
string? UserLanguage { get; }
1212
string? Phone { get; }
13+
string? AffiliateId { get; }
1314
}

src/Infrastructure/BotSharp.Abstraction/Users/IUserService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ public interface IUserService
1919
Task<bool> ModifyUserPhone(string phone);
2020
Task<bool> UpdatePassword(string newPassword, string verificationCode);
2121
Task<DateTime> GetUserTokenExpires();
22+
Task<bool> UpdateUsersIsDisable(List<string> userIds, bool isDisable);
2223
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public interface IVectorDb
1212
Task<IEnumerable<VectorCollectionData>> GetCollectionData(string collectionName, IEnumerable<Guid> ids, bool withPayload = false, bool withVector = false);
1313
Task<bool> CreateCollection(string collectionName, int dimension);
1414
Task<bool> DeleteCollection(string collectionName);
15-
Task<bool> Upsert(string collectionName, Guid id, float[] vector, string text, Dictionary<string, string>? payload = null);
15+
Task<bool> Upsert(string collectionName, Guid id, float[] vector, string text, Dictionary<string, object>? payload = null);
1616
Task<IEnumerable<VectorCollectionData>> Search(string collectionName, float[] vector, IEnumerable<string>? fields, int limit = 5, float confidence = 0.5f, bool withVector = false);
1717
Task<bool> DeleteCollectionData(string collectionName, List<Guid> ids);
1818
Task<bool> DeleteCollectionAllData(string collectionName);

src/Infrastructure/BotSharp.Abstraction/VectorStorage/Models/VectorCollectionData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace BotSharp.Abstraction.VectorStorage.Models;
33
public class VectorCollectionData
44
{
55
public string Id { get; set; }
6-
public Dictionary<string, string> Data { get; set; } = new();
6+
public Dictionary<string, object> Data { get; set; } = new();
77
public double? Score { get; set; }
88

99
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]

src/Infrastructure/BotSharp.Abstraction/VectorStorage/Models/VectorCreateModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ public class VectorCreateModel
66
{
77
public string Text { get; set; }
88
public string DataSource { get; set; } = VectorDataSource.Api;
9-
public Dictionary<string, string>? Payload { get; set; }
9+
public Dictionary<string, object>? Payload { get; set; }
1010
}

0 commit comments

Comments
 (0)