refactor: step 2 - extract domain services (tasks, prompts, snapshots, knowledge)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
"""
|
||||
===============================================================================
|
||||
FILE: services/prompts/service.py
|
||||
PROJECT: SCUD Orion AI (Unified Architecture)
|
||||
MODULE: services / prompts
|
||||
ROLE: Единый доменный сервис управления системным промптом.
|
||||
===============================================================================
|
||||
"""
|
||||
|
||||
from typing import Tuple, Dict, Any
|
||||
from .repository import repo_get_active_prompt, repo_apply_prompt_action, repo_save_full_prompt
|
||||
from .diff_engine import build_prompt_diff
|
||||
|
||||
|
||||
def get_active_system_prompt() -> str:
|
||||
"""Получить текущий активный системный промпт."""
|
||||
return repo_get_active_prompt()
|
||||
|
||||
|
||||
def apply_prompt_action(action: str, section_id: int, item_id: int, content: str = "") -> None:
|
||||
"""Применить точечное изменение к узлу промпта."""
|
||||
repo_apply_prompt_action(action, section_id, item_id, content)
|
||||
|
||||
|
||||
def save_full_prompt_draft(draft_text: str) -> None:
|
||||
"""Сохранить полный черновик промпта."""
|
||||
repo_save_full_prompt(draft_text)
|
||||
|
||||
|
||||
def create_prompt_preview(action: str, section_id: int, item_id: int, content: str = "") -> Tuple[str, str, str]:
|
||||
"""
|
||||
Формирует черновик и diff.
|
||||
Возвращает (merged_draft, diff_html, baseline_prompt).
|
||||
"""
|
||||
baseline = repo_get_active_prompt()
|
||||
draft, diff_html = build_prompt_diff(action, section_id, item_id, content)
|
||||
return draft, diff_html, baseline
|
||||
Reference in New Issue
Block a user