Files
socweb/backend/app/config.py
T
gongzhiyongandClaude Sonnet 4.6 ac843da725 feat: add Google Serper search tool alongside Jina MCP
- Add langchain-community dependency for GoogleSerperAPIWrapper
- Add serper_api_key to config with default key
- Create app/tools/serper.py with async serper_search tool
- Register "serper" key in tools/__init__.py (independent from "search"/Jina MCP)
- Add tool title and input/output summaries in chat.py
- Set SERPER_API_KEY on Azure App Service (Operation resource group)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 21:11:22 +08:00

74 lines
2.3 KiB
Python

"""Application configuration via pydantic-settings."""
from __future__ import annotations
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
extra="ignore",
)
# Azure OpenAI
azure_openai_endpoint: str = ""
azure_openai_api_key: str = ""
azure_openai_api_version: str = "2025-04-01-preview"
azure_openai_deployment: str = "gpt-5.4"
# PostgreSQL
database_url: str = "postgresql+asyncpg://azuredb:h13nYoFJX6QrfLzB8bdipEUCjsZq2P7W@dataope.postgres.database.azure.com:5432/soc?ssl=require"
# LangGraph checkpointer uses psycopg (not asyncpg) connection string
@property
def database_url_psycopg(self) -> str:
"""Return psycopg-compatible connection string for LangGraph checkpointer."""
url = self.database_url.replace("postgresql+asyncpg://", "postgresql://")
# psycopg uses sslmode=require, not ssl=require
url = url.replace("?ssl=require", "?sslmode=require")
url = url.replace("&ssl=require", "&sslmode=require")
return url
# KB Agent
kb_agent_url: str = "https://agnetdoc-cve0guf5h8eggmej.southeastasia-01.azurewebsites.net"
kb_agent_api_key: str = ""
kb_agent_search_path: str = "/api/v1/search"
kb_agent_search_timeout_sec: int = 30
# Gongdan (ticket system)
gongdan_api_base: str = "https://gongdan-b5fzbtgteqd5gzfb.eastasia-01.azurewebsites.net"
gongdan_api_key: str = ""
# Jina AI (Search / Reader / Rerank)
jina_api_key: str = ""
# Google Serper
serper_api_key: str = "499940576bc8a7211ac98a3f3b83a4826bb8105b"
# Redis
redis_url: str = "rediss://:bY8ZNwyJX60UwN5NPqnl6HRODfTV0efkDAzCaF1PrOU=@oper.redis.cache.windows.net:6380"
# Doc Creator Agent
doc_agent_url: str = "http://doc-creator-agent-b0d02105-a557fe.taijiagnet.com"
doc_agent_key: str = ""
# Daytona Sandbox
daytona_api_key: str = ""
daytona_api_url: str = "https://app.daytona.io/api"
# Azure Blob Storage
azure_storage_connection_string: str = ""
# Azure Service Bus
azure_service_bus_connection_string: str = ""
# Server
host: str = "0.0.0.0"
port: int = 8000
debug: bool = False
settings = Settings()