From 8fa683af8bbcf722640c000e05ff1412e1894213 Mon Sep 17 00:00:00 2001
From: Jicheng Lu <103353@smsassist.com>
Date: Wed, 15 Oct 2025 14:22:18 -0500
Subject: [PATCH] refine
---
.../Files/Options/FileLlmProcessOptions.cs | 10 ++++++++++
.../{Models => Filters}/KnowledgeFileFilter.cs | 2 +-
.../Knowledges/IKnowledgeService.cs | 1 +
.../Repositories/IBotSharpRepository.cs | 1 +
.../Instructs/Services/InstructService.Execute.cs | 2 ++
.../FileRepository/FileRepository.KnowledgeBase.cs | 1 +
.../Knowledges/Request/GetKnowledgeDocsRequest.cs | 2 ++
.../Services/KnowledgeService.Document.cs | 1 +
.../Repository/MongoRepository.KnowledgeBase.cs | 1 +
9 files changed, 20 insertions(+), 1 deletion(-)
rename src/Infrastructure/BotSharp.Abstraction/Knowledges/{Models => Filters}/KnowledgeFileFilter.cs (86%)
diff --git a/src/Infrastructure/BotSharp.Abstraction/Files/Options/FileLlmProcessOptions.cs b/src/Infrastructure/BotSharp.Abstraction/Files/Options/FileLlmProcessOptions.cs
index f38bd772..eafae504 100644
--- a/src/Infrastructure/BotSharp.Abstraction/Files/Options/FileLlmProcessOptions.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/Files/Options/FileLlmProcessOptions.cs
@@ -27,11 +27,21 @@ public class FileLlmProcessOptions
///
public string? Instruction { get; set; }
+ ///
+ /// Message from user
+ ///
+ public string? UserMessage { get; set; }
+
///
/// Template name in Agent
///
public string? TemplateName { get; set; }
+ ///
+ /// The upstream where the file llm is invoked
+ ///
+ public string? InvokeFrom { get; set; }
+
///
/// Data that is used to render instruction
///
diff --git a/src/Infrastructure/BotSharp.Abstraction/Knowledges/Models/KnowledgeFileFilter.cs b/src/Infrastructure/BotSharp.Abstraction/Knowledges/Filters/KnowledgeFileFilter.cs
similarity index 86%
rename from src/Infrastructure/BotSharp.Abstraction/Knowledges/Models/KnowledgeFileFilter.cs
rename to src/Infrastructure/BotSharp.Abstraction/Knowledges/Filters/KnowledgeFileFilter.cs
index d275cf34..ec250418 100644
--- a/src/Infrastructure/BotSharp.Abstraction/Knowledges/Models/KnowledgeFileFilter.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/Knowledges/Filters/KnowledgeFileFilter.cs
@@ -1,4 +1,4 @@
-namespace BotSharp.Abstraction.Knowledges.Models;
+namespace BotSharp.Abstraction.Knowledges.Filters;
public class KnowledgeFileFilter : Pagination
{
diff --git a/src/Infrastructure/BotSharp.Abstraction/Knowledges/IKnowledgeService.cs b/src/Infrastructure/BotSharp.Abstraction/Knowledges/IKnowledgeService.cs
index 6f3efff1..767615fe 100644
--- a/src/Infrastructure/BotSharp.Abstraction/Knowledges/IKnowledgeService.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/Knowledges/IKnowledgeService.cs
@@ -1,5 +1,6 @@
using BotSharp.Abstraction.Graph.Models;
using BotSharp.Abstraction.Graph.Options;
+using BotSharp.Abstraction.Knowledges.Filters;
using BotSharp.Abstraction.Knowledges.Options;
using BotSharp.Abstraction.Knowledges.Responses;
using BotSharp.Abstraction.VectorStorage.Models;
diff --git a/src/Infrastructure/BotSharp.Abstraction/Repositories/IBotSharpRepository.cs b/src/Infrastructure/BotSharp.Abstraction/Repositories/IBotSharpRepository.cs
index 67dce572..2b1f5922 100644
--- a/src/Infrastructure/BotSharp.Abstraction/Repositories/IBotSharpRepository.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/Repositories/IBotSharpRepository.cs
@@ -1,3 +1,4 @@
+using BotSharp.Abstraction.Knowledges.Filters;
using BotSharp.Abstraction.Loggers.Models;
using BotSharp.Abstraction.Plugins.Models;
using BotSharp.Abstraction.Repositories.Filters;
diff --git a/src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs b/src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs
index 0a70b8d8..267f4633 100644
--- a/src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs
+++ b/src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs
@@ -119,7 +119,9 @@ public partial class InstructService
Provider = provider,
Model = model,
Instruction = instruction,
+ UserMessage = message.Content,
TemplateName = templateName,
+ InvokeFrom = $"{nameof(InstructService)}.{nameof(Execute)}",
Data = state.GetStates().ToDictionary(x => x.Key, x => (object)x.Value)
});
result = inference.Result.IfNullOrEmptyAs(string.Empty);
diff --git a/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.KnowledgeBase.cs b/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.KnowledgeBase.cs
index e8cd0d15..f245477f 100644
--- a/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.KnowledgeBase.cs
+++ b/src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.KnowledgeBase.cs
@@ -1,3 +1,4 @@
+using BotSharp.Abstraction.Knowledges.Filters;
using BotSharp.Abstraction.VectorStorage.Filters;
using BotSharp.Abstraction.VectorStorage.Models;
using System.IO;
diff --git a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Knowledges/Request/GetKnowledgeDocsRequest.cs b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Knowledges/Request/GetKnowledgeDocsRequest.cs
index 40ffe3cb..52022b70 100644
--- a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Knowledges/Request/GetKnowledgeDocsRequest.cs
+++ b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Knowledges/Request/GetKnowledgeDocsRequest.cs
@@ -1,3 +1,5 @@
+using BotSharp.Abstraction.Knowledges.Filters;
+
namespace BotSharp.OpenAPI.ViewModels.Knowledges;
public class GetKnowledgeDocsRequest : KnowledgeFileFilter
diff --git a/src/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.Document.cs b/src/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.Document.cs
index 83da4218..20787931 100644
--- a/src/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.Document.cs
+++ b/src/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.Document.cs
@@ -1,6 +1,7 @@
using BotSharp.Abstraction.Files;
using BotSharp.Abstraction.Files.Models;
using BotSharp.Abstraction.Files.Utilities;
+using BotSharp.Abstraction.Knowledges.Filters;
using BotSharp.Abstraction.Knowledges.Helpers;
using BotSharp.Abstraction.Knowledges.Options;
using BotSharp.Abstraction.Knowledges.Responses;
diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.KnowledgeBase.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.KnowledgeBase.cs
index bce5a86e..73496839 100644
--- a/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.KnowledgeBase.cs
+++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.KnowledgeBase.cs
@@ -1,3 +1,4 @@
+using BotSharp.Abstraction.Knowledges.Filters;
using BotSharp.Abstraction.Knowledges.Models;
using BotSharp.Abstraction.VectorStorage.Filters;
using BotSharp.Abstraction.VectorStorage.Models;