{% extends "ewoooc_base.html" %} {% block title %}RAG Promotion Gate{% endblock %} {% block ewooo_content %} {% set total_dist = (episode_distribution_30d.values() | sum) if episode_distribution_30d else 0 %} {% set approved_30d = episode_distribution_30d.get('approved', 0) if episode_distribution_30d else 0 %} {% set rejected_30d = namespace(value=0) %} {% if episode_distribution_30d %}{% for status, cnt in episode_distribution_30d.items() %}{% if status.startswith('rejected') %}{% set rejected_30d.value = rejected_30d.value + cnt %}{% endif %}{% endfor %}{% endif %} {% set approval_rate = (approved_30d / total_dist * 100) if total_dist > 0 else 0 %}
RAG Promotion Gate · Human Review / Dedup / Anti-pollution

RAG 知識晉升閘

這頁是 RAG 不被污染的最後關卡。高權重 learning episode 不能直接進知識庫,必須先看品質、相似知識、人工拒絕與晉升分布,再決定是否寫入 ai_insights。

Awaiting Review
{{ episodes|length }}高權重待審片段
Knowledge Base
{{ kb_size or 0 }}ai_insights 已晉升
30d Approval
{{ "%.0f"|format(approval_rate) }}%{{ approved_30d }}/{{ total_dist }} episodes
Rejected 30d
{{ rejected_30d.value }}品質 / 幻覺 / 重複 / 人工拒
{% if error %}
{{ error }}
{% endif %}
Review Queue

待審核片段

{{ episodes|length }} 筆

PromotionGate Stage 4:weight ≥ 0.8 必經統帥審核;24 小時無回應自動降權,不直接污染知識庫。

{% if episodes %} {% for ep in episodes %}
學習片段 #{{ ep.id }} {{ ep.episode_type }}{% if ep.source_table %}{{ ep.source_table }}#{{ ep.source_id }}{% endif %}權重 {{ "%.2f"|format(ep.weight) }}品質 {{ "%.2f"|format(ep.quality_score) }}
{{ ep.created_at }}
{{ ep.distilled_text }}
{% if ep.similar_insights %}
Top 3 相似已晉升知識(用來判斷是否重複)
    {% for sim in ep.similar_insights %}
  • #{{ sim.id }}{{ sim.insight_type }}相似度 {{ "%.2f"|format(sim.similarity) }}{{ sim.content }}{% if sim.content|length >= 180 %}…{% endif %}
  • {% endfor %}
{% else %}
知識庫無 cosine ≥ 0.7 相似內容,可能是新領域知識。
{% endif %}
{% endfor %} {% else %}
目前無待審核片段。
{% endif %}
{% if latest_insights %}
Knowledge Base

最近 10 筆 ai_insights

{% for i in latest_insights %}{% endfor %}
#類型期間SKU建立時間預覽
#{{ i.id }}{{ i.insight_type }}{{ i.period or '—' }}{{ i.product_sku or '—' }}{{ i.created_at }}{{ i.preview }}{% if i.preview|length >= 160 %}…{% endif %}
{% endif %}

Operation Ollama-First v5.0 — RAG 知識晉升閘

{% endblock %}