feat:新增投顾agent和nl2sqlagent

This commit is contained in:
2026-09-13 16:19:24 +08:00
parent c80c6acac0
commit 163192bf55
122 changed files with 7488 additions and 362 deletions
+16
View File
@@ -0,0 +1,16 @@
"""投顾 Agent 输出合规校验。"""
from __future__ import annotations
from common.common_const import ERR_CODE_LLM_ERROR
from utils.exceptions import ApiError
def find_sensitive_words(content: str, words: list[str]) -> list[str]:
return [word for word in dict.fromkeys(words) if word and word in content]
def ensure_safe_content(content: str, words: list[str]) -> bool:
matched = find_sensitive_words(content, words)
if matched:
raise ApiError(ERR_CODE_LLM_ERROR, "AI输出包含敏感或违规表述")
return True