Skip to content

Commit 8264110

Browse files
committed
removed all logs
1 parent b848e5f commit 8264110

File tree

2 files changed

+1
-36
lines changed

2 files changed

+1
-36
lines changed

api/llm/agent.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import atexit
2-
import logging
32
import os
43
import re
54
from datetime import datetime
@@ -16,10 +15,6 @@
1615

1716
load_dotenv()
1817

19-
# Configure logging
20-
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
21-
logger = logging.getLogger(__name__)
22-
2318
# Global agent instance
2419
_agent_executor = None
2520
_checkpointer = None
@@ -121,18 +116,11 @@ def chat_with_agent(message: str, user_id: str = "default", selected_images: Opt
121116
agent_response = last_message["content"]
122117

123118
# Check if any tools were used (image generation)
124-
logger.info(f"Response keys: {response.keys()}")
125-
logger.info(f"Has intermediate_steps: {'intermediate_steps' in response}")
126119
if "intermediate_steps" in response and response["intermediate_steps"]:
127-
logger.info(f"Intermediate steps: {response['intermediate_steps']}")
128120
for step in response["intermediate_steps"]:
129-
logger.info(f"Step: {step}")
130-
logger.info(f"Step[0] type: {type(step[0])}")
131-
logger.info(f"Step[0] str: {str(step[0])}")
132121
if len(step) >= 2 and "generate_image" in str(step[0]):
133122
# Extract image data from the tool result
134123
tool_result = step[1]
135-
logger.info(f"Tool result: {tool_result}")
136124

137125
# Try multiple patterns to find the image ID
138126
image_id = None
@@ -189,7 +177,7 @@ def chat_with_agent(message: str, user_id: str = "default", selected_images: Opt
189177
}
190178

191179
except Exception as e:
192-
logger.error(f"Error getting S3 metadata: {e}")
180+
print(f"Error getting S3 metadata: {e}")
193181
# Don't return image data if we can't get a valid URL
194182
generated_image_data = None
195183
# Add error message to agent response

api/server/main.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
import logging
21
from typing import Dict, List, Optional
32

43
from fastapi import FastAPI, HTTPException
54
from pydantic import BaseModel
65

76
from llm.agent import chat_with_agent
87

9-
# Configure logging
10-
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
11-
logger = logging.getLogger(__name__)
12-
138
app = FastAPI(
149
title="AI Image Editor API",
1510
description="API for AI-powered image editing assistant",
@@ -40,26 +35,14 @@ class ChatResponse(BaseModel):
4035

4136
@app.get("/")
4237
async def root():
43-
logger.info("Root endpoint accessed")
4438
return {"message": "AI Image Editor API is running!"}
4539

4640

4741
@app.get("/health")
4842
async def health_check():
49-
logger.info("Health check endpoint accessed")
5043
return {"status": "healthy", "service": "ai-image-editor-api"}
5144

5245

53-
@app.get("/logs")
54-
async def get_logs():
55-
"""Get recent logs for debugging (development only)"""
56-
logger.info("Logs endpoint accessed")
57-
return {
58-
"message": "Check Hugging Face Space logs for detailed information",
59-
"logs_url": "https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME/logs",
60-
}
61-
62-
6346
@app.post("/chat", response_model=ChatResponse)
6447
async def chat_endpoint(request: ChatRequest):
6548
"""
@@ -72,8 +55,6 @@ async def chat_endpoint(request: ChatRequest):
7255
ChatResponse with AI response, status, and optional generated image metadata.
7356
"""
7457
try:
75-
logger.info(f"Chat request received - user_id: {request.user_id}, message: {request.message[:100]}...")
76-
7758
# Use the LLM agent to get a response
7859
user_id = request.user_id or "default"
7960
response, generated_image_data = chat_with_agent(
@@ -82,19 +63,15 @@ async def chat_endpoint(request: ChatRequest):
8263
selected_images=request.selected_images,
8364
)
8465

85-
logger.info(f"Agent response received - has generated image: {generated_image_data is not None}")
86-
8766
# Create response with optional generated image
8867
chat_response = ChatResponse(response=response, status="success")
8968

9069
if generated_image_data:
9170
chat_response.generated_image = GeneratedImage(**generated_image_data)
92-
logger.info(f"Generated image data: {generated_image_data}")
9371

9472
return chat_response
9573

9674
except Exception as e:
97-
logger.error(f"Error processing chat request: {str(e)}")
9875
raise HTTPException(status_code=500, detail=f"Error processing request: {str(e)}")
9976

10077

0 commit comments

Comments
 (0)