Adiciona novos templates de e-mail para verificação, redefinição de senha e boas-vindas, além de atualizar a estrutura do projeto para incluir um novo esquema de registro de cliente e usuário. Implementa a lógica de envio de e-mails utilizando Jinja2 para renderização de templates. Atualiza o serviço de autenticação para suportar a criação de clientes com usuários associados.
This commit is contained in:
@@ -45,113 +45,10 @@ def create_tools():
|
||||
return True
|
||||
|
||||
# Definições das ferramentas
|
||||
tools = [
|
||||
{
|
||||
"name": "web_search",
|
||||
"description": "Pesquisa na web para obter informações atualizadas",
|
||||
"config_json": {
|
||||
"provider": "brave",
|
||||
"api_base": "https://api.search.brave.com/res/v1/web/search",
|
||||
"api_key_env": "BRAVE_API_KEY",
|
||||
"max_results": 5,
|
||||
"safe_search": "moderate"
|
||||
},
|
||||
"environments": {
|
||||
"production": True,
|
||||
"development": True,
|
||||
"staging": True
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "document_query",
|
||||
"description": "Consulta documentos internos para obter informações específicas",
|
||||
"config_json": {
|
||||
"provider": "internal",
|
||||
"api_base": "${KNOWLEDGE_API_URL}/documents",
|
||||
"api_key_env": "KNOWLEDGE_API_KEY",
|
||||
"embeddings_model": "text-embedding-3-small",
|
||||
"max_chunks": 10,
|
||||
"similarity_threshold": 0.75
|
||||
},
|
||||
"environments": {
|
||||
"production": True,
|
||||
"development": True,
|
||||
"staging": True
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "knowledge_base",
|
||||
"description": "Consulta base de conhecimento para solução de problemas",
|
||||
"config_json": {
|
||||
"provider": "internal",
|
||||
"api_base": "${KNOWLEDGE_API_URL}/kb",
|
||||
"api_key_env": "KNOWLEDGE_API_KEY",
|
||||
"max_results": 3,
|
||||
"categories": ["support", "faq", "troubleshooting"]
|
||||
},
|
||||
"environments": {
|
||||
"production": True,
|
||||
"development": True,
|
||||
"staging": True
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "whatsapp_integration",
|
||||
"description": "Integração com WhatsApp para envio e recebimento de mensagens",
|
||||
"config_json": {
|
||||
"provider": "meta",
|
||||
"api_base": "https://graph.facebook.com/v17.0",
|
||||
"api_key_env": "WHATSAPP_API_KEY",
|
||||
"phone_number_id": "${WHATSAPP_PHONE_ID}",
|
||||
"webhook_verify_token": "${WHATSAPP_VERIFY_TOKEN}",
|
||||
"templates_enabled": True
|
||||
},
|
||||
"environments": {
|
||||
"production": True,
|
||||
"development": False,
|
||||
"staging": True
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "telegram_integration",
|
||||
"description": "Integração com Telegram para envio e recebimento de mensagens",
|
||||
"config_json": {
|
||||
"provider": "telegram",
|
||||
"api_base": "https://api.telegram.org",
|
||||
"api_key_env": "TELEGRAM_BOT_TOKEN",
|
||||
"webhook_url": "${APP_URL}/webhook/telegram",
|
||||
"allowed_updates": ["message", "callback_query"]
|
||||
},
|
||||
"environments": {
|
||||
"production": True,
|
||||
"development": False,
|
||||
"staging": True
|
||||
}
|
||||
}
|
||||
]
|
||||
tools = []
|
||||
|
||||
# Criar as ferramentas
|
||||
for tool_data in tools:
|
||||
# Substituir placeholders por variáveis de ambiente quando disponíveis
|
||||
if "api_base" in tool_data["config_json"]:
|
||||
if "${KNOWLEDGE_API_URL}" in tool_data["config_json"]["api_base"]:
|
||||
tool_data["config_json"]["api_base"] = tool_data["config_json"]["api_base"].replace(
|
||||
"${KNOWLEDGE_API_URL}", os.getenv("KNOWLEDGE_API_URL", "http://localhost:5540")
|
||||
)
|
||||
|
||||
if "webhook_url" in tool_data["config_json"]:
|
||||
if "${APP_URL}" in tool_data["config_json"]["webhook_url"]:
|
||||
tool_data["config_json"]["webhook_url"] = tool_data["config_json"]["webhook_url"].replace(
|
||||
"${APP_URL}", os.getenv("APP_URL", "http://localhost:8000")
|
||||
)
|
||||
|
||||
if "phone_number_id" in tool_data["config_json"]:
|
||||
if "${WHATSAPP_PHONE_ID}" in tool_data["config_json"]["phone_number_id"]:
|
||||
tool_data["config_json"]["phone_number_id"] = os.getenv("WHATSAPP_PHONE_ID", "")
|
||||
|
||||
if "webhook_verify_token" in tool_data["config_json"]:
|
||||
if "${WHATSAPP_VERIFY_TOKEN}" in tool_data["config_json"]["webhook_verify_token"]:
|
||||
tool_data["config_json"]["webhook_verify_token"] = os.getenv("WHATSAPP_VERIFY_TOKEN", "")
|
||||
|
||||
tool = Tool(
|
||||
name=tool_data["name"],
|
||||
|
||||
Reference in New Issue
Block a user