c6206787da
项目结构: - backend/ Python FastAPI 后端 - uni-app/ uni-app跨端前端 - docs/ 设计文档 - docker-compose.yml Docker编排 - nginx/scripts/systemd 运维配置 已完成功能: - 用户认证 (JWT) - 智能翻译 + 回复建议 - 营销素材生成 - 客户管理 + 沉默检测 - 报价单管理 - 产品库管理 - 汇率换算 - 推送通知 (uni-push) - WhatsApp Webhook框架 - Celery定时任务
46 lines
1.0 KiB
Python
46 lines
1.0 KiB
Python
from abc import ABC, abstractmethod
|
|
from typing import Dict, Any, Optional
|
|
|
|
|
|
class AIProvider(ABC):
|
|
@abstractmethod
|
|
async def translate(
|
|
self, text: str, source_lang: Optional[str], target_lang: str,
|
|
context: Optional[str] = None,
|
|
) -> Dict[str, Any]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def reply(
|
|
self, inquiry: str, context: Optional[Dict[str, Any]] = None,
|
|
tone: str = "professional",
|
|
) -> Dict[str, Any]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def generate_marketing(
|
|
self, product_info: Dict[str, Any], target: str,
|
|
style: str = "professional", language: str = "en",
|
|
) -> Dict[str, Any]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def extract_info(
|
|
self, text: str, schema: Dict[str, Any],
|
|
) -> Dict[str, Any]:
|
|
pass
|
|
|
|
@property
|
|
@abstractmethod
|
|
def name(self) -> str:
|
|
pass
|
|
|
|
@property
|
|
@abstractmethod
|
|
def cost_per_1k_tokens(self) -> float:
|
|
pass
|
|
|
|
@property
|
|
def supports_streaming(self) -> bool:
|
|
return False
|