Files
xSaherelmWorkspace/Documents/Docs/Developer/xAiApi-14050807-Overview-1.html
T
saherelm eeeb132bb2 - Update submodule pointers: xAiApi, Modules/xAiModels, Modules/xHttpService;
- Add Documents/Docs/Developer/xAiApi-14050807-Overview.html and -Overview-1.html (review reports);
- Add Documents/GeneratedContext/*-20261029_145645.txt (xAiApi, xAiModels, xAiService);
- Add Documents/Docs/ChangeLogs/1405-08-07-v01.html and this commit message file.
2026-10-29 20:08:09 +03:30

1298 lines
37 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html
lang="fa"
dir="rtl"
>
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>بازبینی دوم و تحلیل اصلاحات | سامانه xAiApi</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');
:root {
--primary: #1a365d;
--primary-light: #2c5282;
--accent: #c9a961;
--accent-dark: #a8893f;
--bg: #faf9f6;
--card-bg: #ffffff;
--text: #1a202c;
--text-muted: #4a5568;
--border: #e2e8f0;
--success: #38a169;
--danger: #e53e3e;
--warning: #dd6b20;
--info: #3182ce;
--shadow: 0 4px 6px rgba(0,0,0,0.05), 0 10px 30px rgba(26,54,93,0.08);
}
{ box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Vazirmatn', Tahoma, sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.9;
font-size: 15px;
padding: 30px 15px;
}
.document-container {
max-width: 1000px;
margin: 0 auto;
background: var(--card-bg);
box-shadow: var(--shadow);
border-radius: 12px;
overflow: hidden;
}
.document-header {
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
color: white;
padding: 50px 40px 40px;
position: relative;
border-bottom: 4px solid var(--accent);
}
.document-header::before {
content: '';
position: absolute;
top: 0; right: 0;
width: 200px; height: 200px;
background: radial-gradient(circle, rgba(201,169,97,0.15) 0%, transparent 70%);
border-radius: 50%;
transform: translate(50%, -50%);
}
.header-top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
position: relative;
z-index: 1;
}
.company-badge {
display: flex;
align-items: center;
gap: 12px;
}
.company-logo {
width: 60px; height: 60px;
background: var(--accent);
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.doc-meta {
text-align: left;
font-size: 12px;
opacity: 0.9;
}
.doc-meta div { margin-bottom: 3px; }
.document-title {
text-align: center;
position: relative;
z-index: 1;
padding: 20px 0;
}
.document-title .label {
display: inline-block;
background: rgba(201,169,97,0.2);
color: var(--accent);
padding: 4px 16px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
margin-bottom: 15px;
border: 1px solid rgba(201,169,97,0.4);
}
.document-title h1 {
font-size: 28px;
font-weight: 800;
margin-bottom: 10px;
letter-spacing: -0.5px;
}
.document-title h2 {
font-size: 16px;
font-weight: 400;
opacity: 0.9;
}
.document-body {
padding: 40px;
}
.intro-text {
background: linear-gradient(to left, #f7fafc, #edf2f7);
border-right: 4px solid var(--accent);
padding: 20px 25px;
border-radius: 8px;
margin-bottom: 35px;
font-size: 14px;
color: var(--text-muted);
}
.section {
margin-bottom: 40px;
page-break-inside: avoid;
}
.section-header {
display: flex;
align-items: center;
gap: 15px;
padding-bottom: 12px;
border-bottom: 2px solid var(--border);
margin-bottom: 20px;
}
.section-number {
width: 50px; height: 50px;
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-weight: 800;
font-size: 20px;
flex-shrink: 0;
box-shadow: 0 4px 10px rgba(26,54,93,0.2);
}
.section-title { flex: 1; }
.section-title h3 {
font-size: 19px;
font-weight: 700;
color: var(--primary);
margin-bottom: 2px;
}
.section-title .subtitle {
font-size: 12px;
color: var(--text-muted);
}
.section-content {
padding-right: 10px;
}
.section-content p {
margin-bottom: 12px;
text-align: justify;
text-indent: 20px;
}
.section-content p.no-indent { text-indent: 0; }
.highlight-box {
background: linear-gradient(to left, #fffaf0, #fef5e7);
border: 1px solid #f6e05e;
border-right: 4px solid var(--accent);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.highlight-box strong { color: var(--accent-dark); }
.info-box {
background: linear-gradient(to left, #ebf8ff, #e6f6ff);
border: 1px solid #90cdf4;
border-right: 4px solid var(--primary-light);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.success-box {
background: linear-gradient(to left, #f0fff4, #e6fffa);
border: 1px solid #9ae6b4;
border-right: 4px solid var(--success);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.warning-box {
background: linear-gradient(to left, #fffaf0, #fef5e7);
border: 1px solid #fbd38d;
border-right: 4px solid var(--warning);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.danger-box {
background: linear-gradient(to left, #fff5f5, #fed7d7);
border: 1px solid #feb2b2;
border-right: 4px solid var(--danger);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.styled-table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.styled-table thead {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
}
.styled-table th {
padding: 14px 16px;
text-align: right;
font-weight: 600;
font-size: 13px;
}
.styled-table td {
padding: 13px 16px;
border-bottom: 1px solid var(--border);
font-size: 13px;
vertical-align: top;
}
.styled-table tbody tr:last-child td { border-bottom: none; }
.styled-table tbody tr:nth-child(even) { background: #f8fafc; }
.styled-table .highlight-row {
background: #fffaf0 !important;
font-weight: 600;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 15px;
margin: 25px 0;
}
.stat-card {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
padding: 20px;
border-radius: 10px;
text-align: center;
box-shadow: 0 4px 12px rgba(26,54,93,0.2);
}
.stat-card.success {
background: linear-gradient(135deg, #276749, var(--success));
}
.stat-card.danger {
background: linear-gradient(135deg, #9b2c2c, var(--danger));
}
.stat-card.warning {
background: linear-gradient(135deg, #9c4221, var(--warning));
}
.stat-card .stat-value {
font-size: 26px;
font-weight: 800;
margin-bottom: 5px;
color: var(--accent);
line-height: 1.3;
}
.stat-card.success .stat-value,
.stat-card.danger .stat-value,
.stat-card.warning .stat-value {
color: white;
}
.stat-card .stat-label {
font-size: 12px;
opacity: 0.95;
}
.conclusion-box {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
padding: 30px;
border-radius: 12px;
margin: 30px 0;
text-align: center;
box-shadow: 0 8px 20px rgba(26,54,93,0.3);
}
.conclusion-box h3 {
font-size: 22px;
font-weight: 800;
margin-bottom: 15px;
color: var(--accent);
}
.conclusion-box p {
font-size: 14px;
line-height: 1.8;
text-indent: 0 !important;
margin-bottom: 15px;
}
.conclusion-box .highlight {
background: rgba(201,169,97,0.2);
padding: 15px 20px;
border-radius: 8px;
margin-top: 20px;
border: 1px solid rgba(201,169,97,0.4);
}
.document-footer {
background: var(--primary);
color: white;
padding: 25px 40px;
text-align: center;
font-size: 12px;
margin-top: 40px;
}
.document-footer .footer-brand {
font-weight: 700;
color: var(--accent);
margin-bottom: 5px;
font-size: 14px;
}
.footer-divider {
width: 60px;
height: 2px;
background: var(--accent);
margin: 10px auto;
}
.page-info {
text-align: center;
padding: 15px;
font-size: 11px;
color: var(--text-muted);
border-top: 1px solid var(--border);
margin-top: 30px;
}
.badge {
display: inline-block;
padding: 2px 10px;
border-radius: 12px;
font-size: 11px;
font-weight: 600;
}
.badge-fixed { background: #c6f6d5; color: #22543d; }
.badge-partial { background: #feebc8; color: #7b341e; }
.badge-open { background: #fed7d7; color: #742a2a; }
code {
background: #edf2f7;
padding: 2px 6px;
border-radius: 4px;
font-family: 'Consolas', 'Monaco', monospace;
font-size: 12px;
direction: ltr;
display: inline-block;
}
ul { padding-right: 20px; margin-top: 10px; }
li { margin-bottom: 8px; }
@media print {
body { background: white; padding: 0; }
.document-container { box-shadow: none; border-radius: 0; }
.section { page-break-inside: avoid; }
}
@media (max-width: 768px) {
.document-body { padding: 25px 20px; }
.document-header { padding: 30px 20px; }
.stats-grid { grid-template-columns: 1fr 1fr; }
.header-top { flex-direction: column; gap: 15px; }
.doc-meta { text-align: center; }
}
</style>
</head>
<body>
<div class="document-container">
<header class="document-header">
<div class="header-top">
<div class="company-badge">
<div class="company-logo"></div>
</div>
<div class="doc-meta">
<div>شماره مستند: ARCH-REV-1405-002</div>
<div>نسخه: ۲.۰</div>
<div>تاریخ تهیه: آبان ۱۴۰۵</div>
<div>طبقه‌بندی: محرمانه</div>
</div>
</div>
<div class="document-title">
<span class="label">REVIEW &amp; CORRECTION ANALYSIS</span>
<h1>بازبینی دوم و تحلیل اصلاحات سامانه xAiApi</h1>
<h2>
تحلیل تغییرات اعمال‌شده، وضعیت خطاهای قبلی و مسیر
باقی‌مانده
</h2>
</div>
</header>
<div class="document-body">
<div class="intro-text">
<strong>خلاصه مدیریتی:</strong><br />
در این نسخه از کدها، مجموعه‌ای از اصلاحات هدفمند اعمال شده
است. خطاهای بحرانی مربوط به ثبت Entity، Migration، جداسازی
مالکیت داده و NullReferenceException برطرف شده‌اند. همچنین
بخش قابل توجهی از نقاط ضعف امنیتی در Authorization مرتفع شده
است. با این حال، چند خطای مهم دیگر در حوزه RAG ماندگار
(Scope)، Startup Pipeline، مسیرهای Proxy و قالب SSE همچنان
باز هستند و پیش از استفاده Production باید تعیین تکلیف شوند.
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۱</div>
<div class="section-title">
<h3>خلاصه اجرایی بازبینی دوم</h3>
<div class="subtitle">Executive Summary</div>
</div>
</div>
<div class="section-content">
<p>
از میان ۱۷ مورد شناسایی‌شده در بازبینی اول، ۸ مورد
به‌طور کامل اصلاح شده، ۱ مورد به‌صورت جزئی اصلاح شده
و ۸ مورد همچنان باز است. اصلاحات انجام‌شده عمدتاً
روی لایه داده، ثبت Entity و Queryهای مالکیت متمرکز
بوده و همین امر باعث کاهش قابل توجه ریسک نشت داده و
پایداری Runtime شده است.
</p>
<div class="stats-grid">
<div class="stat-card success">
<div class="stat-value">۸</div>
<div class="stat-label">
مورد کاملاً اصلاح‌شده
</div>
</div>
<div class="stat-card warning">
<div class="stat-value">۱</div>
<div class="stat-label">مورد اصلاح جزئی</div>
</div>
<div class="stat-card danger">
<div class="stat-value">۸</div>
<div class="stat-label">
مورد باز / اصلاح‌نشده
</div>
</div>
<div class="stat-card">
<div class="stat-value">۴۷٪</div>
<div class="stat-label">نرخ اصلاح کل موارد</div>
</div>
</div>
<div class="success-box">
<strong>نتیجه کلیدی:</strong> ریسک‌های بحرانی F-01
تا F-04 که پیش از این امکان نشت داده و خطای Runtime
را ایجاد می‌کردند، برطرف شده‌اند. سامانه اکنون در
حوزه مالکیت داده و ثبت Entity پایدارتر است.
</div>
<div class="warning-box">
<strong>نکته مهم:</strong> مشکلات مربوط به
پیاده‌سازی واقعی Scope در RAG ماندگار، تداخل Route
در ProxyController، ترتیب Middleware در Startup و
قالب SSE همچنان به قوت خود باقی هستند و باید پیش از
Production تعیین تکلیف شوند.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۲</div>
<div class="section-title">
<h3>فهرست تغییرات اعمال‌شده</h3>
<div class="subtitle">Applied Changes</div>
</div>
</div>
<div class="section-content">
<p>
جدول زیر تغییرات کدها را به‌صورت خلاصه نشان می‌دهد:
</p>
<table class="styled-table">
<thead>
<tr>
<th>شناسه</th>
<th>محل</th>
<th>تغییر اعمال‌شده</th>
<th>وضعیت</th>
</tr>
</thead>
<tbody>
<tr>
<td>F-01</td>
<td>XAiApiDbContext</td>
<td>
افزودن
<code
>nameof(XAiVectorEntityRegisterar)</code
>
به
<code
>dynamicEntityRegisterarsNames</code
>
</td>
<td>
<span class="badge badge-fixed"
>اصلاح شد</span
>
</td>
</tr>
<tr>
<td>F-02</td>
<td>Migration جدید</td>
<td>
افزودن ستون <code>Type</code> با
maxLength=100 و دو Index روی
<code>Identifier</code> و
<code>Type</code> در Migration
</td>
<td>
<span class="badge badge-fixed"
>اصلاح شد</span
>
</td>
</tr>
<tr>
<td>F-03</td>
<td>
XAiDataProvider.QueryProjects /
QueryConversations / QueryMessages
</td>
<td>
اصلاح شرط به
<code
>if (!ownerId.IsNullOrEmpty())</code
>
تا Predicate مالکیت اعمال شود
</td>
<td>
<span class="badge badge-fixed"
>اصلاح شد</span
>
</td>
</tr>
<tr>
<td>F-04</td>
<td>
XAiDataProvider.GetDefaultConversation
</td>
<td>
استفاده از <code>id: projectId</code> به
جای <code>id: project.Id</code> در شاخه
else
</td>
<td>
<span class="badge badge-fixed"
>اصلاح شد</span
>
</td>
</tr>
<tr>
<td>F-09</td>
<td>XCodeFileContentExtractor</td>
<td>
انتساب واقعی متن خوانده‌شده به
<code>result.Text</code> و جایگزینی نام
فایل پیش‌فرض با
<code>string.Empty</code>
</td>
<td>
<span class="badge badge-fixed"
>اصلاح شد</span
>
</td>
</tr>
<tr>
<td>F-12</td>
<td>
XAiModelsExtensions.HasDefaultProject /
HasDefaultConversation
</td>
<td>
معکوس شدن شرط اعتبارسنجی به
<code>if (!source.HasChild() ...)</code>
</td>
<td>
<span class="badge badge-fixed"
>اصلاح شد</span
>
</td>
</tr>
<tr>
<td>F-13</td>
<td>
XAiDataProvider.CreateProject /
CreateConversation
</td>
<td>
مقدار
<code
>isDefaultLanguageHandled =
true</code
>
پس از تخصیص زبان پیش‌فرض
</td>
<td>
<span class="badge badge-fixed"
>اصلاح شد</span
>
</td>
</tr>
<tr>
<td>F-14</td>
<td>XAiDataProvider.LoadConversations</td>
<td>
تنظیم
<code>ignoreSoftDeleteds: true</code>
برای Conversationها
</td>
<td>
<span class="badge badge-fixed"
>اصلاح شد</span
>
</td>
</tr>
<tr>
<td>F-16</td>
<td>
XAiServiceControllerBase /
XAiEmbeddingServiceControllerBase
</td>
<td>
حذف <code>[AllowAnonymous]</code> از
اکثر Actionها و افزودن
<code
>[Authorize(Policy =
XPolicies.EnabledUser)]</code
>؛ اما <code>Embedding</code> و
<code>Embeddings</code> همچنان anonymous
هستند
</td>
<td>
<span class="badge badge-partial"
>جزئی</span
>
</td>
</tr>
<tr>
<td>F-05</td>
<td>XAiRAGService</td>
<td>—</td>
<td>
<span class="badge badge-open"
>باز</span
>
</td>
</tr>
<tr>
<td>F-06</td>
<td>ProxyController</td>
<td>—</td>
<td>
<span class="badge badge-open"
>باز</span
>
</td>
</tr>
<tr>
<td>F-07</td>
<td>Startup.Configure</td>
<td>—</td>
<td>
<span class="badge badge-open"
>باز</span
>
</td>
</tr>
<tr>
<td>F-08</td>
<td>SSE در XAiServiceControllerBase</td>
<td>—</td>
<td>
<span class="badge badge-open"
>باز</span
>
</td>
</tr>
<tr>
<td>F-10</td>
<td>XImageFileContentExtractor</td>
<td>—</td>
<td>
<span class="badge badge-open"
>باز</span
>
</td>
</tr>
<tr>
<td>F-11</td>
<td>XAiEmbeddingServiceBase (Ollama)</td>
<td>—</td>
<td>
<span class="badge badge-open"
>باز</span
>
</td>
</tr>
<tr>
<td>F-15</td>
<td>XAiRAGService.IngestAsync</td>
<td>—</td>
<td>
<span class="badge badge-open"
>باز</span
>
</td>
</tr>
<tr>
<td>F-17</td>
<td>دو مسیر موازی Proxy</td>
<td>—</td>
<td>
<span class="badge badge-open"
>باز</span
>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۳</div>
<div class="section-title">
<h3>تحلیل تفصیلی اصلاحات انجام‌شده</h3>
<div class="subtitle">
Detailed Analysis of Fixes
</div>
</div>
</div>
<div class="section-content">
<p class="no-indent">
<strong
>۳-۱. لایه داده و Migration (F-01، F-02)</strong
>
</p>
<p>
ثبت <code>XAiVectorEntityRegisterar</code> در
Context به همراه Migration جدید که ستون
<code>Type</code> و دو Index روی
<code>Identifier</code> و <code>Type</code> را ایجاد
می‌کند، پایه ذخیره‌سازی و جستجوی RAG ماندگار را
تثبیت کرده است. اکنون مدل XAiVector با Database
هم‌راستا است و Repositoryهای Vector بدون خطای
Runtime کار می‌کنند.
</p>
<p class="no-indent">
<strong>۳-۲. جداسازی مالکیت داده (F-03)</strong>
</p>
<p>
معکوس شدن شرط در QueryProjects، QueryConversations و
QueryMessages باعث شده است که در صورت وجود ownerId،
Predicate مالکیت واقعاً ساخته شود. این تغییر
مستقیماً ریسک نشت داده بین کاربران را از بین می‌برد
و به Validation لایه بالاتر اتکا نمی‌کند.
</p>
<p class="no-indent">
<strong
>۳-۳. پایداری GetDefaultConversation
(F-04)</strong
>
</p>
<p>
استفاده از <code>projectId</code> ورودی به جای
<code>project.Id</code> در زمانی که
<code>project</code> هنوز null است، باعث حذف
NullReferenceException در این متد شده و مسیر بازیابی
پیش‌فرض گفتگو را پایدار کرده است.
</p>
<p class="no-indent">
<strong>۳-۴. استخراج کد منبع (F-09)</strong>
</p>
<p>
XCodeFileContentExtractor اکنون محتوای خوانده‌شده را
به <code>result.Text</code> اختصاص می‌دهد. این اصلاح
باعث می‌شود فایل‌های کد در ChatWithDocuments و
Knowledge واقعاً قابل استفاده باشند.
</p>
<p class="no-indent">
<strong
>۳-۵. اعتبارسنجی مجموعه‌ها (F-12) و پرچم زبان
پیش‌فرض (F-13)</strong
>
</p>
<p>
اصلاح شرط در <code>HasDefaultProject</code> و
<code>HasDefaultConversation</code> رفتار این متدها
را به حالت منطقی برگردانده است. همچنین در
<code>CreateProject</code> و
<code>CreateConversation</code>، پرچم
<code>isDefaultLanguageHandled</code> پس از اولین
تخصیص مقدار <code>true</code> می‌گیرد و از اعمال
تکراری زبان پیش‌فرض جلوگیری می‌شود.
</p>
<p class="no-indent">
<strong
>۳-۶. حذف Soft-Delete از LoadConversations
(F-14)</strong
>
</p>
<p>
تغییر <code>ignoreSoftDeleteds</code> از
<code>false</code> به <code>true</code> باعث می‌شود
آیتم‌های حذف‌شده در لیست Conversationها ظاهر نشوند.
</p>
<p class="no-indent">
<strong
>۳-۷. اصلاح جزئی Authorization (F-16)</strong
>
</p>
<p>
اکثر Actionهای
<code>XAiServiceControllerBase</code> اکنون با
<code
>[Authorize(Policy =
XPolicies.EnabledUser)]</code
>
محافظت می‌شوند. اما در
<code>XAiEmbeddingServiceControllerBase</code> هنوز
روی <code>Embedding</code> و
<code>Embeddings</code> صفت
<code>[AllowAnonymous]</code> باقی مانده است و این
دو Endpoint بدون احراز هویت در دسترس هستند.
</p>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۴</div>
<div class="section-title">
<h3>موارد باز و تحلیل تأثیر آن‌ها</h3>
<div class="subtitle">Open Issues &amp; Impact</div>
</div>
</div>
<div class="section-content">
<p>
موارد زیر همچنان در کدها باز هستند و تأثیر مستقیم بر
آمادگی Production دارند:
</p>
<table class="styled-table">
<thead>
<tr>
<th>شناسه</th>
<th>محل</th>
<th>شرح</th>
<th>تأثیر</th>
</tr>
</thead>
<tbody>
<tr class="highlight-row">
<td>F-05</td>
<td>XAiRAGService / KnowledgeController</td>
<td>
Scopeهای Conversation، Project و Global
و همچنین فیلتر <code>Type</code> در Ask
و Retrieve اعمال نمی‌شوند. در
<code>SearchVectorsAsync</code> مقدار
<code>type: null</code> ارسال می‌شود و
ProjectId/ConversationId از Request
استفاده نمی‌شود.
</td>
<td style="color: var(--danger)">
جداسازی دانش بین Scopeها کار نمی‌کند و
همه وکتورهای Owner در یک فضای مشترک
جستجو می‌شوند.
</td>
</tr>
<tr class="highlight-row">
<td>F-06</td>
<td>ProxyController</td>
<td>
Route <code>{modelName}/{path}</code> در
سطح Root تعریف شده و می‌تواند با مسیرهای
دو بخشی مانند
<code>DefaultAi/AskText</code> تداخل
داشته باشد.
</td>
<td style="color: var(--danger)">
ریسک تداخل Routing و همچنین Hop اضافی و
امکان Loop در حالت Proxy غیرفعال.
</td>
</tr>
<tr>
<td>F-07</td>
<td>Startup.Configure</td>
<td>
Middlewareهای Storage، Push، Database،
String، Tag و File بعد از
<code>UseEndpoints</code> ثبت شده‌اند.
</td>
<td style="color: var(--warning)">
این Middlewareها برای درخواست‌های Match
شده اجرا نمی‌شوند.
</td>
</tr>
<tr>
<td>F-08</td>
<td>XAiServiceControllerBase</td>
<td>
در <code>AskTextStream</code> خروجی
به‌صورت
<code>$"{payload}\n\n"</code> نوشته
می‌شود و در
<code>AskStream</code> به‌صورت
<code>$"{payload}"</code>، بدون prefix
استاندارد <code>data:</code> و بدون
پایان‌بندی دو newline.
</td>
<td style="color: var(--warning)">
کلاینت‌های استاندارد SSE نمی‌توانند داده
را به درستی دریافت کنند.
</td>
</tr>
<tr>
<td>F-10</td>
<td>XImageFileContentExtractor</td>
<td>
در Constructor، وجود
<code>DataPath</code> و
<code>DefaultLanguage</code> حتی وقتی
<code>EnableOcrFallback = false</code>
است الزامی شده.
</td>
<td style="color: var(--warning)">
استخراج تصویر بدون OCR نیز شکست می‌خورد.
</td>
</tr>
<tr>
<td>F-11</td>
<td>XAiEmbeddingServiceBase (Ollama)</td>
<td>
در حالت Ollama، مدل Embedding
<code>descriptor.LLM</code> هنگام ساخت
<code>OllamaApiClient</code> استفاده
نمی‌شود.
</td>
<td style="color: var(--warning)">
ممکن است مدل پیش‌فرض Ollama انتخاب شود و
Embedding با مدل مورد انتظار متفاوت
باشد.
</td>
</tr>
<tr>
<td>F-15</td>
<td>XAiRAGService.IngestAsync</td>
<td>
فیلدهای <code>Scope</code>،
<code>ScopeId</code> و
<code>Type</code> در
<code>XAiKnowledgeIngestResult</code> و
<code>XAiKnowledgeDocumentInfo</code> پر
نمی‌شوند. محدودیت‌های
<code>MaxFilesPerIngest</code>،
<code>MaxFileSizeBytes</code> و
<code>MaxDocumentsPerScope</code> اعمال
نمی‌شوند.
</td>
<td style="color: var(--warning)">
پاسخ API ناقص است و امکان مصرف بی‌رویه
حافظه و Database وجود دارد.
</td>
</tr>
<tr>
<td>F-16</td>
<td>XAiEmbeddingServiceControllerBase</td>
<td>
<code>[AllowAnonymous]</code> روی
<code>Embedding</code> و
<code>Embeddings</code> باقی مانده است.
</td>
<td style="color: var(--warning)">
دسترسی بدون احراز هویت به سرویس
Embedding.
</td>
</tr>
<tr>
<td>F-17</td>
<td>Middleware و ProxyController</td>
<td>
دو مسیر موازی برای Proxy وجود دارد و
ProxyController درخواست را دوباره به
همین سامانه می‌فرستد.
</td>
<td style="color: var(--warning)">
Hop اضافی، ریسک Loop و افزایش هزینه
پردازش.
</td>
</tr>
</tbody>
</table>
<div class="danger-box">
<strong>پرخطرترین مورد باقی‌مانده:</strong> F-05
همچنان اجازه می‌دهد تمام وکتورهای یک Owner بدون
تفکیک Project/Conversation/Type جستجو شوند. این
موضوع با اهداف اعلام‌شده در مدل‌های
XAiKnowledgeScope و XAiKnowledgeAskRequest در تناقض
است.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۵</div>
<div class="section-title">
<h3>پیشنهادهای اصلاحی مرحله بعد</h3>
<div class="subtitle">
Next-Step Recommendations
</div>
</div>
</div>
<div class="section-content">
<p>
اولویت‌بندی موارد باز بر اساس تأثیر بر پایداری و
امنیت سامانه:
</p>
<table class="styled-table">
<thead>
<tr>
<th>اولویت</th>
<th>اقدام پیشنهادی</th>
<th>شناسه مرتبط</th>
</tr>
</thead>
<tbody>
<tr class="highlight-row">
<td
style="
color: var(--danger);
font-weight: 700;
"
>
P0
</td>
<td>
پیاده‌سازی واقعی Scope و Type در
XAiRAGService: استخراج
ProjectId/ConversationId از Request،
ساخت Scope در Ingest و اعمال فیلترهای
IdentifierPrefix و Type در
SearchVectorsAsync.
</td>
<td>F-05، F-15</td>
</tr>
<tr class="highlight-row">
<td
style="
color: var(--danger);
font-weight: 700;
"
>
P0
</td>
<td>
حذف یا محدودکردن Route مربوط به
ProxyController و اتکا به
XAiModelProxyMiddleware. جلوگیری از Loop
در حالت Proxy غیرفعال.
</td>
<td>F-06، F-17</td>
</tr>
<tr>
<td
style="
color: var(--warning);
font-weight: 700;
"
>
P1
</td>
<td>
حذف <code>[AllowAnonymous]</code> از
Embedding و Embeddings یا مستندسازی صریح
دلیل آن.
</td>
<td>F-16</td>
</tr>
<tr>
<td
style="
color: var(--warning);
font-weight: 700;
"
>
P1
</td>
<td>
یکسان‌سازی قالب SSE در همه Controllerها
با prefix <code>data:</code> و
پایان‌بندی دو newline.
</td>
<td>F-08</td>
</tr>
<tr>
<td
style="
color: var(--warning);
font-weight: 700;
"
>
P1
</td>
<td>
جابه‌جایی Middlewareهای Storage، Push،
Database، String، Tag و File به قبل از
UseEndpoints.
</td>
<td>F-07</td>
</tr>
<tr>
<td
style="
color: var(--primary-light);
font-weight: 700;
"
>
P2
</td>
<td>
اعتبارسنجی OCR فقط در صورت
<code>EnableOcrFallback = true</code> و
استفاده از
<code>descriptor.LLM</code> در
OllamaApiClient برای Embedding.
</td>
<td>F-10، F-11</td>
</tr>
<tr>
<td
style="
color: var(--primary-light);
font-weight: 700;
"
>
P2
</td>
<td>
پرکردن فیلدهای Scope/ScopeId/Type در
IngestResult و اعمال محدودیت‌های
MaxFilesPerIngest و MaxFileSizeBytes.
</td>
<td>F-15</td>
</tr>
<tr>
<td
style="
color: var(--primary-light);
font-weight: 700;
"
>
P2
</td>
<td>
افزودن تست‌های End-to-End برای Scope،
مالکیت، SSE و Proxy پس از اصلاحات.
</td>
<td>همه موارد</td>
</tr>
</tbody>
</table>
<div class="info-box">
<strong>پیشنهاد کلیدی:</strong> با توجه به اینکه
اصلاحات داده و مالکیت انجام شده، بهتر است ابتدا یک
تست پذیرش روی مالکیت داده‌ها، Migration و کارکرد
Knowledge انجام شود و سپس F-05 و F-06 به‌عنوان آخرین
موانع آمادگی Production برطرف شوند.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۶</div>
<div class="section-title">
<h3>جمع‌بندی نهایی</h3>
<div class="subtitle">Final Conclusion</div>
</div>
</div>
<div class="section-content">
<p>
اصلاحات اعمال‌شده نشان‌دهنده حرکت درست و هدفمند تیم
توسعه است. خطاهای بحرانی مرتبط با ثبت Entity،
Migration، Queryهای مالکیت و NullReferenceException
برطرف شده‌اند و پایه داده سامانه اکنون پایدارتر است.
همچنین حذف <code>[AllowAnonymous]</code> از بخش
بزرگی از Actionها، سطح حمله را کاهش داده است.
</p>
<p>
با این حال، سامانه هنوز از نظر پیاده‌سازی واقعی
Scope در RAG، مدیریت مسیرهای Proxy، ترتیب
Middlewareها و قالب SSE نیازمند اصلاح است. تا زمانی
که F-05 و F-06 برطرف نشوند، نمی‌توان گفت جداسازی
دانش و رفتار Proxy کاملاً قابل اتکاست.
</p>
<div class="conclusion-box">
<h3>🎯 جمع‌بندی اجرایی بازبینی دوم</h3>
<p>
پیشرفت قابل توجهی در پایداری داده و امنیت پایه
حاصل شده است.
</p>
<div class="highlight">
<strong>مسیر باقی‌مانده تا Production:</strong
><br />
پیاده‌سازی Scope در RAG + تعیین تکلیف
ProxyController + اصلاح Startup Pipeline +
استانداردسازی SSE + حذف AllowAnonymous از
Embedding
</div>
</div>
</div>
</div>
<div class="page-info">
این مستند محرمانه بوده و صرفاً جهت بررسی فنی داخلی تهیه شده
است. هرگونه کپی‌برداری یا افشا بدون اجازه کتبی ممنوع است.
</div>
</div>
<footer class="document-footer">
<div class="footer-brand">
بازبینی فنی دوم بر اساس کدهای به‌روزشده پروژه
xSaherelmWorkspace
</div>
<div class="footer-divider"></div>
<div>
تاریخ تهیه: آبان ۱۴۰۵ &nbsp;|&nbsp; نسخه: ۲.۰ &nbsp;|&nbsp;
طبقه‌بندی: محرمانه
</div>
</footer>
</div>
</body>
</html>