forge
Explore
Log in

Don't you dare go Hollow

Randevu/yemek/soru-havuzu/beyaz-tahta tam intent desteği (feat/t1-coverage entegrasyonu)

Browse files at this commit

2612c1941921c0439cf5d18bb40495e7323978e1Kadir YönakParent: 0b6d3ae
  • feat
    • randevu/yemek/soru-havuzu/beyaz-tahta tam intent desteği (feat/t1-coverage entegrasyonu)
Show full message
feat(t1): randevu/yemek/soru-havuzu/beyaz-tahta tam intent desteği (feat/t1-coverage entegrasyonu)

11 T1 intent'i güncel main'e entegre edildi (feature_info stopgap yerine gerçek how-to
+ rol-gating + buton):
- Randevu: appointment_book (öğrenci/veli), _slot_open/_requests (öğretmen+)
- Yemek: meal_view (herkes), meal_book (öğrenci/veli), meal_menu_manage (yönetici+)
- Soru havuzu: question_ask/_solve (öğrenci+, veli hariç), _approve (öğretmen+) -> /questions
  (sınav 'Soru bankası'/question-bank'ten AYRI; ayrım netleştirildi)
- Beyaz tahta: board_view/_create (öğrenci+, veli hariç)

catalog+rules+role_spaces+INTENT_ROUTES+ROUTE_LABELS+RULE_ONLY (TF-IDF kirletmesin)+
behavior_matrix+benchmark(+33). _FEATURE_INFO kaldırıldı; yanlış 'havuz->soru bankası'
eşlemesi düzeltildi. 78 intent, 373 test yeşil, macro-F1 0.992, adversarial %99.1,
seçici risk %0, mutation %100.
data/benchmark.jsonlmodified+33 -0
@@ -223,3 +223,36 @@
223 {"question": "Ders dosyaları hangi sayfada?", "expected_intent": "course_materials_info", "role": "ogrenci"}223 {"question": "Ders dosyaları hangi sayfada?", "expected_intent": "course_materials_info", "role": "ogrenci"}
224 {"question": "Öğretmenin PDF dosyaları nerede?", "expected_intent": "course_materials_info", "role": "ogrenci"}224 {"question": "Öğretmenin PDF dosyaları nerede?", "expected_intent": "course_materials_info", "role": "ogrenci"}
225 {"question": "Ders notu dosyalarını nereden indiririm?", "expected_intent": "course_materials_info", "role": "ogrenci"}225 {"question": "Ders notu dosyalarını nereden indiririm?", "expected_intent": "course_materials_info", "role": "ogrenci"}
226+{"question": "Nasıl randevu alabilirim", "expected_intent": "appointment_book", "role": "ogrenci"}
227+{"question": "Randevu almak için ne yapmalıyım", "expected_intent": "appointment_book", "role": "veli"}
228+{"question": "Yeni bir randevu talebi oluşturayım", "expected_intent": "appointment_book", "role": "ogrenci"}
229+{"question": "Öğrencilere randevu saatleri açmak istiyorum", "expected_intent": "appointment_slot_open", "role": "ogretmen"}
230+{"question": "Müsait saatlerimi nasıl yayınlarım", "expected_intent": "appointment_slot_open", "role": "ogretmen"}
231+{"question": "Randevu için boş saat eklemek istiyorum", "expected_intent": "appointment_slot_open", "role": "ogretmen"}
232+{"question": "Gelen randevu taleplerini nasıl onaylarım", "expected_intent": "appointment_requests", "role": "ogretmen"}
233+{"question": "Randevu isteklerini nereden yönetirim", "expected_intent": "appointment_requests", "role": "ogretmen"}
234+{"question": "Bir randevu talebini kabul etmek istiyorum", "expected_intent": "appointment_requests", "role": "ogretmen"}
235+{"question": "Yemek menüsünü nereden görebilirim", "expected_intent": "meal_view", "role": "ogrenci"}
236+{"question": "Öğün menüsünü görmek istiyorum", "expected_intent": "meal_view", "role": "veli"}
237+{"question": "Haftalık yemek listesi nerede", "expected_intent": "meal_view", "role": "ogrenci"}
238+{"question": "Öğle yemeği için yer ayırmak istiyorum", "expected_intent": "meal_book", "role": "ogrenci"}
239+{"question": "Menüden yemek rezerve etmek istiyorum", "expected_intent": "meal_book", "role": "veli"}
240+{"question": "Öğün için yer ayırtmak istiyorum", "expected_intent": "meal_book", "role": "ogrenci"}
241+{"question": "Yeni yemek menüsü yayınlamak istiyorum", "expected_intent": "meal_menu_manage", "role": "yonetici"}
242+{"question": "Öğüne yeni yemek eklemek istiyorum", "expected_intent": "meal_menu_manage", "role": "yonetici"}
243+{"question": "Öğrenci yemek kredisi girmek istiyorum", "expected_intent": "meal_menu_manage", "role": "yonetici"}
244+{"question": "Soru havuzunda soru sormak istiyorum", "expected_intent": "question_ask", "role": "ogrenci"}
245+{"question": "Takıldığım soruyu havuza nasıl sorarım", "expected_intent": "question_ask", "role": "ogrenci"}
246+{"question": "Soru havuzuna soru göndermek istiyorum", "expected_intent": "question_ask", "role": "ogrenci"}
247+{"question": "Zor bir soruya çözüm göndermek istiyorum", "expected_intent": "question_solve", "role": "ogrenci"}
248+{"question": "Bir soruya çözüm önerisi yapmak istiyorum", "expected_intent": "question_solve", "role": "ogrenci"}
249+{"question": "Havuzdaki soruyu çözmek istiyorum", "expected_intent": "question_solve", "role": "ogrenci"}
250+{"question": "Bekleyen havuz sorularını onaylayayım", "expected_intent": "question_approve", "role": "ogretmen"}
251+{"question": "Öğrenci sorularını nasıl onaylarım", "expected_intent": "question_approve", "role": "ogretmen"}
252+{"question": "Havuzdaki bir soruyu reddetmek istiyorum", "expected_intent": "question_approve", "role": "ogretmen"}
253+{"question": "Beyaz tahta listesini nereden görürüm", "expected_intent": "board_view", "role": "ogrenci"}
254+{"question": "Bir tahtayı nasıl açarım", "expected_intent": "board_view", "role": "ogrenci"}
255+{"question": "Var olan tahtaları nasıl görürüm", "expected_intent": "board_view", "role": "ogretmen"}
256+{"question": "Beyaz tahta oluşturmak istiyorum", "expected_intent": "board_create", "role": "ogrenci"}
257+{"question": "Yeni bir çizim tahtası oluşturayım", "expected_intent": "board_create", "role": "ogrenci"}
258+{"question": "Yeni beyaz tahta eklemek istiyorum", "expected_intent": "board_create", "role": "ogretmen"}
src/catalog.pymodified+269 -0
@@ -1599,6 +1599,253 @@ INTENTS: Final[list[dict[str, Any]]] = [
1599 ],1599 ],
1600 "must_not_match": ["note_create", "report_card_view"],1600 "must_not_match": ["note_create", "report_card_view"],
1601 },1601 },
1602+ # --- Randevu (T1; frontend /appointments, "Randevular" menüsü) ------------
1603+ {
1604+ "intent": "appointment_book",
1605+ "category": "appointments",
1606+ "description": "Öğrenci/velinin randevu alması.",
1607+ "response_id": "appointment_book_instructions",
1608+ "response_template": (
1609+ "Randevu almak için **Planlama** grubundaki **Randevular** "
1610+ "(`/appointments`) sayfasına git. **Öğretmenlerin açık saatleri** "
1611+ "bölümünden uygun saati seç, **Randevu al**'a bas. Talebin "
1612+ "**Randevularım** altında görünür ve öğretmen onayına düşer. Randevu "
1613+ "alma yalnızca Öğrenci ve Veli'ye açıktır."
1614+ ),
1615+ "auth_required": True,
1616+ "min_role": "veli",
1617+ "example_questions": [
1618+ "Randevu nasıl alırım?",
1619+ "Öğretmenden randevu almak istiyorum",
1620+ "Randevu talebi oluşturmak istiyorum",
1621+ "Görüşme randevusu talep etmek istiyorum",
1622+ "Randevu alma nerede?",
1623+ ],
1624+ "must_not_match": ["appointment_slot_open", "appointment_requests"],
1625+ },
1626+ {
1627+ "intent": "appointment_slot_open",
1628+ "category": "appointments",
1629+ "description": "Öğretmenin müsait randevu saati açması (Öğretmen+).",
1630+ "response_id": "appointment_slot_instructions",
1631+ "response_template": (
1632+ "**Randevular** (`/appointments`) → **Açtığım "
1633+ "saatler** bölümünde **Saat aç** (veya **Yeni saat**) ile müsait "
1634+ "randevu saati yayınla. Öğrenci ve veliler bu saatlerden randevu talep "
1635+ "eder; gelen talepleri **Randevu talepleri**'nden yönetirsin."
1636+ ),
1637+ "auth_required": True,
1638+ "min_role": "ogretmen",
1639+ "example_questions": [
1640+ "Randevu saati nasıl açarım?",
1641+ "Öğrencilere müsait saat yayınlamak istiyorum",
1642+ "Randevu için saat açma nerede?",
1643+ "Müsaitlik saati eklemek istiyorum",
1644+ "Öğrencilere randevu saati açmak istiyorum",
1645+ ],
1646+ "must_not_match": ["appointment_book", "appointment_requests"],
1647+ },
1648+ {
1649+ "intent": "appointment_requests",
1650+ "category": "appointments",
1651+ "description": "Öğretmenin randevu taleplerini onaylaması (Öğretmen+).",
1652+ "response_id": "appointment_requests_instructions",
1653+ "response_template": (
1654+ "**Randevular** (`/appointments`) → **Randevu "
1655+ "talepleri** bölümünde gelen talepleri görürsün; her talepte **Onayla** "
1656+ "ile kabul et (gerekirse reddet). Onaylanan randevu, ilgili öğrenci/"
1657+ "velinin **Randevularım**'ında görünür."
1658+ ),
1659+ "auth_required": True,
1660+ "min_role": "ogretmen",
1661+ "example_questions": [
1662+ "Randevu taleplerini nasıl onaylarım?",
1663+ "Gelen randevu isteklerini nerede görürüm?",
1664+ "Randevu talebini kabul etmek istiyorum",
1665+ "Öğrenci randevu talebini onaylama",
1666+ "Randevu isteklerini yönetmek istiyorum",
1667+ ],
1668+ "must_not_match": ["appointment_book", "appointment_slot_open"],
1669+ },
1670+ # --- Yemek (T1; frontend /meals, "Yemekler" menüsü) -----------------------
1671+ {
1672+ "intent": "meal_view",
1673+ "category": "meals",
1674+ "description": "Yemek menülerini/rezervasyon durumunu görüntüleme.",
1675+ "response_id": "meal_view_info",
1676+ "response_template": (
1677+ "Yemek menülerini **Okul hizmetleri** grubundaki **Yemekler** "
1678+ "(`/meals`) sayfasından görürsün. Günün **Menü** ve **Öğün**lerini, "
1679+ "rezervasyon durumunu (**Rezerve edildi** / **Rezervasyon yok**) "
1680+ "görebilirsin. Detay için menü kartına bas (`/meals/$id`)."
1681+ ),
1682+ "auth_required": True,
1683+ "min_role": "veli",
1684+ "example_questions": [
1685+ "Yemek menüsü nerede?",
1686+ "Yemek menüsünü görmek istiyorum",
1687+ "Yemekler sayfası nerede?",
1688+ "Öğün menüsü nerede?",
1689+ "Yemek listesi nerede?",
1690+ ],
1691+ "must_not_match": ["meal_book", "meal_menu_manage"],
1692+ },
1693+ {
1694+ "intent": "meal_book",
1695+ "category": "meals",
1696+ "description": "Öğün için yer ayırma/iptal (Öğrenci/Veli).",
1697+ "response_id": "meal_book_instructions",
1698+ "response_template": (
1699+ "Yemek için yer ayırmak üzere **Yemekler** (`/meals`) → ilgili menü/"
1700+ "öğüne gir, **Yer ayır**'a bas. Rezervasyonun **Rezerve edildi** olarak "
1701+ "görünür; **Rezervasyonu iptal et** ile geri alabilirsin. Yer ayırma "
1702+ "Öğrenci (kendisi) ve Veli'ye (bağlı çocuğu) açıktır."
1703+ ),
1704+ "auth_required": True,
1705+ "min_role": "veli",
1706+ "example_questions": [
1707+ "Yemek için yer ayırmak istiyorum",
1708+ "Öğün rezervasyonu nasıl yapılır?",
1709+ "Yer ayırma nerede?",
1710+ "Yemek rezervasyonu yapmak istiyorum",
1711+ "Yemek rezervasyonumu iptal etmek istiyorum",
1712+ ],
1713+ "must_not_match": ["meal_view", "meal_menu_manage"],
1714+ },
1715+ {
1716+ "intent": "meal_menu_manage",
1717+ "category": "meals",
1718+ "description": "Menü/öğün/kredi yönetimi (Yönetici+).",
1719+ "response_id": "meal_menu_instructions",
1720+ "response_template": (
1721+ "**Yemekler** (`/meals`) → **Menü yayınla** ile "
1722+ "yeni menü/öğün oluştur, **Yemek ekle** ile öğüne yemek ekle. Öğrenci "
1723+ "**Kredi** yönetimi için **Kredi kaydet** kullanılır. Menü ve kredi "
1724+ "yönetimi yalnızca Yönetici ve ADMIN'e açıktır."
1725+ ),
1726+ "auth_required": True,
1727+ "min_role": "yonetici",
1728+ "example_questions": [
1729+ "Menü nasıl yayınlarım?",
1730+ "Yeni menü oluşturmak istiyorum",
1731+ "Öğüne yemek eklemek istiyorum",
1732+ "Yemek kredisi nasıl kaydedilir?",
1733+ "Kredi kaydetme nerede?",
1734+ ],
1735+ "must_not_match": ["meal_book", "meal_view"],
1736+ },
1737+ # --- Soru havuzu (T1; frontend /questions "Soru havuzu"; sınav "Soru
1738+ # bankası"/question-bank'ten AYRI. Veli havuzdan hariç) --------------------
1739+ {
1740+ "intent": "question_ask",
1741+ "category": "questions",
1742+ "description": "Soru havuzuna soru sorma (Öğrenci+, Veli hariç).",
1743+ "response_id": "question_ask_instructions",
1744+ "response_template": (
1745+ "**Topluluk** grubundaki **Soru havuzu** (`/questions`) sayfasına git. "
1746+ "**Soru sor**'a bas; **Konu**, **Soru detayı** ve isteğe bağlı **Görsel** "
1747+ "ekleyip gönder. Sorun önce **Bekliyor** durumundadır; bir öğretmen "
1748+ "onaylayınca **Onaylandı** olur ve herkese görünür. Soru havuzu Öğrenci "
1749+ "ve üstüne açıktır (Veli hariç)."
1750+ ),
1751+ "auth_required": True,
1752+ "min_role": "ogrenci",
1753+ "example_questions": [
1754+ "Soru havuzuna nasıl soru sorarım?",
1755+ "Soru havuzu nedir?",
1756+ "Havuza yeni soru sormak istiyorum",
1757+ "Soru havuzunda soru sorma nerede?",
1758+ "Soru havuzuna bir soru sormak istiyorum",
1759+ ],
1760+ "must_not_match": ["question_solve", "question_approve", "exam_add_question"],
1761+ },
1762+ {
1763+ "intent": "question_solve",
1764+ "category": "questions",
1765+ "description": "Havuzdaki bir soruya çözüm gönderme (Öğrenci+).",
1766+ "response_id": "question_solve_instructions",
1767+ "response_template": (
1768+ "Bir soruya çözüm göndermek için **Soru havuzu** (`/questions`) → soruyu "
1769+ "aç (`/questions/$id`) → **Çözümler** bölümünde **Çözüm gönder** ile "
1770+ "çözümünü yaz ve paylaş. Çözüm gönderme Öğrenci ve üstüne açıktır."
1771+ ),
1772+ "auth_required": True,
1773+ "min_role": "ogrenci",
1774+ "example_questions": [
1775+ "Bir soruya nasıl çözüm gönderirim?",
1776+ "Çözüm önermek istiyorum",
1777+ "Soruya çözüm yazmak istiyorum",
1778+ "Çözüm paylaşmak istiyorum",
1779+ "Soruyu nasıl çözerim?",
1780+ ],
1781+ "must_not_match": ["question_ask", "question_approve"],
1782+ },
1783+ {
1784+ "intent": "question_approve",
1785+ "category": "questions",
1786+ "description": "Havuzdaki soruları onaylama/reddetme (Öğretmen+).",
1787+ "response_id": "question_approve_instructions",
1788+ "response_template": (
1789+ "**Soru havuzu** (`/questions`) → soru detayında "
1790+ "**Onayla** ile bekleyen soruyu yayınla, gerekirse **Reddet**. Onaylanan "
1791+ "soru **Onaylandı** olur ve herkese görünür. Onaylama Öğretmen ve üstüne açıktır."
1792+ ),
1793+ "auth_required": True,
1794+ "min_role": "ogretmen",
1795+ "example_questions": [
1796+ "Havuzdaki soruları nasıl onaylarım?",
1797+ "Bekleyen soruları onaylamak istiyorum",
1798+ "Öğrenci sorusunu reddetmek istiyorum",
1799+ "Soru onaylama nerede?",
1800+ "Havuzdaki soruları onaylamak istiyorum",
1801+ ],
1802+ "must_not_match": ["question_ask", "question_solve"],
1803+ },
1804+ # --- Beyaz tahta (T1; frontend /whiteboards "Beyaz tahtalar"; Veli hariç) --
1805+ {
1806+ "intent": "board_view",
1807+ "category": "boards",
1808+ "description": "Beyaz tahtaları görüntüleme/açma (Öğrenci+, Veli hariç).",
1809+ "response_id": "board_view_info",
1810+ "response_template": (
1811+ "Beyaz tahtaları **Çalışma alanı** grubundaki **Beyaz tahtalar** "
1812+ "(`/whiteboards`) sayfasından görürsün. Bir tahtayı açmak için kartında "
1813+ "**Aç**'a bas (`/whiteboards/$id`); katılımcılar eşzamanlı çizer. Beyaz "
1814+ "tahtalar Öğrenci ve üstüne açıktır (Veli hariç)."
1815+ ),
1816+ "auth_required": True,
1817+ "min_role": "ogrenci",
1818+ "example_questions": [
1819+ "Beyaz tahtalar nerede?",
1820+ "Var olan bir tahtayı nasıl açarım?",
1821+ "Beyaz tahta sayfası nerede?",
1822+ "Tahtaları nereden görürüm?",
1823+ "Ortak çalışma tahtaları nerede?",
1824+ ],
1825+ "must_not_match": ["board_create"],
1826+ },
1827+ {
1828+ "intent": "board_create",
1829+ "category": "boards",
1830+ "description": "Yeni beyaz tahta oluşturma (Öğrenci+, Veli hariç).",
1831+ "response_id": "board_create_instructions",
1832+ "response_template": (
1833+ "Yeni beyaz tahta için **Beyaz tahtalar** (`/whiteboards`) → **Yeni tahta** "
1834+ "ile **Başlık** gir, isteğe bağlı **Katılımcılar** ekle, oluştur. Tahta "
1835+ "içinde **Kilitle/Kilidi aç**, **Temizle** ve **Tahtayı kapat** kontrolleri "
1836+ "vardır; Öğretmen+ **Toplu davet** ile sınıf/etkinlik katılımcısı çağırabilir."
1837+ ),
1838+ "auth_required": True,
1839+ "min_role": "ogrenci",
1840+ "example_questions": [
1841+ "Yeni beyaz tahta nasıl oluştururum?",
1842+ "Yeni tahta oluşturmak istiyorum",
1843+ "Beyaz tahta eklemek istiyorum",
1844+ "Tahta oluşturma nerede?",
1845+ "Yeni bir tahta oluşturmak istiyorum",
1846+ ],
1847+ "must_not_match": ["board_view"],
1848+ },
1602 ]1849 ]
1603 1850
1604 1851
@@ -1609,6 +1856,12 @@ RULE_ONLY_INTENTS: Final[frozenset[str]] = frozenset({
1609 "fees_info", "branches_info", "calendar_info", "today_info",1856 "fees_info", "branches_info", "calendar_info", "today_info",
1610 "question_bank_info", "notification_settings_info", "nav_overview",1857 "question_bank_info", "notification_settings_info", "nav_overview",
1611 "event_view", "exam_schedule_info", "course_materials_info",1858 "event_view", "exam_schedule_info", "course_materials_info",
1859+ # T1 özellikleri: kural-tetikli; örnek soruları similarity/domain havuzuna
1860+ # ALINMAZ (yeni intent'ler TF-IDF/OOS'u kirletmesin — coverage intent'leri gibi).
1861+ "appointment_book", "appointment_slot_open", "appointment_requests",
1862+ "meal_view", "meal_book", "meal_menu_manage",
1863+ "question_ask", "question_solve", "question_approve",
1864+ "board_view", "board_create",
1612 })1865 })
1613 1866
1614 1867
@@ -1697,6 +1950,18 @@ INTENT_ROUTES: Final[dict[str, str | None]] = {
1697 "event_view": "/events",1950 "event_view": "/events",
1698 "exam_schedule_info": "/exams",1951 "exam_schedule_info": "/exams",
1699 "course_materials_info": "/courses",1952 "course_materials_info": "/courses",
1953+ # T1 özellikleri (frontend rotalarıyla birebir)
1954+ "appointment_book": "/appointments",
1955+ "appointment_slot_open": "/appointments",
1956+ "appointment_requests": "/appointments",
1957+ "meal_view": "/meals",
1958+ "meal_book": "/meals",
1959+ "meal_menu_manage": "/meals",
1960+ "question_ask": "/questions",
1961+ "question_solve": "/questions",
1962+ "question_approve": "/questions",
1963+ "board_view": "/whiteboards",
1964+ "board_create": "/whiteboards",
1700 }1965 }
1701 1966
1702 # Yol -> arayüzde görünen sayfa adı (buton etiketi için). Rehber §4'teki TR etiketler.1967 # Yol -> arayüzde görünen sayfa adı (buton etiketi için). Rehber §4'teki TR etiketler.
@@ -1708,6 +1973,10 @@ ROUTE_LABELS: Final[dict[str, str]] = {
1708 "/exams": "Sınavlar",1973 "/exams": "Sınavlar",
1709 "/homework": "Ödevler",1974 "/homework": "Ödevler",
1710 "/events": "Etkinlikler",1975 "/events": "Etkinlikler",
1976+ "/appointments": "Randevular",
1977+ "/meals": "Yemekler",
1978+ "/questions": "Soru havuzu",
1979+ "/whiteboards": "Beyaz tahtalar",
1711 "/marks": "Karnem",1980 "/marks": "Karnem",
1712 "/attendance": "Yoklama",1981 "/attendance": "Yoklama",
1713 "/notes": "Defter",1982 "/notes": "Defter",
src/engine.pymodified+6 -48
@@ -346,32 +346,8 @@ def _unavailable_feature(query: str) -> str | None:
346 return None346 return None
347 347
348 348
349-# Üründe MEVCUT olan (frontend'de tam sayfa) ama chatbot kataloğunda ayrı intent'i349+# (T1 özellikleri — randevu/yemek/beyaz tahta/soru havuzu — artık gerçek intent'lerdir;
350-# olmayan özellikler -> doğru bilgi + sayfa butonu (yanlış "aktif değil" demez).350+# eski _FEATURE_INFO stopgap'i kaldırıldı, boru hattı bunları normal karşılar.)
351-# (folded_anahtar, path, Başlık, açıklama)
352-_FEATURE_INFO: tuple[tuple[str, str, str, str], ...] = (
353- ("randevu", "/appointments", "Randevular",
354- "Randevular sayfasında öğretmenler görüşme saatleri (slot) açar; öğrenci/veli "
355- "uygun saate randevu alır. Randevular onaylanır, ertelenir ya da iptal edilir."),
356- ("yemek", "/meals", "Yemekler",
357- "Yemekler sayfasında günlük yemek menüsü görüntülenir ve yemek rezervasyonu yapılır."),
358- ("beyaz tahta", "/whiteboards", "Beyaz tahtalar",
359- "Beyaz tahtalar sayfasında ortak çalışma için beyaz tahta oluşturup üzerinde "
360- "çizim ve not paylaşabilirsin."),
361- ("tahta", "/whiteboards", "Beyaz tahtalar",
362- "Beyaz tahtalar sayfasında ortak çalışma için beyaz tahta oluşturup üzerinde "
363- "çizim ve not paylaşabilirsin."),
364-)
365-
366-
367-def _feature_info(query: str) -> tuple[str, dict[str, Any]] | None:
368- """Mevcut ama ayrı intent'i olmayan özellik -> (açıklama, sayfa butonu)."""
369-
370- low = query.casefold()
371- for keyword, path, label, desc in _FEATURE_INFO:
372- if keyword in low:
373- return desc, {"route": path, "label": label, "available": True}
374- return None
375 351
376 352
377 # --- Kapsam sınırı: canlı VERİ çekme isteği ---------------------------------353 # --- Kapsam sınırı: canlı VERİ çekme isteği ---------------------------------
@@ -493,8 +469,11 @@ _TOPIC_HELP: tuple[tuple[str, str], ...] = (
493 ("takvim", "takvim nerede"),469 ("takvim", "takvim nerede"),
494 ("defter", "defterlerim nerede"),470 ("defter", "defterlerim nerede"),
495 ("pomodoro", "pomodoro nedir"),471 ("pomodoro", "pomodoro nedir"),
496- ("soru", "soru bankası nedir"),
497 ("mesaj", "mesaj nasıl gönderirim"),472 ("mesaj", "mesaj nasıl gönderirim"),
473+ # T1: 'randevu/yemek/tahta ne işe yarar' -> ilgili T1 intent'ine götür
474+ ("randevu", "randevu nasıl alırım"),
475+ ("yemek", "yemek menüsü nerede"),
476+ ("tahta", "beyaz tahtalar nerede"),
498 ("yoklama", "yoklamam nerede"),477 ("yoklama", "yoklamam nerede"),
499 ("devamsiz", "devamsızlığımı nasıl görürüm"),478 ("devamsiz", "devamsızlığımı nasıl görürüm"),
500 )479 )
@@ -1053,27 +1032,6 @@ class Engine:
1053 if not pure_negation and _neg_resolved != effective_query:1032 if not pure_negation and _neg_resolved != effective_query:
1054 effective_query = _neg_resolved1033 effective_query = _neg_resolved
1055 1034
1056- # 1.56) Üründe MEVCUT ama ayrı intent'i olmayan özellik (randevu/yemek/beyaz
1057- # tahta) -> doğru bilgi + sayfa butonu (yanlış "aktif değil" DEMEZ).
1058- _feat = _feature_info(effective_query)
1059- if _feat is not None:
1060- _feat_text, _feat_nav = _feat
1061- return _attach_assistant_meta({
1062- "trace_id": trace_id,
1063- "response_id": "feature_info",
1064- "text": _with_brand_note(_feat_text, query),
1065- "intent": None,
1066- "confidence": 1.0,
1067- "fallback": False,
1068- "auth_action": None,
1069- "required_role": None,
1070- "navigation": _feat_nav,
1071- "clarification": None,
1072- "answers": None,
1073- "suggestions": suggestions,
1074- "safety": safety_info,
1075- }, role)
1076-
1077 # 1.57) Henüz canlı olmayan/bulunmayan özellik -> yanlış yönlendirme YOK,1035 # 1.57) Henüz canlı olmayan/bulunmayan özellik -> yanlış yönlendirme YOK,
1078 # dürüstçe "henüz kullanılamıyor" (intent None, nav yok).1036 # dürüstçe "henüz kullanılamıyor" (intent None, nav yok).
1079 _unavail = _unavailable_feature(effective_query)1037 _unavail = _unavailable_feature(effective_query)
src/role_spaces.pymodified+26 -0
@@ -87,6 +87,20 @@ _ACTION_RULES: Final[dict[str, dict[str, tuple[AccessOutcome, AccessScope | None
87 "school.settings_manage": _matrix((D, None, None), (D, None, None), (D, None, None), (A, S, "school_settings"), (A, S, "school_settings")),87 "school.settings_manage": _matrix((D, None, None), (D, None, None), (D, None, None), (A, S, "school_settings"), (A, S, "school_settings")),
88 "school.terms_manage": _matrix((D, None, None), (D, None, None), (D, None, None), (A, S, "school_terms"), (A, S, "school_terms")),88 "school.terms_manage": _matrix((D, None, None), (D, None, None), (D, None, None), (A, S, "school_terms"), (A, S, "school_terms")),
89 "users.roles_manage": _matrix((D, None, None), (D, None, None), (D, None, None), (D, None, None), (A, S, "admin_users")),89 "users.roles_manage": _matrix((D, None, None), (D, None, None), (D, None, None), (D, None, None), (A, S, "admin_users")),
90+ # --- T1 özellikleri ---
91+ # Randevu: alma yalnız Öğrenci+Veli (backend: Student|Parent); saat açma/talep
92+ # onaylama Öğretmen+.
93+ "appointments.book": _matrix((A, O, "appointments"), (A, O, "appointments"), (D, None, None), (D, None, None), (D, None, None)),
94+ "appointments.manage": _matrix((D, None, None), (D, None, None), (A, O, "appointments"), (A, S, "appointments"), (A, S, "appointments")),
95+ # Yemek: menü görüntüleme herkese; yer ayırma Öğrenci(self)+Veli; menü/kredi Yönetici+.
96+ "meals.view": _matrix((A, O, "meals"), (A, O, "meals"), (A, O, "meals"), (A, S, "meals"), (A, S, "meals")),
97+ "meals.book": _matrix((A, O, "meals"), (A, O, "meals"), (D, None, None), (D, None, None), (D, None, None)),
98+ "meals.manage": _matrix((D, None, None), (D, None, None), (D, None, None), (A, S, "meals"), (A, S, "meals")),
99+ # Soru havuzu: sorma/çözme Öğrenci+ (Veli hariç); onaylama Öğretmen+ (moderatör).
100+ "qpool.participate": _matrix((D, None, None), (A, O, "questions"), (A, O, "questions"), (A, S, "questions"), (A, S, "questions")),
101+ "qpool.moderate": _matrix((D, None, None), (D, None, None), (A, M, "questions"), (A, S, "questions"), (A, S, "questions")),
102+ # Beyaz tahta: görüntüleme/oluşturma Öğrenci+ (Veli hariç).
103+ "boards.use": _matrix((D, None, None), (A, O, "whiteboards"), (A, O, "whiteboards"), (A, S, "whiteboards"), (A, S, "whiteboards")),
90 }104 }
91 105
92 _ACTION_BY_INTENT: Final[dict[str, str]] = {106 _ACTION_BY_INTENT: Final[dict[str, str]] = {
@@ -158,6 +172,18 @@ _ACTION_BY_INTENT: Final[dict[str, str]] = {
158 "event_view": "platform.help",172 "event_view": "platform.help",
159 "exam_schedule_info": "platform.help",173 "exam_schedule_info": "platform.help",
160 "course_materials_info": "platform.help",174 "course_materials_info": "platform.help",
175+ # T1 özellikleri
176+ "appointment_book": "appointments.book",
177+ "appointment_slot_open": "appointments.manage",
178+ "appointment_requests": "appointments.manage",
179+ "meal_view": "meals.view",
180+ "meal_book": "meals.book",
181+ "meal_menu_manage": "meals.manage",
182+ "question_ask": "qpool.participate",
183+ "question_solve": "qpool.participate",
184+ "question_approve": "qpool.moderate",
185+ "board_view": "boards.use",
186+ "board_create": "boards.use",
161 }187 }
162 188
163 _OWN_REPORT_RESPONSES: Final[dict[str, str]] = {189 _OWN_REPORT_RESPONSES: Final[dict[str, str]] = {
src/rules.pymodified+68 -3
@@ -366,10 +366,9 @@ _RAW_RULES: Final[list[dict[str, Any]]] = [
366 {"all": ["bugün", "panel"]}, {"all": ["ana", "panel"]},366 {"all": ["bugün", "panel"]}, {"all": ["ana", "panel"]},
367 ]},367 ]},
368 {"intent": "question_bank_info", "groups": [368 {"intent": "question_bank_info", "groups": [
369+ # Yalnız 'soru bankası' (sınav şablon deposu). 'Soru havuzu' AYRI bir özellik
370+ # (/questions, question_ask) -> ona bırakılır (havuz burada YOK).
369 {"all": ["soru", "banka"]},371 {"all": ["soru", "banka"]},
370- # 'soru havuzu' = soru bankası (halk dilinde); tek 'havuz' okul bağlamında da
371- # soru havuzunu ifade eder -> question_bank_info.
372- {"all": ["soru", "havuz"]}, {"all": ["havuz"]},
373 ]},372 ]},
374 {"intent": "notification_settings_info", "groups": [373 {"intent": "notification_settings_info", "groups": [
375 {"all": ["bildirim"]},374 {"all": ["bildirim"]},
@@ -394,6 +393,72 @@ _RAW_RULES: Final[list[dict[str, Any]]] = [
394 {"all": ["ders", "not", "pdf"]}, {"all": ["ders", "not", "dosya"]},393 {"all": ["ders", "not", "pdf"]}, {"all": ["ders", "not", "dosya"]},
395 {"all": ["öğretmen", "pdf"]}, {"all": ["ders", "dosya"], "none": ["defter"]},394 {"all": ["öğretmen", "pdf"]}, {"all": ["ders", "dosya"], "none": ["defter"]},
396 ]},395 ]},
396+ # --- T1: Randevu (al=öğrenci/veli, saat aç=öğretmen, onayla=öğretmen) ---
397+ {"intent": "appointment_book", "groups": [
398+ {"all": ["randevu", "al"], "none": [
399+ "saat", "onayla", "talepleri", "kabul", "reddet", "istek"]},
400+ {"all": ["randevu", "talep", "oluştur"]},
401+ {"all": ["randevu", "talep", "et"], "none": ["kabul", "onayla", "reddet"]},
402+ # "Randevular nerede" = randevu sayfası (öğrenci/veli için randevu alma).
403+ {"all": ["randevu", "nerede"], "none": ["saat", "onayla", "talepleri"]},
404+ ]},
405+ {"intent": "appointment_slot_open", "groups": [
406+ {"all": ["randevu", "saat"]},
407+ {"all": ["müsait", "saat"]},
408+ {"all": ["müsait", "yayınla"]},
409+ ]},
410+ {"intent": "appointment_requests", "groups": [
411+ {"all": ["randevu", "onayla"]}, {"all": ["randevu", "kabul"]},
412+ {"all": ["randevu", "reddet"]}, {"all": ["randevu", "istek"]},
413+ {"all": ["randevu", "talepleri"]},
414+ ]},
415+ # --- T1: Yemek (menü görüntüle=view, yer ayır=book, yayınla/kredi=manage) ---
416+ {"intent": "meal_view", "groups": [
417+ {"all": ["yemek", "menü"], "none": [
418+ "yayınla", "ekle", "oluştur", "kredi", "ayır", "rezerv"]},
419+ {"all": ["öğün", "menü"]},
420+ {"all": ["yemek", "liste"]},
421+ {"all": ["yemek", "nerede"], "none": ["yer", "rezerv", "yayınla", "ekle", "kredi"]},
422+ ]},
423+ {"intent": "meal_book", "groups": [
424+ {"all": ["yer", "ayır"]},
425+ {"all": ["yemek", "rezerv"]},
426+ {"all": ["öğün", "rezerv"]},
427+ ]},
428+ {"intent": "meal_menu_manage", "groups": [
429+ {"all": ["menü", "yayınla"]},
430+ {"all": ["menü", "oluştur"]},
431+ {"all": ["yemek", "ekle"], "none": ["yer"]},
432+ {"all": ["yemek", "kredi"]}, {"all": ["kredi", "kaydet"]},
433+ ]},
434+ # --- T1: Soru havuzu (sor=ask, çöz=solve, onayla=approve; sınav soru ekle'den ayrı) ---
435+ {"intent": "question_ask", "groups": [
436+ # 'onayla/reddet/çöz' varsa approve/solve'a bırak (soru+havuz onlarda da var).
437+ {"all": ["soru", "havuz"], "none": ["onayla", "reddet", "çöz", "çözüm", "bekleyen"]},
438+ {"all": ["havuz", "soru"], "none": ["onayla", "reddet", "çöz", "çözüm", "bekleyen"]},
439+ ]},
440+ {"intent": "question_solve", "groups": [
441+ {"all": ["çözüm", "gönder"]}, {"all": ["çözüm", "öner"]},
442+ {"all": ["çözüm", "paylaş"]}, {"all": ["çözüm", "yaz"]},
443+ {"all": ["soru", "çöz"]},
444+ ]},
445+ {"intent": "question_approve", "groups": [
446+ {"all": ["soru", "onayla"], "none": ["banka"]},
447+ {"all": ["soru", "reddet"]},
448+ {"all": ["bekleyen", "soru"]}, {"all": ["havuz", "onayla"]},
449+ ]},
450+ # --- T1: Beyaz tahta (aç/nerede=view, oluştur/yeni=create) ---
451+ {"intent": "board_view", "groups": [
452+ {"all": ["tahta", "aç"]},
453+ {"all": ["tahta", "nerede"], "none": ["oluştur", "yeni", "ekle"]},
454+ {"all": ["beyaz", "tahta"], "none": ["oluştur", "yeni", "ekle"]},
455+ {"all": ["tahta", "gör"]},
456+ ]},
457+ {"intent": "board_create", "groups": [
458+ {"all": ["tahta", "oluştur"]},
459+ {"all": ["yeni", "tahta"]},
460+ {"all": ["tahta", "ekle"]},
461+ ]},
397 ]462 ]
398 463
399 464
tests/e2e/test_behavior_matrix.pymodified+12 -0
@@ -112,6 +112,18 @@ INTENT_MATRIX: list[tuple[str, str, str]] = [
112 ("ogrenci", "etkinlikleri nerede görürüm", "event_view"),112 ("ogrenci", "etkinlikleri nerede görürüm", "event_view"),
113 ("ogrenci", "sınav tarihleri nerede yazıyor", "exam_schedule_info"),113 ("ogrenci", "sınav tarihleri nerede yazıyor", "exam_schedule_info"),
114 ("ogrenci", "ders notları ve öğretmenin yüklediği pdf nerede", "course_materials_info"),114 ("ogrenci", "ders notları ve öğretmenin yüklediği pdf nerede", "course_materials_info"),
115+ # --- T1 özellikleri ---
116+ ("ogrenci", "öğretmenden randevu almak istiyorum", "appointment_book"),
117+ ("ogretmen", "randevu saatlerimi açmak istiyorum", "appointment_slot_open"),
118+ ("ogretmen", "gelen randevu taleplerini onaylamak istiyorum", "appointment_requests"),
119+ ("ogrenci", "yemek menüsünü nereden görürüm", "meal_view"),
120+ ("ogrenci", "öğün için yer ayırmak istiyorum", "meal_book"),
121+ ("yonetici", "yeni yemek menüsü yayınlamak istiyorum", "meal_menu_manage"),
122+ ("ogrenci", "soru havuzuna soru sormak istiyorum", "question_ask"),
123+ ("ogrenci", "bir soruya çözüm göndermek istiyorum", "question_solve"),
124+ ("ogretmen", "havuzdaki soruları onaylamak istiyorum", "question_approve"),
125+ ("ogrenci", "beyaz tahtalar nerede", "board_view"),
126+ ("ogrenci", "yeni beyaz tahta oluşturmak istiyorum", "board_create"),
115 ]127 ]
116 128
117 129
tests/integration/test_edge_cases.pymodified+20 -9
@@ -179,19 +179,30 @@ class TopicHelpAndFeatureInfoTests(unittest.TestCase):
179 def test_specific_howto_not_hijacked(self) -> None:179 def test_specific_howto_not_hijacked(self) -> None:
180 self.assertEqual(ask("etkinlik nasıl oluştururum", "ogretmen")["intent"], "event_create")180 self.assertEqual(ask("etkinlik nasıl oluştururum", "ogretmen")["intent"], "event_create")
181 181
182- def test_existing_features_not_marked_unavailable(self) -> None:182+ def test_t1_features_have_real_intents(self) -> None:
183- for q in ["randevular nerede", "yemek menüsü nasıl", "beyaz tahta ne işe yarar",183+ # T1 özellikleri artık gerçek intent (feature_info stopgap kalktı); doğru
184- "soru havuzu ne işe yarar"]:184+ # role'de intent + buton verir, ASLA "aktif değil" demez.
185+ for q, role, intent in [
186+ ("randevu nasıl alırım", "ogrenci", "appointment_book"),
187+ ("yemek menüsü nerede", "ogrenci", "meal_view"),
188+ ("beyaz tahta nasıl oluştururum", "ogrenci", "board_create"),
189+ ("soru havuzuna nasıl soru sorarım", "ogrenci", "question_ask"),
190+ ]:
185 with self.subTest(q=q):191 with self.subTest(q=q):
186- r = ask(q, "ogretmen")192+ r = ask(q, role)
193+ self.assertEqual(r["intent"], intent)
187 self.assertNotIn("aktif değil", r["text"])194 self.assertNotIn("aktif değil", r["text"])
188- self.assertNotIn("kullanılamıyor", r["text"])
189 self.assertIsNotNone(r["navigation"])195 self.assertIsNotNone(r["navigation"])
190 196
191- def test_question_pool_is_question_bank(self) -> None:197+ def test_question_pool_vs_question_bank_distinct(self) -> None:
192- r = ask("soru havuzu sayfasını açmak istiyorum", "ogretmen")198+ # 'Soru havuzu' (/questions, topluluk) ile 'Soru bankası' (/question-bank,
193- self.assertEqual(r["intent"], "question_bank_info")199+ # sınav) AYRI özelliklerdir — karışmaz.
194- self.assertEqual(r["navigation"]["route"], "/question-bank")200+ pool = ask("soru havuzuna nasıl soru sorarım", "ogrenci")
201+ self.assertEqual(pool["intent"], "question_ask")
202+ self.assertEqual(pool["navigation"]["route"], "/questions")
203+ bank = ask("soru bankası nedir", "ogretmen")
204+ self.assertEqual(bank["intent"], "question_bank_info")
205+ self.assertEqual(bank["navigation"]["route"], "/question-bank")
195 206
196 207
197 class KnownLimitTests(unittest.TestCase):208 class KnownLimitTests(unittest.TestCase):