kin: KIN-BIZ-006 Проверить промпт sysadmin.md на поддержку сценария env_scan
This commit is contained in:
parent
531275e4ce
commit
a58578bb9d
14 changed files with 1619 additions and 13 deletions
48
core/chat_intent.py
Normal file
48
core/chat_intent.py
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
"""Kin — chat intent classifier (heuristic, no LLM).
|
||||
|
||||
classify_intent(text) → 'task_request' | 'status_query' | 'question'
|
||||
"""
|
||||
|
||||
import re
|
||||
from typing import Literal
|
||||
|
||||
_STATUS_PATTERNS = [
|
||||
r'что сейчас',
|
||||
r'в работе',
|
||||
r'\bстатус\b',
|
||||
r'список задач',
|
||||
r'покажи задачи',
|
||||
r'покажи список',
|
||||
r'какие задачи',
|
||||
r'что идёт',
|
||||
r'что делается',
|
||||
r'что висит',
|
||||
]
|
||||
|
||||
_QUESTION_STARTS = (
|
||||
'почему', 'зачем', 'как ', 'что такое', 'что значит',
|
||||
'объясни', 'расскажи', 'что делает', 'как работает',
|
||||
'в чём', 'когда', 'кто',
|
||||
)
|
||||
|
||||
|
||||
def classify_intent(text: str) -> Literal['task_request', 'status_query', 'question']:
|
||||
"""Classify user message intent.
|
||||
|
||||
Returns:
|
||||
'status_query' — user is asking about current project status/tasks
|
||||
'question' — user is asking a question (no action implied)
|
||||
'task_request' — everything else; default: create a task and run pipeline
|
||||
"""
|
||||
lower = text.lower().strip()
|
||||
|
||||
for pattern in _STATUS_PATTERNS:
|
||||
if re.search(pattern, lower):
|
||||
return 'status_query'
|
||||
|
||||
if lower.endswith('?'):
|
||||
for word in _QUESTION_STARTS:
|
||||
if lower.startswith(word):
|
||||
return 'question'
|
||||
|
||||
return 'task_request'
|
||||
Loading…
Add table
Add a link
Reference in a new issue