diff --git a/Documents/Markdown/tmp.html b/Documents/Markdown/tmp.html new file mode 100644 index 0000000..6ef8373 --- /dev/null +++ b/Documents/Markdown/tmp.html @@ -0,0 +1,394 @@ + + +
+طرح نهایی با انتخاب شما (SessionId بهصورت Guid که از Ingest برمیگردد و در Ask ارسال میشود) تثبیت میشود.
فایلهای جدید
+xAiApi\Interfaces\IXTextChunker.cs و xAiApi\Providers\XTextChunker.cs — تکهبندی متن (ChunkSize/Overlap، Identifier = {fileName}#{index}).xAiApi\Interfaces\IXInMemoryVectorStore.cs و xAiApi\Providers\XInMemoryVectorStore.cs — Singleton، ConcurrentDictionary<Guid, XAiDocumentSession>، جستجو با VectorHelper.CosineSimilarity، Sliding TTL و پاکسازی دورهای، بررسی OwnerId.xAiApi\Models\XAiDocumentSession.cs, XAiDocumentIngestResult.cs, XAiDocumentAskRequest.cs, XAiDocumentAnswer.cs.فایلهای تغییریافته
+xAiApi\Interfaces\IXAiServiceBase.cs + xAiApi\Providers\XAIServiceBase.cs — افزودن AskWithContextAsync و AskWithContextAsEnumerable (بدون نوشتن در DB؛ History = Introduction + ChatWithDocuments-Prompt با Context + User prompt).xAiApi\Controllers\ChatWithDocumentsController.cs — حذف vectorStore محلی و using Microsoft.AspNetCore.Components؛ Endpointها: POST Ingest, POST Ask, POST AskStream (SSE), GET Session/{id}, DELETE Session/{id}.xAiApi\Constants\XAiApiConstants.cs — ثوابت پرامپت و پیشفرضها (ChunkSize 800، Overlap 150، TopK 5، MinScore 0.35، TTL 30 دقیقه).xAiApi\DI\XDIHelperExtension.cs + xAiApi\Startup.cs:194 — متد AddXAiChatWithDocuments() برای ثبت Singletonها.xAiApi\appsettings*.json — پرامپت ChatWithDocuments.جریان اجرا
+Ingest: فایلها → ExtractRichAsync → Chunk → Embeddings(batch) → XAiVectorDto با Metadata (fileName, mimeType, chunkIndex) → ذخیره در Session → بازگشت SessionId + آمار.Ask: Embedding(prompt) → Search(sessionId, topK, minScore) → اگر نتیجه نبود، پاسخ با پرچم NoContextFound → در غیر این صورت aiService.AskWithContextAsync → XAiDocumentAnswer { Answer, Sources }.Dispose/TTL/DELETE Session: تخلیه کامل حافظه؛ هیچ دادهای در AiVectors یا دیسک نوشته نمیشود.اعتبارسنجی: dotnet build xAiApi، تست دستی Ingest→Ask با PDF، و در صورت امکان یونیتتست برای XTextChunker و XInMemoryVectorStore.Search در xFrameworkTest.
اگر این طرح مورد تأیید است، لطفاً به Act mode سوئیچ کنید (toggle to Act mode) تا پیادهسازی را شروع کنم.
+ + + diff --git a/Documents/Markdown/tmp.md b/Documents/Markdown/tmp.md new file mode 100644 index 0000000..e2fe2ce --- /dev/null +++ b/Documents/Markdown/tmp.md @@ -0,0 +1,24 @@ +طرح نهایی با انتخاب شما (SessionId بهصورت Guid که از `Ingest` برمیگردد و در `Ask` ارسال میشود) تثبیت میشود. + +## خلاصه نهایی طرح + +**فایلهای جدید** +- `xAiApi\Interfaces\IXTextChunker.cs` و `xAiApi\Providers\XTextChunker.cs` — تکهبندی متن (ChunkSize/Overlap، Identifier = `{fileName}#{index}`). +- `xAiApi\Interfaces\IXInMemoryVectorStore.cs` و `xAiApi\Providers\XInMemoryVectorStore.cs` — Singleton، `ConcurrentDictionary