feat: jc 引擎主线搬入 app/engine(315 测试基线全绿:320 去掉 admin 5 用例)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-10-12 16:25:32 +08:00
parent 0ae5952002
commit 603c03eb4a
55 changed files with 10912 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
from abc import ABC, abstractmethod
from collections.abc import AsyncGenerator
class AIProvider(ABC):
@abstractmethod
async def chat(self, messages: list[dict], system_prompt: str) -> str:
"""Send messages and return assistant reply text."""
@abstractmethod
async def stream_chat(
self, messages: list[dict], system_prompt: str
) -> AsyncGenerator[str, None]:
"""Stream assistant reply token by token."""
@abstractmethod
async def chat_with_extraction(
self, messages: list[dict], system_prompt: str
) -> tuple[str, dict]:
"""Send messages and return (reply_text, extracted_json).
The provider should request JSON output and parse it.
Falls back to empty dict if parsing fails.
"""