Implement RAG Scopes, Remove ProxyController, Fix Pipeline Order and SSE Format
- RAG: real scopes with identifiers conversation/{id}/, project/{id}/, user/{ownerId}/, global/;
- RAG: ownership checks via GetProject/GetConversation; Global write requires admin role;
- RAG: tiered retrieval Conversation -> Project -> User -> Global (single embedding, dedup, TopK fill);
- RAG: apply Type filter, sanitize file names, enforce MaxFilesPerIngest/MaxFileSizeBytes/MaxDocumentsPerScope;
- RAG: store scope/scopeId/type/ownerId metadata; return it in documents and sources;
- RAG: add MigrateLegacyVectorsAsync + POST /Knowledge/MigrateLegacy ({ownerId}/... -> user/{ownerId}/...);
- Knowledge API: scope/scopeId on Ingest, Documents, DELETE Documents;
- Remove ProxyController (root route "{modelName}/{path}" + AllowAnonymous hijacked all 2-segment paths);
- Startup: ExceptionHandler("/error") + HSTS outside Development; Swagger only in Development;
static files before routing; CORS before model proxy; add /error endpoint;
- SSE: all stream endpoints use xHttpService XSseExtensions; validate before streaming;
pre-stream errors return proper HTTP status; remove "Connection: keep-alive";
- Use xAiModels.Constants for XAiKnowledgeScope / Knowledge constants / XOpenAINoKey;
- Register XAiVectorEntityRegisterar in XAiApiDbContext;
- XCodeFileContentExtractor: actually read stream content; drop hard-coded "book.epub".
BREAKING: AskTextStream emits data: {"text":"..."}; AskStream emits data: {json}; both end with event: done.
This commit is contained in:
@@ -20,26 +20,5 @@ namespace xAiApi.Constants
|
||||
public const string XAiDefaultVisionModelName = "Qwen";
|
||||
public const string XAiDefaultThinkingModelName = "Qwen";
|
||||
public const string XAiEmbeddingPromptName = "Embedding";
|
||||
|
||||
//
|
||||
public const string XOpenAINoKey = "no-key-required";
|
||||
|
||||
//
|
||||
// Knowledge (Persistent RAG) ...
|
||||
public const string XAiDefaultKnowledgeType = "XAiKnowledge";
|
||||
public const string XAiKnowledgeSeparator = "/";
|
||||
public const string XAiKnowledgeOwnerSeparator = "/";
|
||||
public const string XAiKnowledgeChunkSeparator = "#";
|
||||
public const string XAiKnowledgeGlobalPrefix = "global";
|
||||
public const string XAiKnowledgeProjectPrefix = "project";
|
||||
public const string XAiKnowledgeConversationPrefix = "conversation";
|
||||
|
||||
//
|
||||
// Knowledge Metadata Keys ...
|
||||
public const string XAiKnowledgeMetadataType = "type";
|
||||
public const string XAiKnowledgeMetadataScope = "scope";
|
||||
public const string XAiKnowledgeMetadataScopeId = "scopeId";
|
||||
public const string XAiKnowledgeMetadataOwnerId = "ownerId";
|
||||
public const string XAiKnowledgeMetadataIngestedAtUtc = "ingestedAtUtc";
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace xAiApi.Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// Knowledge Base Scope (Where Ingested Vectors are Visible) ...
|
||||
/// </summary>
|
||||
public enum XAiKnowledgeScope
|
||||
{
|
||||
Conversation = 0,
|
||||
Project = 1,
|
||||
Global = 2,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user