```
feat(ai_agent): 完善AI适配器和服务功能 - 添加OpenClaw和Hermes健康检查接口 - 实现OpenClaw工具调用功能 - 重构AI适配器使用常量定义 - 增加AI技能系统支持 - 更新配置文件中的默认模型提供者设置 refactor(scheduler): 使用常量替换硬编码值 - 将硬编码的actor值替换为ActorValue常量 - 将receive_id_type替换为FeishuReceiveIdType枚举 refactor(audit): 统一审计日志常量使用 - 将硬编码的actor、source、risk_level等值替换为对应常量 - 更新审核服务中的状态和操作常量引用 refactor(approvals): 标准化审批模块常量使用 - 将applicant默认值替换为ActorValue.API常量 - 使用ApprovalStatus常量替代硬编码状态值 - 更新审核操作常量引用 ```
This commit is contained in:
@@ -3,10 +3,13 @@ from typing import Any
|
||||
from fastapi import HTTPException, status
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.core.constants import ActorValue
|
||||
from app.core.config import get_settings
|
||||
from app.modules.audit.constants import AuditAction, AuditSource
|
||||
from app.modules.audit.schemas import AuditLogCreate
|
||||
from app.modules.audit.service import AuditService
|
||||
from app.modules.feishu.client import FeishuClient
|
||||
from app.modules.feishu.constants import FeishuPayloadKey, FeishuReceiveIdType
|
||||
|
||||
|
||||
class FeishuService:
|
||||
@@ -32,19 +35,19 @@ class FeishuService:
|
||||
self,
|
||||
text: str,
|
||||
receive_id: str | None = None,
|
||||
receive_id_type: str = "chat_id",
|
||||
actor: str = "system",
|
||||
receive_id_type: str = FeishuReceiveIdType.CHAT_ID,
|
||||
actor: str = ActorValue.SYSTEM,
|
||||
) -> dict[str, Any]:
|
||||
result = self.client.send_text(text, receive_id, receive_id_type)
|
||||
self.audit.log(
|
||||
AuditLogCreate(
|
||||
actor=actor,
|
||||
source="feishu",
|
||||
action="send_text",
|
||||
source=AuditSource.FEISHU,
|
||||
action=AuditAction.FEISHU_SEND_TEXT,
|
||||
request_payload={
|
||||
"receive_id": receive_id,
|
||||
"receive_id_type": receive_id_type,
|
||||
"text": text,
|
||||
FeishuPayloadKey.RECEIVE_ID: receive_id,
|
||||
FeishuPayloadKey.RECEIVE_ID_TYPE: receive_id_type,
|
||||
FeishuPayloadKey.TEXT: text,
|
||||
},
|
||||
response_payload=result,
|
||||
)
|
||||
@@ -55,19 +58,19 @@ class FeishuService:
|
||||
self,
|
||||
card: dict[str, Any],
|
||||
receive_id: str | None = None,
|
||||
receive_id_type: str = "chat_id",
|
||||
actor: str = "system",
|
||||
receive_id_type: str = FeishuReceiveIdType.CHAT_ID,
|
||||
actor: str = ActorValue.SYSTEM,
|
||||
) -> dict[str, Any]:
|
||||
result = self.client.send_card(card, receive_id, receive_id_type)
|
||||
self.audit.log(
|
||||
AuditLogCreate(
|
||||
actor=actor,
|
||||
source="feishu",
|
||||
action="send_card",
|
||||
source=AuditSource.FEISHU,
|
||||
action=AuditAction.FEISHU_SEND_CARD,
|
||||
request_payload={
|
||||
"receive_id": receive_id,
|
||||
"receive_id_type": receive_id_type,
|
||||
"card": card,
|
||||
FeishuPayloadKey.RECEIVE_ID: receive_id,
|
||||
FeishuPayloadKey.RECEIVE_ID_TYPE: receive_id_type,
|
||||
FeishuPayloadKey.CARD: card,
|
||||
},
|
||||
response_payload=result,
|
||||
)
|
||||
@@ -80,6 +83,12 @@ class FeishuService:
|
||||
"config": {"wide_screen_mode": True},
|
||||
"header": {"title": {"tag": "plain_text", "content": title}},
|
||||
"elements": [
|
||||
{"tag": "div", "text": {"tag": "lark_md", "content": "\n".join(lines) or "暂无数据"}}
|
||||
{
|
||||
"tag": "div",
|
||||
"text": {
|
||||
"tag": "lark_md",
|
||||
"content": "\n".join(lines) or "暂无数据",
|
||||
},
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user