- حذف چهار context قدیمی مربوط به 2026-11-06.
- افزودن contextهای جدید 2026-11-07 برای xAiApi، xAiMcpServer، xAiModels و xAiService.
This commit is contained in:
@@ -0,0 +1,298 @@
|
||||
<!doctype html>
|
||||
<html lang="fa" dir="rtl">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<title>گزارش تغییرات ۱۴۰۵/۰۸/۱۶ - v01 | xSaherelmWorkspace</title>
|
||||
<style>
|
||||
:root {
|
||||
--p: #173b78;
|
||||
--a: #2563eb;
|
||||
--bg: #f4f7fb;
|
||||
--l: #dbe3ef;
|
||||
--w: #b45309;
|
||||
--ok: #166534;
|
||||
}
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 24px;
|
||||
background: linear-gradient(135deg, #eef4ff, #f8fafc);
|
||||
color: #172033;
|
||||
font-family: Tahoma, "Segoe UI", sans-serif;
|
||||
line-height: 1.9;
|
||||
}
|
||||
.wrap {
|
||||
max-width: 1180px;
|
||||
margin: auto;
|
||||
background: #fff;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 12px 40px #20386422;
|
||||
overflow: hidden;
|
||||
}
|
||||
.hero {
|
||||
padding: 34px;
|
||||
background: linear-gradient(135deg, var(--p), var(--a));
|
||||
color: #fff;
|
||||
}
|
||||
.hero h1 {
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
.meta {
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
flex-wrap: wrap;
|
||||
padding: 14px 28px;
|
||||
background: #f8fafc;
|
||||
border-bottom: 1px solid var(--l);
|
||||
color: #53627a;
|
||||
}
|
||||
.meta strong {
|
||||
color: var(--p);
|
||||
}
|
||||
main {
|
||||
padding: 28px;
|
||||
}
|
||||
.section {
|
||||
margin-bottom: 22px;
|
||||
padding: 20px;
|
||||
background: var(--bg);
|
||||
border-right: 5px solid var(--a);
|
||||
border-radius: 10px;
|
||||
}
|
||||
.section h2 {
|
||||
margin: 0 0 12px;
|
||||
color: var(--p);
|
||||
border-bottom: 1px solid var(--l);
|
||||
padding-bottom: 7px;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
background: #fff;
|
||||
margin: 12px 0;
|
||||
}
|
||||
th,
|
||||
td {
|
||||
text-align: right;
|
||||
vertical-align: top;
|
||||
padding: 9px 11px;
|
||||
border-bottom: 1px solid var(--l);
|
||||
}
|
||||
th {
|
||||
background: var(--p);
|
||||
color: #fff;
|
||||
}
|
||||
code {
|
||||
direction: ltr;
|
||||
display: inline-block;
|
||||
background: #e7edf6;
|
||||
border-radius: 4px;
|
||||
padding: 0 5px;
|
||||
font-family: Consolas, monospace;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.note,
|
||||
.warn,
|
||||
.ok {
|
||||
padding: 12px 15px;
|
||||
border-radius: 7px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
.note {
|
||||
background: #eff6ff;
|
||||
border-right: 4px solid var(--a);
|
||||
}
|
||||
.warn {
|
||||
background: #fff7ed;
|
||||
border-right: 4px solid var(--w);
|
||||
}
|
||||
.ok {
|
||||
background: #f0fdf4;
|
||||
border-right: 4px solid var(--ok);
|
||||
}
|
||||
footer {
|
||||
text-align: center;
|
||||
color: #68758a;
|
||||
padding: 16px;
|
||||
border-top: 1px solid var(--l);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap">
|
||||
<header class="hero">
|
||||
<h1>گزارش بررسی تغییرات کل ساختار پروژه</h1>
|
||||
<p>xSaherelmWorkspace — وضعیت کاری Git و زیرماژول xAiMcpServer</p>
|
||||
</header>
|
||||
<div class="meta">
|
||||
<span><strong>تاریخ:</strong> ۱۴۰۵/۰۸/۱۶ (2026-11-07)</span
|
||||
><span><strong>نسخه مستند:</strong> v01</span
|
||||
><span><strong>شاخه:</strong> master</span
|
||||
><span><strong>وضعیت:</strong> commit نشده</span>
|
||||
</div>
|
||||
<main>
|
||||
<section class="section">
|
||||
<h2>۱. خلاصه اجرایی</h2>
|
||||
<p>
|
||||
تغییرات فعلی بر تکمیل قابلیتهای MCP در زیرماژول
|
||||
<code>xAiMcpServer</code>، بهروزرسانی contextهای تولیدشده، توسعهٔ
|
||||
مستندات توسعه و اصلاح نمونههای درخواست API متمرکز است.
|
||||
</p>
|
||||
<div class="note">
|
||||
<strong>مبنای گزارش:</strong> <code>git status</code> و diff ریشه،
|
||||
وضعیت و diff داخلی زیرماژول <code>xAiMcpServer</code>، و فهرست
|
||||
فایلهای جدید. این گزارش وضعیت کاری فعلی است و بهمعنای commit نهایی
|
||||
نیست.
|
||||
</div>
|
||||
</section>
|
||||
<section class="section">
|
||||
<h2>۲. تغییرات ریشهٔ Workspace</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>بخش</th>
|
||||
<th>تغییرات شناساییشده</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>GeneratedContext</td>
|
||||
<td>
|
||||
حذف چهار context مربوط به 2026-11-06 و ایجاد چهار context جدید
|
||||
در <code>Documents/GeneratedContext</code> برای
|
||||
<code>xAiApi</code>، <code>xAiMcpServer</code>،
|
||||
<code>xAiModels</code> و <code>xAiService</code> با
|
||||
timestampهای 2026-11-07.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>مستندات Developer</td>
|
||||
<td>
|
||||
ایجاد چهار فایل HTML دربارهٔ تولید فایل توسط LLM، مرور مدلهای
|
||||
زبانی، مدیریت memory/context و نقشهٔ راه multi-agent.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Requests.md</td>
|
||||
<td>
|
||||
بهروزرسانی مقادیر نمونهٔ پاسخ Authentication شامل access
|
||||
token، refresh token و زمان انقضا. مقادیر حساس عمداً در این
|
||||
گزارش تکرار نشدهاند.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<section class="section">
|
||||
<h2>۳. تغییرات زیرماژول xAiMcpServer</h2>
|
||||
<ul>
|
||||
<li>
|
||||
افزودن <code>XLinkExtractionTool</code> برای استخراج لینکهای
|
||||
HTTP/HTTPS از متن و خواندن محتوای متنی صفحات وب.
|
||||
</li>
|
||||
<li>
|
||||
افزودن مدلهای <code>XExtractedLink</code>،
|
||||
<code>XLinkBundle</code>، <code>XLinkContentResult</code> و
|
||||
<code>XWebSearchToolResult</code> و حذف مدل قدیمی نتیجهٔ جستوجو.
|
||||
</li>
|
||||
<li>
|
||||
افزودن <code>XAiMcpLinkExtractionToolConfiguration</code> با
|
||||
محدودیت تعداد لینک و تعداد کاراکتر.
|
||||
</li>
|
||||
<li>
|
||||
گسترش DI و <code>ConfigurationNodeNames</code> برای ثبت تنظیمات
|
||||
ابزار استخراج لینک و سرویسهای مرتبط.
|
||||
</li>
|
||||
<li>
|
||||
اصلاح قرارداد و provider جستوجوی وب برای استفاده از نتیجهٔ جدید،
|
||||
cache، محدودسازی نتایج، fallback و مدیریت anomaly پاسخ DuckDuckGo.
|
||||
</li>
|
||||
<li>
|
||||
افزودن تنظیمات مربوط به ابزار استخراج لینک و تغییرات پیکربندی
|
||||
اجرایی در <code>appsettings.json</code>.
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section class="section">
|
||||
<h2>۴. فایلهای اصلی درگیر</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>مسیر</th>
|
||||
<th>نوع تغییر</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>xAiMcpServer/Tools/XLinkExtractionTool.cs</code></td>
|
||||
<td>جدید؛ ابزار MCP استخراج و دریافت محتوای لینک</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code
|
||||
>xAiMcpServer/Configurations/XAiMcpLinkExtractionToolConfiguration.cs</code
|
||||
>
|
||||
</td>
|
||||
<td>جدید؛ تنظیمات ابزار</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>xAiMcpServer/Models/XExtractedLink.cs</code>،
|
||||
<code>XLinkBundle.cs</code>،
|
||||
<code>XLinkContentResult.cs</code>،
|
||||
<code>XWebSearchToolResult.cs</code>
|
||||
</td>
|
||||
<td>جدید؛ مدلهای خروجی و داده</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>xAiMcpServer/DI/DiExtensions.cs</code></td>
|
||||
<td>اصلاح؛ ثبت configuration و سرویسها</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>xAiMcpServer/Providers/XAiMcpWebSearchService.cs</code>
|
||||
</td>
|
||||
<td>اصلاح؛ مدل نتیجه، cache، fallback و parse</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<h2>۵. وضعیت اعتبارسنجی و نکات قبل از commit</h2>
|
||||
<div class="ok">
|
||||
وضعیت ریشه و تغییرات داخلی <code>xAiMcpServer</code> بررسی شد؛
|
||||
فایلهای جدید و حذفشده با Git تطبیق داده شدند.
|
||||
</div>
|
||||
<ol>
|
||||
<li>
|
||||
بهدلیل وجود credential و API key در <code>Requests.md</code>، پیش
|
||||
از commit نهایی بررسی کنید این فایل باید در مخزن بماند یا مقادیر
|
||||
به secret امن منتقل شوند.
|
||||
</li>
|
||||
<li>
|
||||
برای submodule، تغییرات داخلی باید در خود مخزن
|
||||
<code>xAiMcpServer</code> commit و سپس pointer ریشه بهروزرسانی
|
||||
شود.
|
||||
</li>
|
||||
<li>
|
||||
build، تستهای واحد و تست endpointهای MCP، استخراج لینک و جستوجوی
|
||||
وب هنوز اجرا نشدهاند و باید قبل از commit انجام شوند.
|
||||
</li>
|
||||
<li>
|
||||
برای مستندسازی نوبت بعدی از <code>1405-08-16-v02.html</code> و
|
||||
<code>CommitMessage-1405-08-16-v02.txt</code> استفاده کنید.
|
||||
</li>
|
||||
</ol>
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
فایل مرتبط: <code>CommitMessage-1405-08-16-v01.txt</code> | برای تغییرات
|
||||
بعدی شماره نسخه را افزایش دهید.
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,53 @@
|
||||
================================================================================
|
||||
Commit Message - xSaherelmWorkspace
|
||||
تاریخ: ۱۴۰۵/۰۸/۱۶ (2026-11-07)
|
||||
نسخه مستند: v01
|
||||
گزارش کامل: Documents/Docs/ChangeLogs/1405-08-16-v01.html
|
||||
================================================================================
|
||||
|
||||
هدف: تکمیل قابلیتهای MCP در xAiMcpServer، اضافهکردن ابزار استخراج و خواندن
|
||||
محتوای لینک، اصلاح جستوجوی وب، تولید contextهای جدید و بهروزرسانی مستندات.
|
||||
|
||||
وضعیت: این پیام بر اساس وضعیت کاری فعلی تهیه شده است؛ تغییرات هنوز commit نشدهاند.
|
||||
|
||||
[1] xAiMcpServer / Link Extraction
|
||||
- افزودن XLinkExtractionTool برای استخراج لینکهای HTTP/HTTPS از متن و HTML.
|
||||
- افزودن قابلیت دریافت و استخراج متن قابلخواندن از محتوای صفحات وب.
|
||||
- افزودن تنظیمات XAiMcpLinkExtractionToolConfiguration برای MaxLinks و MaxChars.
|
||||
- افزودن مدلهای XExtractedLink، XLinkBundle و XLinkContentResult.
|
||||
- ثبت ابزار و تنظیمات جدید در DI و ConfigurationNodeNames.
|
||||
|
||||
[2] xAiMcpServer / Web Search
|
||||
- تغییر قرارداد IXAiMcpWebSearchService برای بازگرداندن XWebSearchToolResult.
|
||||
- جایگزینی مدل قدیمی XAiMcpWebSearchToolResult با مدل جدید نتیجهٔ جستوجو.
|
||||
- اصلاح provider جستوجوی وب برای cache، محدودسازی نتایج، fallback و تشخیص anomaly.
|
||||
- بهروزرسانی appsettings.json برای پیکربندی قابلیتهای جدید.
|
||||
|
||||
[3] Workspace Generated Context
|
||||
- حذف چهار context قدیمی مربوط به 2026-11-06.
|
||||
- افزودن contextهای جدید 2026-11-07 برای xAiApi، xAiMcpServer، xAiModels و xAiService.
|
||||
|
||||
[4] Documentation
|
||||
- افزودن مستندات HTML در Documents/Docs/Developer دربارهٔ تولید فایل توسط LLM،
|
||||
مدلهای زبانی، مدیریت memory/context و نقشهٔ راه multi-agent.
|
||||
- ثبت این گزارش تغییرات و پیام commit در Documents/Docs/ChangeLogs.
|
||||
|
||||
[5] API Request Examples
|
||||
- بهروزرسانی نمونهٔ پاسخ Authentication در Documents/Resources/Json/Requests.md.
|
||||
- مقادیر credential و token در این پیام بازتولید نشدهاند؛ پیش از commit بررسی امنیتی
|
||||
انجام شود و در صورت امکان secretها از مستندات نمونه خارج شوند.
|
||||
|
||||
Validation:
|
||||
- git status و diff ریشه بررسی شد.
|
||||
- وضعیت و diff داخلی xAiMcpServer بررسی شد.
|
||||
- build، تست واحد و تست end-to-end هنوز اجرا نشدهاند.
|
||||
- تغییرات داخلی submodule باید جداگانه commit شوند و سپس pointer ریشه بهروزرسانی شود.
|
||||
|
||||
Suggested commit title:
|
||||
Add Link Extraction Tool and Improve MCP Web Search Integration
|
||||
(۱۴۰۵/۰۸/۱۶ v01)
|
||||
|
||||
برای مستندسازی تغییرات بعدی، شماره نسخه را افزایش دهید:
|
||||
1405-08-16-v02.html
|
||||
CommitMessage-1405-08-16-v02.txt
|
||||
================================================================================
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,984 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fa" dir="rtl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>تحلیل جامع مدلهای چندوجهی | پیشنهاد بهترین گزینه</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;
|
||||
--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: 950px;
|
||||
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;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.comparison-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 20px;
|
||||
margin: 25px 0;
|
||||
}
|
||||
|
||||
.comparison-card {
|
||||
background: #f8fafc;
|
||||
border: 2px solid var(--border);
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.comparison-card.recommended {
|
||||
border-color: var(--success);
|
||||
background: linear-gradient(to left, #f0fff4, #e6fffa);
|
||||
}
|
||||
|
||||
.comparison-card .card-badge {
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
right: 20px;
|
||||
background: var(--success);
|
||||
color: white;
|
||||
padding: 3px 12px;
|
||||
border-radius: 15px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.comparison-card h4 {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: var(--primary);
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 2px solid var(--border);
|
||||
}
|
||||
|
||||
.comparison-card.recommended h4 {
|
||||
border-bottom-color: var(--success);
|
||||
}
|
||||
|
||||
.comparison-card ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.comparison-card ul li {
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
font-size: 13px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.comparison-card ul li:last-child { border-bottom: none; }
|
||||
|
||||
.comparison-card ul li .value {
|
||||
font-weight: 600;
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.quote-box {
|
||||
background: linear-gradient(135deg, #f7fafc, #edf2f7);
|
||||
border-right: 4px solid var(--accent);
|
||||
padding: 20px 25px;
|
||||
border-radius: 8px;
|
||||
margin: 20px 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.quote-box::before {
|
||||
content: '"';
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
right: 15px;
|
||||
font-size: 60px;
|
||||
color: var(--accent);
|
||||
opacity: 0.3;
|
||||
font-family: Georgia, serif;
|
||||
}
|
||||
|
||||
.quote-box p {
|
||||
font-style: italic;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 10px;
|
||||
text-indent: 0 !important;
|
||||
}
|
||||
|
||||
.quote-box .source {
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 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 .stat-value {
|
||||
font-size: 24px;
|
||||
font-weight: 800;
|
||||
margin-bottom: 5px;
|
||||
color: var(--accent);
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.stat-card .stat-label {
|
||||
font-size: 12px;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.timeline {
|
||||
position: relative;
|
||||
padding: 20px 0;
|
||||
margin: 25px 0;
|
||||
}
|
||||
|
||||
.timeline::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 50%;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 3px;
|
||||
background: var(--border);
|
||||
transform: translateX(50%);
|
||||
}
|
||||
|
||||
.timeline-item {
|
||||
display: flex;
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.timeline-item:nth-child(odd) {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
.timeline-content {
|
||||
width: 45%;
|
||||
background: #f8fafc;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
padding: 15px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.timeline-item:nth-child(odd) .timeline-content {
|
||||
margin-left: 5%;
|
||||
}
|
||||
|
||||
.timeline-item:nth-child(even) .timeline-content {
|
||||
margin-right: 5%;
|
||||
}
|
||||
|
||||
.timeline-dot {
|
||||
position: absolute;
|
||||
right: 50%;
|
||||
top: 20px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: var(--accent);
|
||||
border: 3px solid white;
|
||||
border-radius: 50%;
|
||||
transform: translateX(50%);
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,0.2);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.timeline-content h5 {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: var(--primary);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.timeline-content p {
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
text-indent: 0 !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.reference-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.reference-list li {
|
||||
background: #f8fafc;
|
||||
border-right: 3px solid var(--primary-light);
|
||||
padding: 15px 20px;
|
||||
margin-bottom: 10px;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.reference-list li strong {
|
||||
color: var(--primary);
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.reference-list li .ref-source {
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
@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; }
|
||||
.comparison-grid { grid-template-columns: 1fr; }
|
||||
.stats-grid { grid-template-columns: 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>شماره مستند: MODEL-1405-002</div>
|
||||
<div>نسخه: ۱.۰</div>
|
||||
<div>تاریخ تهیه: آذر ۱۴۰۵</div>
|
||||
<div>طبقهبندی: محرمانه</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="document-title">
|
||||
<span class="label">MODEL EVALUATION & RECOMMENDATION</span>
|
||||
<h1>تحلیل جامع مدلهای چندوجهی</h1>
|
||||
<h2>مقایسه، ارزیابی و پیشنهاد بهترین گزینه برای پشتیبانی از فارسی، OCR، تولید صوت و اجرای محلی</h2>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="document-body">
|
||||
|
||||
<div class="intro-text">
|
||||
<strong>کارفرمای محترم،</strong><br>
|
||||
این مستند بهعنوان تحلیلی جامع و مبتنی بر دادههای فنی و مستندات رسمی مدلها، فهرست گستردهای از مدلهای چندوجهی (Omni-modal) و بینایی-زبانی (Vision-Language) را از نظر چهار معیار کلیدی بررسی میکند: <strong>پشتیبانی از زبان فارسی</strong>، <strong>قابلیت OCR</strong>، <strong>تولید صوت (Speech Generation)</strong> و <strong>امکان اجرا در محیطهای محلی (Local / GGUF)</strong>. هدف، ارائه شفافیت کامل و کمک به انتخاب بهینهترین مدل برای نیازهای پروژه است.
|
||||
</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>از میان مدلهای متعدد ارسالشده، هیچ مدل واحدی تمامی چهار قابلیت را بهطور کامل و همزمان با کیفیت بالا پوشش نمیدهد. با این حال، برای هر نیاز، گزینههای مشخص و برتری وجود دارد. نتیجه کلیدی این تحلیل به شرح زیر است:</p>
|
||||
|
||||
<div class="stats-grid">
|
||||
<div class="stat-card">
|
||||
<div class="stat-value">Bina 0.4<br>Koochik</div>
|
||||
<div class="stat-label">بهترین گزینه برای OCR فارسی</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-value">MiniCPM-o<br>4.5</div>
|
||||
<div class="stat-label">بهترین تعادل بین OCR، صوت و اجرای محلی</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-value">Qwen2.5<br>Omni</div>
|
||||
<div class="stat-label">قویترین گزینه برای تولید صوت چندزبانه</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="highlight-box">
|
||||
<strong>نتیجه کلیدی:</strong> برای پروژههایی که <strong>OCR فارسی</strong> اولویت اصلی است، مدل <strong>Bina 0.4 Koochik</strong> بهصورت تخصصی طراحی شده و بهترین عملکرد را دارد. برای نیاز همزمان به <strong>OCR، درک صوت و اجرای محلی</strong>، مدل <strong>MiniCPM-o 4.5</strong> گزینهای متعادل و قدرتمند است. اما اگر <strong>تولید صوت (TTS) چندزبانه</strong> حیاتی باشد، <strong>Qwen2.5-Omni</strong> (نسخه ۷B) پیشتاز است، هرچند پشتیبانی از فارسی در آن بهصراحت تأیید نشده است.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<div class="section-header">
|
||||
<div class="section-number">۲</div>
|
||||
<div class="section-title">
|
||||
<h3>معیارهای ارزیابی</h3>
|
||||
<div class="subtitle">Evaluation Criteria</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section-content">
|
||||
<p>چهار معیار اصلی برای مقایسه مدلها در نظر گرفته شده است:</p>
|
||||
<ul style="padding-right: 20px; margin-top: 10px;">
|
||||
<li style="margin-bottom: 8px;"><strong>پشتیبانی از زبان فارسی (Persian Support):</strong> توانایی درک و تولید متن فارسی بهصورت بومی یا از طریق آموزش تخصصی.</li>
|
||||
<li style="margin-bottom: 8px;"><strong>قابلیت OCR (Optical Character Recognition):</strong> توانایی استخراج متن از تصاویر، اسناد و صفحات وب، بهویژه متون فارسی.</li>
|
||||
<li style="margin-bottom: 8px;"><strong>تولید صوت (Speech Generation / TTS):</strong> توانایی تبدیل متن به گفتار طبیعی (Text-to-Speech).</li>
|
||||
<li style="margin-bottom: 8px;"><strong>اجرای محلی (Local Execution):</strong> امکان اجرا روی سختافزارهای محلی (CPU/GPU) با فرمتهای بهینه مانند GGUF و از طریق ابزارهایی مثل llama.cpp یا Ollama.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<div class="section-header">
|
||||
<div class="section-number">۳</div>
|
||||
<div class="section-title">
|
||||
<h3>جدول مقایسه جامع مدلها</h3>
|
||||
<div class="subtitle">Comprehensive Model Comparison</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section-content">
|
||||
<p>جدول زیر خلاصهای از وضعیت هر مدل را بر اساس چهار معیار اصلی نشان میدهد. (✓ = پشتیبانی کامل، ~ = پشتیبانی محدود یا غیرمستند، ✗ = بدون پشتیبانی)</p>
|
||||
|
||||
<table class="styled-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>مدل</th>
|
||||
<th>پشتیبانی فارسی</th>
|
||||
<th>OCR</th>
|
||||
<th>تولید صوت</th>
|
||||
<th>اجرای محلی</th>
|
||||
<th>نقاط قوت کلیدی</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><strong>LFM3-Omni-2B</strong></td>
|
||||
<td style="color: var(--warning);">~ (غیرمستند)</td>
|
||||
<td style="color: var(--success);">✓</td>
|
||||
<td style="color: var(--success);">✓</td>
|
||||
<td style="color: var(--success);">✓ (GGUF)</td>
|
||||
<td>سبک، Omni واقعی، TTS با کیفیت</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>MiniCPM-o-4.5</strong></td>
|
||||
<td style="color: var(--warning);">~ (چندزبانه)</td>
|
||||
<td style="color: var(--success);">✓ (قوی)</td>
|
||||
<td style="color: var(--success);">✓ (EN/ZH)</td>
|
||||
<td style="color: var(--success);">✓ (GGUF, Ollama)</td>
|
||||
<td>OCR پیشرو، صوت بلادرنگ، اجرای محلی عالی</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Qwen2.5-Omni-3B / 7B</strong></td>
|
||||
<td style="color: var(--warning);">~ (غیرمستند)</td>
|
||||
<td style="color: var(--success);">✓</td>
|
||||
<td style="color: var(--success);">✓ (چندزبانه)</td>
|
||||
<td style="color: var(--success);">✓ (GGUF)</td>
|
||||
<td>تولید صوت چندزبانه، درک ویدیو</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Bina 0.1 / 0.3 / 0.4 Koochik</strong></td>
|
||||
<td style="color: var(--success);">✓ (تخصصی)</td>
|
||||
<td style="color: var(--success);">✓ (فارسی)</td>
|
||||
<td style="color: var(--danger);">✗</td>
|
||||
<td style="color: var(--success);">✓ (GGUF, CoreML)</td>
|
||||
<td>بهترین OCR فارسی، سبک و بهینه</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>SenseNova-U1.5-8B-MoT</strong></td>
|
||||
<td style="color: var(--warning);">~ (غیرمستند)</td>
|
||||
<td style="color: var(--warning);">~ (تولید تصویر)</td>
|
||||
<td style="color: var(--danger);">✗</td>
|
||||
<td style="color: var(--warning);">~</td>
|
||||
<td>تمرکز بر تولید تصویر و متن، نه OCR/صوت</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Qwen3-Omni-Coder</strong></td>
|
||||
<td style="color: var(--warning);">~</td>
|
||||
<td style="color: var(--success);">✓ (32 زبان)</td>
|
||||
<td style="color: var(--success);">✓</td>
|
||||
<td style="color: var(--warning);">~</td>
|
||||
<td>OCR چندزبانه گسترده، کدنویسی</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Nemotron-3-Nano-Omni-30B</strong></td>
|
||||
<td style="color: var(--danger);">✗ (بهینه برای انگلیسی)</td>
|
||||
<td style="color: var(--success);">✓</td>
|
||||
<td style="color: var(--success);">✓ (ASR)</td>
|
||||
<td style="color: var(--success);">✓ (GGUF)</td>
|
||||
<td>درک ویدیو و صوت، OCR قوی</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>dots3-note-prev</strong></td>
|
||||
<td style="color: var(--warning);">~</td>
|
||||
<td style="color: var(--success);">✓</td>
|
||||
<td style="color: var(--danger);">✗ (فقط متن)</td>
|
||||
<td style="color: var(--warning);">~</td>
|
||||
<td>درک صوت و ویدیو، اما خروجی فقط متنی</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Ling-3.0-Flash-VL</strong></td>
|
||||
<td style="color: var(--warning);">~</td>
|
||||
<td style="color: var(--warning);">~</td>
|
||||
<td style="color: var(--danger);">✗</td>
|
||||
<td style="color: var(--warning);">~</td>
|
||||
<td>بینایی-زبانی، بدون تولید صوت</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Gemma-4-E2B-it (RK182X)</strong></td>
|
||||
<td style="color: var(--warning);">~</td>
|
||||
<td style="color: var(--success);">✓</td>
|
||||
<td style="color: var(--warning);">~ (ASR)</td>
|
||||
<td style="color: var(--success);">✓ (GGUF)</td>
|
||||
<td>OCR و درک صوت، مناسب لبه</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Nemotron-3.5-Bolt-E4B</strong></td>
|
||||
<td style="color: var(--warning);">~ (35 زبان)</td>
|
||||
<td style="color: var(--warning);">~</td>
|
||||
<td style="color: var(--danger);">✗ (فقط متن)</td>
|
||||
<td style="color: var(--success);">✓ (GGUF)</td>
|
||||
<td>سبک، چندزبانه، بدون تولید صوت</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="info-box">
|
||||
<strong>توجه:</strong> مدلهای «mythos»، «Lmlm»، «MLQarnonai» و «Mia-v1» در بررسیهای انجامشده، عمدتاً مدلهای متنی یا فاقد قابلیتهای چندوجهی مشخص (OCR/صوت) شناسایی شدند و در این مقایسه تخصصی جای نمیگیرند. همچنین برخی URLها تکراری بودند و مدلهای یکسانی را معرفی میکردند.
|
||||
</div>
|
||||
</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 Key Models</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section-content">
|
||||
|
||||
<h4 style="margin-top: 20px; color: var(--primary); font-size: 16px;">۴.۱. Bina 0.4 Koochik — قهرمان OCR فارسی</h4>
|
||||
<p>مدل <strong>Bina 0.4 Koochik</strong> یک مدل تصویر-به-متن با ۶۳۰ میلیون پارامتر است که بهطور اختصاصی برای <strong>رونویسی اسناد فارسی</strong> طراحی شده است. این مدل از معماری Nemotron-3.5-Parse مشتق شده و دارای ستون فقرات بینایی C-RADIOv4-SO400M است. نسخههای GGUF و CoreML آن برای اجرای محلی بهینه شدهاند و حتی در مرورگر با WebGPU قابل اجرا هستند. ارزیابیها نشان میدهد که این مدل در بنچمارک PersianOCR-TripleThreat عملکرد قابلقبولی دارد. اگر اولویت اصلی پروژه <strong>OCR فارسی</strong> باشد، Bina بدون شک بهترین انتخاب است.[reference:0][reference:1]</p>
|
||||
<div class="success-box">
|
||||
<strong>✓ مزیت کلیدی:</strong> تخصص کامل در OCR فارسی، اجرای محلی بسیار سبک (حتی روی CPU)، و وجود نسخههای کوانتیزه متعدد.
|
||||
</div>
|
||||
|
||||
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">۴.۲. MiniCPM-o 4.5 — متعادلترین گزینه</h4>
|
||||
<p>مدل <strong>MiniCPM-o 4.5</strong> یک مدل Omni-modal end-to-end است که همزمان قابلیت پردازش تصویر، ویدیو، صوت و متن را دارد. این مدل در <strong>OCR</strong> عملکرد بسیار قوی دارد (بهویژه برای اسناد انگلیسی) و در بنچمارک OmniDocBench از مدلهای تجاری پیشی گرفته است. همچنین از <strong>تولید صوت بلادرنگ</strong> (در زبانهای انگلیسی و چینی) پشتیبانی میکند و قابلیت <strong>اجرای محلی</strong> عالی با فرمتهای GGUF و Ollama دارد. هرچند پشتیبانی از فارسی در آن بهصراحت تأیید نشده، اما قابلیت چندزبانه آن (بیش از ۳۰ زبان) و توانایی OCR قوی، آن را به گزینهای مناسب برای پروژههای چندمنظوره تبدیل میکند.[reference:2]</p>
|
||||
<div class="highlight-box">
|
||||
<strong>نکته:</strong> اگر نیاز به ترکیبی از OCR، درک صوت و اجرای محلی دارید و میتوانید زبان فارسی را از طریق Fine-tune یا استفاده از مدلهای مکمل پوشش دهید، MiniCPM-o 4.5 انتخاب هوشمندانهای است.
|
||||
</div>
|
||||
|
||||
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">۴.۳. Qwen2.5-Omni (3B / 7B) — پیشتاز تولید صوت چندزبانه</h4>
|
||||
<p>مدل <strong>Qwen2.5-Omni</strong> از معماری Thinker-Talker استفاده میکند و توانایی درک همزمان متن، تصویر، صوت و ویدیو را دارد. این مدل در <strong>تولید صوت (TTS)</strong> و <strong>تبدیل گفتار به متن (ASR)</strong> چندزبانه بسیار قدرتمند است و در بنچمارکهای گفتاری رتبه بالایی دارد. نسخههای ۳B و ۷B آن با فرمت GGUF برای اجرای محلی در دسترس هستند. با این حال، پشتیبانی از <strong>زبان فارسی</strong> در مستندات رسمی آن بهصراحت ذکر نشده و تمرکز اصلی آن بر زبانهای انگلیسی و چینی است.[reference:3][reference:4]</p>
|
||||
<div class="warning-box">
|
||||
<strong>⚠️ محدودیت:</strong> در صورت نیاز به تولید صوت فارسی، باید پشتیبانی زبان فارسی در نسخههای آینده یا از طریق آموزش اضافی بررسی شود.
|
||||
</div>
|
||||
|
||||
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">۴.۴. LFM3-Omni-2B — گزینه سبک و Omni واقعی</h4>
|
||||
<p><strong>LFM3-Omni-2B</strong> یک مدل ۲.۱۷ میلیارد پارامتری است که بهصورت end-to-end طراحی شده و ورودیهای متنی، تصویری، ویدیویی و صوتی را پردازش کرده و خروجی متنی یا صوتی میدهد. این مدل برای <strong>اجرای روی دستگاههای لبه</strong> (مانند گوشی و لپتاپ) بهینه شده و از GGUF پشتیبانی میکند. در OCR و TTS عملکرد خوبی دارد، اما زبانهای پشتیبانیشده آن شامل فارسی نمیشود (حداقل در مستندات رسمی).[reference:5]</p>
|
||||
<div class="info-box">
|
||||
<strong>💡 کاربرد:</strong> اگر به دنبال یک مدل سبک با قابلیت Omni و اجرای محلی هستید و میتوانید فارسی را بهصورت جداگانه مدیریت کنید، LFM3-Omni-2B گزینه مناسبی است.
|
||||
</div>
|
||||
|
||||
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">۴.۵. Nemotron-3-Nano-Omni-30B — قدرت بالا، اما نه برای فارسی</h4>
|
||||
<p>این مدل از NVIDIA با ۳۰ میلیارد پارامتر (۳ میلیارد فعال) قابلیتهای چندوجهی گستردهای شامل OCR، درک ویدیو و رونویسی گفتار دارد. با این حال، بهینهسازی اصلی آن برای <strong>زبان انگلیسی</strong> است و زبان فارسی در فهرست زبانهای پشتیبانیشده آن بهطور مشخص ذکر نشده است.[reference:6]</p>
|
||||
<div class="warning-box">
|
||||
<strong>⚠️ هشدار:</strong> برای پروژههای فارسیمحور، استفاده از این مدل بدون Fine-tune توصیه نمیشود.
|
||||
</div>
|
||||
|
||||
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">۴.۶. سایر مدلها</h4>
|
||||
<ul style="padding-right: 20px; margin-top: 10px;">
|
||||
<li style="margin-bottom: 8px;"><strong>SenseNova-U1.5-8B-MoT:</strong> تمرکز اصلی آن بر تولید تصویر و متن است و قابلیت OCR یا تولید صوت ندارد.[reference:7]</li>
|
||||
<li style="margin-bottom: 8px;"><strong>Qwen3-Omni-Coder:</strong> OCR چندزبانه (۳۲ زبان) و قابلیت کدنویسی دارد، اما پشتیبانی از فارسی و تولید صوت آن بهطور کامل تأیید نشده است.[reference:8]</li>
|
||||
<li style="margin-bottom: 8px;"><strong>dots3-note-prev:</strong> توانایی درک صوت و ویدیو را دارد، اما خروجی آن <strong>فقط متنی</strong> است و تولید صوت نمیکند.[reference:9]</li>
|
||||
<li style="margin-bottom: 8px;"><strong>Ling-3.0-Flash-VL:</strong> یک مدل بینایی-زبانی است و تولید صوت ندارد.[reference:10]</li>
|
||||
<li style="margin-bottom: 8px;"><strong>Gemma-4-E2B-it (RK182X):</strong> از OCR و درک صوت پشتیبانی میکند و برای اجرای محلی مناسب است، اما فارسی در آن تأیید نشده است.[reference:11]</li>
|
||||
<li style="margin-bottom: 8px;"><strong>Nemotron-3.5-Bolt-E4B:</strong> مدلی سبک و چندزبانه (۳۵ زبان) است، اما <strong>تولید صوت ندارد</strong> و خروجی آن فقط متنی است.[reference:12]</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<div class="section-header">
|
||||
<div class="section-number">۵</div>
|
||||
<div class="section-title">
|
||||
<h3>ماتریس تصمیمگیری و پیشنهاد نهایی</h3>
|
||||
<div class="subtitle">Decision Matrix & Final Recommendation</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section-content">
|
||||
<p>بر اساس اولویتهای پروژه، پیشنهاد نهایی به شرح زیر است:</p>
|
||||
|
||||
<div class="comparison-grid">
|
||||
<div class="comparison-card recommended">
|
||||
<span class="card-badge">اولویت OCR فارسی</span>
|
||||
<h4>Bina 0.4 Koochik</h4>
|
||||
<ul>
|
||||
<li><span>پشتیبانی فارسی</span> <span class="value" style="color: var(--success);">تخصصی</span></li>
|
||||
<li><span>OCR</span> <span class="value" style="color: var(--success);">بسیار قوی</span></li>
|
||||
<li><span>تولید صوت</span> <span class="value" style="color: var(--danger);">ندارد</span></li>
|
||||
<li><span>اجرای محلی</span> <span class="value" style="color: var(--success);">عالی (GGUF)</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="comparison-card recommended">
|
||||
<span class="card-badge">تعادل همهجانبه</span>
|
||||
<h4>MiniCPM-o 4.5</h4>
|
||||
<ul>
|
||||
<li><span>پشتیبانی فارسی</span> <span class="value" style="color: var(--warning);">چندزبانه (غیرمستند)</span></li>
|
||||
<li><span>OCR</span> <span class="value" style="color: var(--success);">بسیار قوی</span></li>
|
||||
<li><span>تولید صوت</span> <span class="value" style="color: var(--success);">✓ (EN/ZH)</span></li>
|
||||
<li><span>اجرای محلی</span> <span class="value" style="color: var(--success);">عالی (GGUF/Ollama)</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="styled-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>اولویت پروژه</th>
|
||||
<th>پیشنهاد اول</th>
|
||||
<th>پیشنهاد جایگزین</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><strong>OCR فارسی با کیفیت بالا</strong></td>
|
||||
<td style="color: var(--success); font-weight: 600;">Bina 0.4 Koochik</td>
|
||||
<td>Bina 0.3 Koochik (سبکتر)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>OCR + درک صوت + اجرای محلی</strong></td>
|
||||
<td style="color: var(--success); font-weight: 600;">MiniCPM-o 4.5</td>
|
||||
<td>LFM3-Omni-2B (سبکتر)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>تولید صوت چندزبانه (TTS)</strong></td>
|
||||
<td style="color: var(--success); font-weight: 600;">Qwen2.5-Omni (7B)</td>
|
||||
<td>Qwen2.5-Omni (3B)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>OCR چندزبانه + کدنویسی</strong></td>
|
||||
<td style="color: var(--success); font-weight: 600;">Qwen3-Omni-Coder</td>
|
||||
<td>—</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>سبکترین گزینه با قابلیت Omni</strong></td>
|
||||
<td style="color: var(--success); font-weight: 600;">LFM3-Omni-2B</td>
|
||||
<td>Nemotron-3.5-Bolt-E4B (بدون TTS)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="conclusion-box">
|
||||
<h3>🎯 جمعبندی نهایی</h3>
|
||||
<p>هیچ مدل واحدی تمامی نیازها را پوشش نمیدهد، اما ترکیب هوشمندانه مدلها میتواند بهترین نتیجه را به همراه داشته باشد.</p>
|
||||
<p>برای <strong>OCR فارسی</strong> از <strong>Bina</strong> استفاده کنید. برای <strong>تولید صوت و درک چندوجهی</strong>، <strong>MiniCPM-o 4.5</strong> یا <strong>Qwen2.5-Omni</strong> گزینههای برتر هستند. اگر به دنبال یک راهحل یکپارچه هستید، <strong>MiniCPM-o 4.5</strong> بهترین تعادل را ارائه میدهد.</p>
|
||||
<div class="highlight">
|
||||
<strong>💎 توصیه نهایی:</strong><br>
|
||||
<strong>Bina 0.4 Koochik</strong> برای OCR فارسی + <strong>MiniCPM-o 4.5</strong> برای صوت و درک چندوجهی + اجرای محلی
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="info-box">
|
||||
<strong>📞 گام بعدی:</strong> در صورت تمایل به شروع همکاری، آماده برگزاری جلسه فنی جهت تشریح جزئیات، تست مدلها روی دادههای واقعی و انتخاب نهایی معماری هستیم.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<div class="section-header">
|
||||
<div class="section-number">۶</div>
|
||||
<div class="section-title">
|
||||
<h3>منابع و مستندات</h3>
|
||||
<div class="subtitle">References</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section-content">
|
||||
<ul class="reference-list">
|
||||
<li>
|
||||
<strong>Bina 0.4 Koochik — Hugging Face</strong>
|
||||
مدل تخصصی OCR فارسی
|
||||
<div class="ref-source">منبع: https://huggingface.co/Reza2kn/Bina-0.4-Koochik</div>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Bina 0.3 Koochik — Hugging Face</strong>
|
||||
نسخه سبکتر با عملکرد مشابه
|
||||
<div class="ref-source">منبع: https://huggingface.co/Reza2kn/Bina-0.3-Koochik</div>
|
||||
</li>
|
||||
<li>
|
||||
<strong>MiniCPM-o 4.5 — GitHub / Hugging Face</strong>
|
||||
مدل Omni-modal با OCR و صوت بلادرنگ
|
||||
<div class="ref-source">منبع: https://huggingface.co/openbmb/MiniCPM-o-4_5</div>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Qwen2.5-Omni — GitHub</strong>
|
||||
مدل چندوجهی با تولید صوت چندزبانه
|
||||
<div class="ref-source">منبع: https://github.com/QwenLM/Qwen2.5-Omni</div>
|
||||
</li>
|
||||
<li>
|
||||
<strong>LFM3-Omni-2B — Hugging Face</strong>
|
||||
مدل Omni سبک برای دستگاههای لبه
|
||||
<div class="ref-source">منبع: https://huggingface.co/LiquidAI/LFM3-Omni-2B</div>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Nemotron-3-Nano-Omni-30B — NVIDIA</strong>
|
||||
مدل چندوجهی با OCR و ASR
|
||||
<div class="ref-source">منبع: https://huggingface.co/nvidia/Nemotron-3-Nano-Omni-30B-A3B</div>
|
||||
</li>
|
||||
</ul>
|
||||
<p style="font-size: 12px; color: var(--text-muted); margin-top: 20px;">سایر مدلهای بررسیشده شامل dots3-note-prev، Ling-3.0-Flash-VL، Gemma-4-E2B-it و Nemotron-3.5-Bolt-E4B نیز بر اساس مستندات رسمی Hugging Face و GitHub ارزیابی شدهاند.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-info">
|
||||
این مستند محرمانه بوده و صرفاً جهت ارائه به کارفرمای محترم تهیه شده است. هرگونه کپیبرداری یا افشا بدون اجازه کتبی ممنوع است.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<footer class="document-footer">
|
||||
<div class="footer-brand">طراحی و توسعه: هادی خزاعی اصل</div>
|
||||
<div class="footer-divider"></div>
|
||||
<div>تاریخ تهیه: آذر ۱۴۰۵ | نسخه: ۱.۰ | طبقهبندی: محرمانه</div>
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,898 +0,0 @@
|
||||
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\Program.cs
|
||||
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace xAiMcpServer
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
//
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
|
||||
//
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args)
|
||||
{
|
||||
//
|
||||
var result = Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\Startup.cs
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using xAiMcpServer.DI;
|
||||
using Newtonsoft.Json;
|
||||
using System.Reflection;
|
||||
using xIdentityService.DI;
|
||||
using xCommons.Extensions;
|
||||
using xAiService.Extensions;
|
||||
using xCommons.Configurations;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using IdentityModel.AspNetCore.OAuth2Introspection;
|
||||
|
||||
namespace xAiMcpServer
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
//
|
||||
// Register MCP Handler ...
|
||||
services.AddXAiMcpHandler();
|
||||
|
||||
//
|
||||
// Register Validation Provider and all XCommons Module Services ...
|
||||
services.AddXCommons(Configuration);
|
||||
|
||||
//
|
||||
// Register App Configuration ...
|
||||
services.AddXAppConfiguration(Configuration);
|
||||
var appConfiguration = services.GetRegisteredService<XAppConfiguration>();
|
||||
|
||||
//
|
||||
// Register Allowed Origins ...
|
||||
services.AddXCors(appConfiguration.AllowedOrigins);
|
||||
|
||||
//
|
||||
// Register Swagger ...
|
||||
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
||||
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
|
||||
services.AddXSwagger(Configuration, xmlFilePath: xmlPath);
|
||||
|
||||
//
|
||||
// Add Api V1 Versioning ...
|
||||
services.AddXApiV1Versioning();
|
||||
|
||||
//
|
||||
// OAuthIntrospectin Http Client Handler ...
|
||||
// this is for handling SSLErrors ...
|
||||
services.AddHttpClient(OAuth2IntrospectionDefaults.BackChannelHttpClientName)
|
||||
.ConfigurePrimaryHttpMessageHandler(() =>
|
||||
{
|
||||
return new HttpClientHandler
|
||||
{
|
||||
ServerCertificateCustomValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true
|
||||
};
|
||||
});
|
||||
|
||||
//
|
||||
services.AddControllers()
|
||||
.AddNewtonsoftJson(x =>
|
||||
{
|
||||
x.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
|
||||
x.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
|
||||
});
|
||||
|
||||
//
|
||||
var lifeTime = ServiceLifetime.Scoped;
|
||||
|
||||
//
|
||||
// Register XIdentity Service ...
|
||||
services.AddXIdentityService(
|
||||
lifeTime: lifeTime,
|
||||
configuration: Configuration
|
||||
);
|
||||
|
||||
//
|
||||
// Register Authorizations ...
|
||||
services.AddXAuthorization();
|
||||
|
||||
//
|
||||
// Register MCP Tools in DI ...
|
||||
services.AddXAiMcpTools();
|
||||
}
|
||||
|
||||
public void Configure(
|
||||
IApplicationBuilder app,
|
||||
IWebHostEnvironment env
|
||||
)
|
||||
{
|
||||
//
|
||||
// Configure the HTTP request pipeline ...
|
||||
var isDevelopmentEnvironment = env.IsDevelopment();
|
||||
if (isDevelopmentEnvironment)
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
//
|
||||
// Force Https Redirection ...
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
//
|
||||
// Use Swagger Middleware (Only in Development) ...
|
||||
if (isDevelopmentEnvironment)
|
||||
{
|
||||
app.UseXSwagger();
|
||||
}
|
||||
|
||||
//
|
||||
// Using Cors (before Proxy so Browser Requests get CORS Headers) ...
|
||||
app.UseXCors();
|
||||
|
||||
//
|
||||
// Using Routing ...
|
||||
app.UseRouting();
|
||||
|
||||
//
|
||||
// Use xIdentityService (Authentication) ...
|
||||
app.UseXIdentityService();
|
||||
|
||||
//
|
||||
// Use Authorization ...
|
||||
app.UseAuthorization();
|
||||
|
||||
//
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\Controllers\McpController.cs
|
||||
|
||||
using xIdentityHelper;
|
||||
using System.Threading;
|
||||
using xCommons.Providers;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using xAiService.Interfaces;
|
||||
using System.Threading.Tasks;
|
||||
using xAiService.Controllers;
|
||||
using xCommons.Configurations;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using xIdentityService.Interfaces;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace xAiMcpServer.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class McpController : XAiMcpControllerBase
|
||||
{
|
||||
public McpController(
|
||||
IXAiMcpHandler mcpHandler,
|
||||
ILogger<McpController> logger,
|
||||
XAppConfiguration appConfiguration,
|
||||
IXIdentityProvider identityProvider,
|
||||
XValidationProvider validationProvider
|
||||
) : base(mcpHandler, appConfiguration, identityProvider, logger, validationProvider)
|
||||
{ }
|
||||
|
||||
//
|
||||
#region Override ...
|
||||
/// <summary>
|
||||
/// Handle MCP ...
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Authorize(Policy = XPolicies.EnabledUser)]
|
||||
public override async Task<IActionResult> HandleMcp(
|
||||
[FromBody] JObject request,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
var result = await base
|
||||
.HandleMcp(
|
||||
request: request,
|
||||
cancellationToken: cancellationToken
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle SSE EndPoint ...
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("sse")]
|
||||
[AllowAnonymous]
|
||||
public override async Task SseEndpoint(
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
await base
|
||||
.SseEndpoint(cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\Controllers\StartupController.cs
|
||||
|
||||
using xCommons.Providers;
|
||||
using xCommons.Controllers;
|
||||
using xCommons.Configurations;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace xAiApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Runing when application start ...
|
||||
/// </summary>
|
||||
[Route("")]
|
||||
[AllowAnonymous]
|
||||
public class StartupController : XBaseController
|
||||
{
|
||||
|
||||
public StartupController(
|
||||
ILogger<StartupController> logger,
|
||||
XAppConfiguration appConfiguration,
|
||||
XValidationProvider validationProvider
|
||||
) : base(
|
||||
logger,
|
||||
appConfiguration,
|
||||
validationProvider
|
||||
)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Show Configured Welcome Message
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("")]
|
||||
[AllowAnonymous]
|
||||
public virtual ActionResult<string> Index()
|
||||
{
|
||||
//
|
||||
var controllerName = GetControllerName();
|
||||
var message = $"{AppConfiguration.WelcomeMessage}";
|
||||
|
||||
//
|
||||
return Ok(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\Controllers\TestIdentity.cs
|
||||
|
||||
using xCommons.Providers;
|
||||
using xCommons.Configurations;
|
||||
using xIdentityHelper.Controllers;
|
||||
using xIdentityService.Interfaces;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace xAiMcpServer.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Test all Authentication Policies ...
|
||||
/// </summary>
|
||||
public class TestIdentity : XTestIdentityControllerBase {
|
||||
public TestIdentity (
|
||||
ILogger<TestIdentity> logger,
|
||||
XAppConfiguration appConfiguration,
|
||||
IXIdentityProvider identityProvider,
|
||||
XValidationProvider validationProvider
|
||||
) : base (
|
||||
logger,
|
||||
appConfiguration,
|
||||
identityProvider,
|
||||
validationProvider
|
||||
) { }
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\DI\DiExtensions.cs
|
||||
|
||||
using System.Linq;
|
||||
using xIdentityHelper;
|
||||
using xAiMcpServer.Tools;
|
||||
using xCommons.Extensions;
|
||||
using xCommons.Authorization;
|
||||
using System.Collections.Generic;
|
||||
using xIdentityService.Interfaces;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace xAiMcpServer.DI
|
||||
{
|
||||
public static class DiExtensions
|
||||
{
|
||||
public static void AddXAuthorization(
|
||||
this IServiceCollection services,
|
||||
IDictionary<string, AuthorizationPolicy> policies = null
|
||||
)
|
||||
{
|
||||
//
|
||||
var policyHandler = services.GetRegisteredService<IXPolicyHandler>();
|
||||
services.AddAuthorization(options =>
|
||||
{
|
||||
//
|
||||
if (!policies.IsNull())
|
||||
{
|
||||
//
|
||||
// Fill Policies ...
|
||||
using (var policiesEnumerator = policies.GetEnumerator())
|
||||
{
|
||||
while (policiesEnumerator.MoveNext())
|
||||
{
|
||||
var policyDescriptor = policiesEnumerator.Current;
|
||||
options.AddPolicy(policyDescriptor.Key, policyDescriptor.Value);
|
||||
|
||||
//
|
||||
// Add Policy to Policy Handler ...
|
||||
if (!policyHandler.IsNull())
|
||||
{
|
||||
//
|
||||
// Check Policy is RequiredRole Policy ...
|
||||
var roleRequirements = policyDescriptor.Value.Requirements
|
||||
.OfType<RequiredRolesRequirement>()
|
||||
.FirstOrDefault();
|
||||
if (!roleRequirements.IsNull() &&
|
||||
roleRequirements.Roles.HasChild())
|
||||
{
|
||||
//
|
||||
policyHandler.AddPolicy(
|
||||
policy: policyDescriptor.Key.ToNormalString(),
|
||||
requiredRoles: roleRequirements.Roles.Select(r => r.ToNormalString())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
var xPolicies = XAuthorizationHelper.GetXAuthorizationPolicies();
|
||||
if (!xPolicies.IsNull())
|
||||
{
|
||||
//
|
||||
// Fill Policies ...
|
||||
using (var policiesEnumerator = xPolicies.GetEnumerator())
|
||||
{
|
||||
while (policiesEnumerator.MoveNext())
|
||||
{
|
||||
//
|
||||
var policyDescriptor = policiesEnumerator.Current;
|
||||
|
||||
//
|
||||
// Add Policy to Authorization ...
|
||||
options.AddPolicy(policyDescriptor.Key, policyDescriptor.Value);
|
||||
|
||||
//
|
||||
// Add Policy to Policy Handler ...
|
||||
if (!policyHandler.IsNull())
|
||||
{
|
||||
//
|
||||
// Check Policy is RequiredRole Policy ...
|
||||
var roleRequirements = policyDescriptor.Value.Requirements
|
||||
.OfType<RequiredRolesRequirement>()
|
||||
.FirstOrDefault();
|
||||
if (!roleRequirements.IsNull() &&
|
||||
roleRequirements.Roles.HasChild())
|
||||
{
|
||||
//
|
||||
policyHandler.AddPolicy(
|
||||
policy: policyDescriptor.Key.ToNormalString(),
|
||||
requiredRoles: roleRequirements.Roles.Select(r => r.ToNormalString())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
services.AddSingleton<IAuthorizationHandler, RequiredRolesHandler>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use Forward Headers Options for resolving behind a proxy issues ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static void UseXForwardOptions(this IApplicationBuilder source)
|
||||
{
|
||||
//
|
||||
var forwardOptions = new ForwardedHeadersOptions
|
||||
{
|
||||
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto,
|
||||
RequireHeaderSymmetry = false
|
||||
};
|
||||
|
||||
//
|
||||
forwardOptions.KnownNetworks.Clear();
|
||||
forwardOptions.KnownProxies.Clear();
|
||||
|
||||
//
|
||||
// ref: https://github.com/aspnet/Docs/issues/2384
|
||||
source.UseForwardedHeaders(forwardOptions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register Tools which required Dependency Injection Services ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
public static void AddXAiMcpTools(this IServiceCollection source)
|
||||
{
|
||||
//
|
||||
source.AddScoped<XUserTools>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\Tools\XDateTools.cs
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using TimeZoneConverter;
|
||||
using xCommons.Extensions;
|
||||
using System.Globalization;
|
||||
using xAiModels.Attributes;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace xAiMcpServer.Tools
|
||||
{
|
||||
[XAiMcpToolType]
|
||||
public class XDateTools
|
||||
{
|
||||
[XAiMcpTool(Description = "Get the CURRENT date and time right now. Use this tool whenever the user asks about 'today', 'now', 'current date', 'current time', or when you need the current date/time for any relative calculation (like 'three days ago', 'next week', 'how many days until...'). Returns Gregorian, Persian (Jalali), day-of-week, and Unix timestamp.")]
|
||||
public static string GetCurrentDateTime(
|
||||
[XAiMcpToolParam(Description = "Optional IANA timezone (e.g. 'Asia/Tehran', 'UTC', 'Europe/London'). Defaults to 'Asia/Tehran'.", Required = false)]
|
||||
string timezone = null
|
||||
)
|
||||
{
|
||||
try
|
||||
{
|
||||
var tz = ResolveTimezone(timezone ?? "Asia/Tehran");
|
||||
var nowUtc = DateTime.UtcNow;
|
||||
var nowLocal = TimeZoneInfo.ConvertTimeFromUtc(nowUtc, tz);
|
||||
|
||||
var pc = new PersianCalendar();
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine($"Timezone: {tz.Id}");
|
||||
sb.AppendLine($"Local: {nowLocal:yyyy-MM-dd HH:mm:ss} {nowLocal:dddd}");
|
||||
sb.AppendLine($"UTC: {nowUtc:yyyy-MM-dd HH:mm:ss} UTC");
|
||||
sb.AppendLine($"Persian: {pc.GetYear(nowLocal):D4}/{pc.GetMonth(nowLocal):D2}/{pc.GetDayOfMonth(nowLocal):D2} {nowLocal:HH:mm:ss}");
|
||||
sb.AppendLine($"ISO 8601: {nowLocal:yyyy-MM-ddTHH:mm:ss.fffzzz}");
|
||||
sb.AppendLine($"Unix: {new DateTimeOffset(nowUtc).ToUnixTimeSeconds()}");
|
||||
sb.AppendLine($"Week: {ISOWeek.GetWeekOfYear(nowLocal)} (of {nowLocal.Year})");
|
||||
return sb.ToString().TrimEnd();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return $"Error: {ex.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
[XAiMcpTool(Description = "Detect and extract all date-like patterns from a free text. Supports Gregorian (2024-11-05), Persian (1403/08/15), Hijri (1446/05/03), ISO 8601, and month-name forms.")]
|
||||
public static string DetectDates(
|
||||
[XAiMcpToolParam(Description = "Free text that may contain dates.")]
|
||||
string text,
|
||||
[XAiMcpToolParam(Description = "Optional: hint for the primary calendar (Gregorian, Persian, Hijri). Leave empty for auto-detection.", Required = false)]
|
||||
string calendarHint = null
|
||||
)
|
||||
{
|
||||
//
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
return "No text provided.";
|
||||
}
|
||||
|
||||
//
|
||||
var patterns = new (string Name, Regex Pattern)[]
|
||||
{
|
||||
("ISO8601", new Regex(@"\b\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?\b")),
|
||||
("NumericYMD", new Regex(@"\b\d{4}[/\-\.]\d{1,2}[/\-\.]\d{1,2}\b")),
|
||||
("NumericDMY", new Regex(@"\b\d{1,2}[/\-\.]\d{1,2}[/\-\.]\d{2,4}\b")),
|
||||
("PersianMonth", new Regex(@"\b\d{1,2}\s+(فروردین|اردیبهشت|خرداد|تیر|مرداد|شهریور|مهر|آبان|آذر|دی|بهمن|اسفند)\s+\d{4}\b")),
|
||||
("EnglishMonth", new Regex(@"\b\d{1,2}\s+(January|February|March|April|May|June|July|August|September|October|November|December)\s+\d{4}\b", RegexOptions.IgnoreCase)),
|
||||
};
|
||||
|
||||
//
|
||||
var found = new List<string>();
|
||||
var sb = new StringBuilder();
|
||||
foreach (var (name, pattern) in patterns)
|
||||
{
|
||||
//
|
||||
foreach (Match m in pattern.Matches(text))
|
||||
{
|
||||
//
|
||||
if (!found.Contains(m.Value))
|
||||
{
|
||||
//
|
||||
found.Add(m.Value);
|
||||
sb.AppendLine($"• {m.Value} [{name}]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return found.Count == 0
|
||||
? "No date pattern detected."
|
||||
: $"Detected {found.Count} date(s):\n{sb.ToString().TrimEnd()}";
|
||||
}
|
||||
|
||||
[XAiMcpTool(Description = "Parse a single date string. Returns the detected calendar, plus normalized Gregorian (ISO 8601), Persian, Hijri representations, and Unix timestamp.")]
|
||||
public static string ParseDate(
|
||||
[XAiMcpToolParam(Description = "Date string like '1403/08/15' or '2024-11-05'.")]
|
||||
string date,
|
||||
[XAiMcpToolParam(Description = "Optional: calendar hint (Gregorian, Persian, Hijri). Leave empty for auto-detect.", Required = false)]
|
||||
string calendarHint = null
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
var dt = ParseDateToGregorian(date, calendarHint);
|
||||
return BuildReport(dt);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return $"Error: {ex.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
[XAiMcpTool(Description = "Convert a date from one calendar to another. Supported calendars: Gregorian, Persian (Jalali/Shamsi), Hijri (Islamic).")]
|
||||
public static string ConvertDate(
|
||||
[XAiMcpToolParam(Description = "Date string in the source calendar.")]
|
||||
string date,
|
||||
[XAiMcpToolParam(Description = "Source calendar: Gregorian, Persian, or Hijri.")]
|
||||
string fromCalendar,
|
||||
[XAiMcpToolParam(Description = "Target calendar: Gregorian, Persian, or Hijri.")]
|
||||
string toCalendar
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
var greg = ParseDateToGregorian(date, fromCalendar);
|
||||
var target = NormalizeCalendarName(toCalendar);
|
||||
var cal = GetCalendar(target);
|
||||
|
||||
//
|
||||
return $"{cal.GetYear(greg):D4}/{cal.GetMonth(greg):D2}/{cal.GetDayOfMonth(greg):D2}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return $"Error: {ex.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
[XAiMcpTool(Description = "Calculate the difference between two dates. Returns total days, and a breakdown into years/months/days.")]
|
||||
public static string DateDifference(
|
||||
[XAiMcpToolParam(Description = "First date string.")]
|
||||
string date1,
|
||||
[XAiMcpToolParam(Description = "Second date string.")]
|
||||
string date2,
|
||||
[XAiMcpToolParam(Description = "Optional: calendar hint for both dates.", Required = false)]
|
||||
string calendarHint = null
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
var d1 = ParseDateToGregorian(date1, calendarHint);
|
||||
var d2 = ParseDateToGregorian(date2, calendarHint);
|
||||
var span = d2 - d1;
|
||||
|
||||
//
|
||||
return $"Difference: {span.Days} days (= {span.Days / 365} years + {(span.Days % 365) / 30} months + {(span.Days % 365) % 30} days)";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return $"Error: {ex.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
[XAiMcpTool(Description = "Convert a date string to Unix timestamp (seconds since 1970-01-01 UTC).")]
|
||||
public static string ToUnixTimestamp(
|
||||
[XAiMcpToolParam(Description = "Date string.")]
|
||||
string date,
|
||||
[XAiMcpToolParam(Description = "Optional: calendar hint (Gregorian, Persian, Hijri).", Required = false)]
|
||||
string calendarHint = null
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
var dt = ParseDateToGregorian(date, calendarHint);
|
||||
var ts = new DateTimeOffset(dt, TimeSpan.Zero).ToUnixTimeSeconds();
|
||||
|
||||
//
|
||||
return ts.ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return $"Error: {ex.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
[XAiMcpTool(Description = "Convert a Unix timestamp (seconds since 1970-01-01 UTC) back to a date string in the specified calendar.")]
|
||||
public static string FromUnixTimestamp(
|
||||
[XAiMcpToolParam(Description = "Unix timestamp in seconds.")]
|
||||
long timestamp,
|
||||
[XAiMcpToolParam(Description = "Optional: target calendar (Gregorian, Persian, Hijri). Defaults to Gregorian.", Required = false)]
|
||||
string targetCalendar = null
|
||||
)
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
var dt = DateTimeOffset.FromUnixTimeSeconds(timestamp).UtcDateTime;
|
||||
var calName = NormalizeCalendarName(targetCalendar) ?? "Gregorian";
|
||||
if (calName == "Gregorian")
|
||||
{
|
||||
return dt.ToString("yyyy-MM-dd HH:mm:ss 'UTC'");
|
||||
}
|
||||
|
||||
//
|
||||
var c = GetCalendar(calName);
|
||||
return $"{c.GetYear(dt):D4}/{c.GetMonth(dt):D2}/{c.GetDayOfMonth(dt):D2}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return $"Error: {ex.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
#region Private ...
|
||||
private static string BuildReport(DateTime greg)
|
||||
{
|
||||
//
|
||||
var pc = new PersianCalendar();
|
||||
var hc = new UmAlQuraCalendar();
|
||||
var sb = new StringBuilder();
|
||||
|
||||
//
|
||||
sb.AppendLine($"Gregorian: {greg:yyyy-MM-dd}");
|
||||
sb.AppendLine($"Persian: {pc.GetYear(greg):D4}/{pc.GetMonth(greg):D2}/{pc.GetDayOfMonth(greg):D2}");
|
||||
sb.AppendLine($"Hijri: {hc.GetYear(greg):D4}/{hc.GetMonth(greg):D2}/{hc.GetDayOfMonth(greg):D2}");
|
||||
sb.AppendLine($"ISO 8601: {greg:yyyy-MM-ddTHH:mm:ss.fffZ}");
|
||||
sb.AppendLine($"Unix: {new DateTimeOffset(greg, TimeSpan.Zero).ToUnixTimeSeconds()}");
|
||||
|
||||
//
|
||||
return sb.ToString().TrimEnd();
|
||||
}
|
||||
|
||||
private static DateTime ParseDateToGregorian(string date, string calendarHint)
|
||||
{
|
||||
//
|
||||
if (string.IsNullOrWhiteSpace(date))
|
||||
{
|
||||
throw new ArgumentException("date is empty");
|
||||
}
|
||||
|
||||
//
|
||||
var m = Regex.Match(date.Trim(), @"^(?<y>\d{4})[/\-\.](?<m>\d{1,2})[/\-\.](?<d>\d{1,2})$");
|
||||
if (!m.Success)
|
||||
{
|
||||
throw new FormatException($"Unrecognized date format: '{date}'. Expected yyyy/MM/dd.");
|
||||
}
|
||||
|
||||
//
|
||||
var y = int.Parse(m.Groups["y"].Value);
|
||||
var mo = int.Parse(m.Groups["m"].Value);
|
||||
var d = int.Parse(m.Groups["d"].Value);
|
||||
|
||||
//
|
||||
var calName = NormalizeCalendarName(calendarHint) ?? AutoDetectCalendar(y);
|
||||
return calName switch
|
||||
{
|
||||
//
|
||||
"Gregorian" => new DateTime(y, mo, d),
|
||||
"Persian" => new PersianCalendar().ToDateTime(y, mo, d, 0, 0, 0, 0),
|
||||
"Hijri" => new UmAlQuraCalendar().ToDateTime(y, mo, d, 0, 0, 0, 0),
|
||||
_ => throw new ArgumentException($"Unknown calendar: {calendarHint}")
|
||||
};
|
||||
}
|
||||
|
||||
private static string NormalizeCalendarName(string name)
|
||||
{
|
||||
//
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
//
|
||||
var n = name.Trim().ToLowerInvariant();
|
||||
return n switch
|
||||
{
|
||||
//
|
||||
"gregorian" or "میلادی" or "g" => "Gregorian",
|
||||
"persian" or "jalali" or "shamsi" or "شمسی" or "جلالی" or "p" => "Persian",
|
||||
"hijri" or "islamic" or "قمری" or "هجری" or "h" => "Hijri",
|
||||
_ => throw new ArgumentException($"Unknown calendar: {name}. Use Gregorian, Persian, or Hijri.")
|
||||
};
|
||||
}
|
||||
|
||||
private static string AutoDetectCalendar(int year)
|
||||
{
|
||||
//
|
||||
if (year >= 1900 && year <= 2100)
|
||||
{
|
||||
return "Gregorian";
|
||||
}
|
||||
|
||||
//
|
||||
if (year >= 1300 && year <= 1499)
|
||||
{
|
||||
return "Persian";
|
||||
}
|
||||
|
||||
//
|
||||
return "Gregorian";
|
||||
}
|
||||
|
||||
private static TimeZoneInfo ResolveTimezone(string timezoneId)
|
||||
{
|
||||
//
|
||||
if (timezoneId.IsNullOrEmpty())
|
||||
{
|
||||
timezoneId = "UTC";
|
||||
}
|
||||
|
||||
//
|
||||
try
|
||||
{
|
||||
return TZConvert.GetTimeZoneInfo(timezoneId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return TimeZoneInfo.Utc;
|
||||
}
|
||||
}
|
||||
|
||||
private static Calendar GetCalendar(string name) => name switch
|
||||
{
|
||||
//
|
||||
"Gregorian" => new GregorianCalendar(),
|
||||
"Persian" => new PersianCalendar(),
|
||||
"Hijri" => new UmAlQuraCalendar(),
|
||||
_ => throw new ArgumentException($"Unknown calendar: {name}")
|
||||
};
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\Tools\XEchoTools.cs
|
||||
|
||||
|
||||
using xAiModels.Attributes;
|
||||
|
||||
namespace xAiMcpServer.Tools
|
||||
{
|
||||
[XAiMcpToolType]
|
||||
public static class XEchoTools
|
||||
{
|
||||
[XAiMcpTool(Description = "Echoes the string back to the client give message in string")]
|
||||
public static string Echo(
|
||||
[XAiMcpToolParam(Description = "string value which specified message")]
|
||||
string message
|
||||
)
|
||||
{
|
||||
//
|
||||
var result = $"hello {message}";
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
### FILE: C:\Users\saherelm\Documents\Projects\xSaherelmWorkspace\xAiMcpServer\Tools\XUserTools.cs
|
||||
|
||||
using xIdentityHelper;
|
||||
using xModels.Extensions;
|
||||
using xCommons.Extensions;
|
||||
using xAiModels.Attributes;
|
||||
using xAiService.Interfaces;
|
||||
using System.Threading.Tasks;
|
||||
using xIdentityService.Interfaces;
|
||||
|
||||
namespace xAiMcpServer.Tools
|
||||
{
|
||||
[XAiMcpToolType]
|
||||
public class XUserTools
|
||||
{
|
||||
//
|
||||
private readonly IXPersonService personService;
|
||||
private readonly IXAiMcpUserContext userContext;
|
||||
|
||||
public XUserTools(
|
||||
IXAiMcpUserContext userContext,
|
||||
IXPersonService personService
|
||||
)
|
||||
{
|
||||
//
|
||||
this.userContext = userContext;
|
||||
this.personService = personService;
|
||||
}
|
||||
|
||||
[XAiMcpTool(
|
||||
RequiresAuthentication = true,
|
||||
RequiredPolicy = XPolicies.EnabledUser,
|
||||
Description = "Get information about the currently logged-in user.")]
|
||||
public async Task<string> WhoAmI()
|
||||
{
|
||||
//
|
||||
var user = userContext.UserInfo;
|
||||
if (user.IsNullOrDefault())
|
||||
{
|
||||
return "Anonymous";
|
||||
}
|
||||
|
||||
//
|
||||
var person = await personService.GetPerson(user.UserId);
|
||||
|
||||
//
|
||||
return person?.GetFullname() ?? user.UserId;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+198
-198
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -15,9 +15,9 @@ Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"accessToken": "C9B72BA11F1D9562AB0AA0C4DBECAAE459941BDB0C532FC82739C1E0C39EA5FD",
|
||||
"refreshToken": "4FD4FD2BC4393F8D6314AA97DE8FD32EFD6AD3BD01E837EF72F9006CA9E33271",
|
||||
"expiresAt": 1794001216
|
||||
"accessToken": "905F846AB87139ED016A54A2A59628B4C32FA4629C5C233B026F9C8D56234882",
|
||||
"refreshToken": "C840D444EC1823800976AD4E17C64D47E9099BFDC18702117F71246F5F912BEB",
|
||||
"expiresAt": 1794081865
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
+1
-1
Submodule xAiMcpServer updated: 6e4ce28832...1b09b4f6a0
Reference in New Issue
Block a user