clean search tool

This commit is contained in:
puzhen 2025-10-22 16:27:16 +01:00
parent 986dda9953
commit ed87a473e7
7 changed files with 154 additions and 169 deletions

View file

@ -49,6 +49,13 @@ async def post(data: Chat, request: Request):
os.environ["OPENAI_API_BASE_URL"] = data.api_url or "https://api.openai.com/v1"
os.environ["CAMEL_MODEL_LOG_ENABLED"] = "true"
# Set user-specific search engine configuration if provided
if data.search_config:
for key, value in data.search_config.items():
if value: # Only set non-empty values
os.environ[key] = value
chat_logger.info(f"Set search config: {key}", extra={"project_id": data.project_id})
email_sanitized = re.sub(r'[\\/*?:"<>|\s]', "_", data.email.split("@")[0]).strip(".")
camel_log = Path.home() / ".eigent" / email_sanitized / ("task_" + data.project_id) / "camel_logs"
camel_log.mkdir(parents=True, exist_ok=True)